Virtual interfaces

Last edit

Added:

> = WORK IN PROGRESS =

Added:

> [http://cateee.net/lkddb/web-lkddb/NET_SCH_NETEM.html Network Emulator (NETEM)] is a Linux kernel configuration if you want to emulate network delay, loss, and packet re-ordering. This is often useful to simulate networks when testing applications or protocols.


WORK IN PROGRESS

Client request

I want to test a very bad TCP/IP connection, how can I simulate this.

Needed

Setting up two virtual interfaces with a bridge between them. Packets must be badly mangled in transition.

Solution for virtual network interfaces

http://en.wikipedia.org/wiki/TUN/TAP

TAP (as in network tap) simulates an Ethernet device and it operates with layer 2 packets such as Ethernet frames. TUN (as in network TUNnel) simulates a network layer device and it operates with layer 3 packets such as IP packets. TAP is used to create a network bridge, while TUN is used with routing.

Packets sent by an operating system via a TUN/TAP device are delivered to a user-space program that attaches itself to the device. A user-space program may also pass packets into a TUN/TAP device. In this case TUN/TAP device delivers (or "injects") these packets to the operating system network stack thus emulating their reception from an external source.

Thus, problem is here that we need to write a user-space program.

Solution for creating broken packets

Standard packet mangling is limited to changing the TOS, DSCP and TTL values.

Raw sockets could help, as well as a custom kernel device driver, see also [1]. But this requires a lot of hacking.

Scapy is a powerful interactive packet manipulation program. Sample chapter on Scapy.

Network Emulator (NETEM) is a Linux kernel configuration if you want to emulate network delay, loss, and packet re-ordering. This is often useful to simulate networks when testing applications or protocols.