Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Im developing a software product that uses networking features like device bonding an multi-homing protocols. As with any protocol development, test-code needs to take latency, package-dropping etc. into account. I am therefore trying to create a virtual network environment in which I can do controllable, reproducible tests.

The two main features I want to test(ie. measure performance, stability etc.):

  • SCTP multihoming associations where the client uses several endpoints.
  • Device bonding of several devices.

As mentioned, I want to be able to do traffic control between the nodes in the network, as well as traffic filtering to simulate legacy NATs etc.

Example test:

This test is supposed to emulate a client with four NICs (wifi, usb, bluetooth, ethernet) communicating over the internet with a single-interface server.

I would like to create a virtual network that emulates this layout. One device emulates a WAN node, and four others represents the clients interfaces. There is a bandwidth limit on 1 Mb/s between the client interfaces and the server interface and a package-loss of 1%.

A bonding device of the four client interfaces is created. A iperf server is bound to the WAN address and a client is bound to the bonding device address and connected to the WAN server.

share|improve this question
    
Either I'm misunderstanding something, or you don't know that you can do ifconfig eth0:1 10.0.0.2; ifconfig eth0:2 10.0.0.3; ifconfig eth0:3 10.0.0.4. My guess is that I'm misunderstanding; can you clarify? –  MadHatter Apr 25 '13 at 12:34
    
I have so far ended up with something similar (I think). I assign multiple mac-addresses to my wireless card using ip link add link DEV address MAC type macvlan. Additionally I assign these interfaces addresses on separate subnets. My next trouble is to route traffic between these interfaces. Say macvlan0 has address 10.0.0.1/24 and macvlan1 has address 10.0.1.1. How would I allow for communication between these addresses? –  prinsen Apr 25 '13 at 12:49
    
The question "how do I get a linux box to route" is a bit too big to cover here, so I'm afraid that, now you've clarified, I'm going to vote to close this question. You might want to look into echo 1 > /proc/sys/net/ipv4/ip_forward, though. –  MadHatter Apr 25 '13 at 13:05
    
I have enabled forwarding and my routes look correct. Pinging one device from the other results in network unreachable. However, this is not my main question. Both mentioned methods still use a physical device. Is it possible to create a completly virtual device. Veth looks interrsting but I cant figure out its exact use –  prinsen Apr 25 '13 at 13:14
    
Sorry, pressed send to early, see my edited comment –  prinsen Apr 25 '13 at 13:20

1 Answer 1

Sounds like you want to use something like 'tc' (se http://www.linuxcommand.org/man_pages/tc8.html for more detail) on the various interfaces, using the 'netem' kernel component.

An example would be:

tc qdisc add dev eth1 root handle 1: netem delay 500ms 125ms reorder 3% loss 2%

See http://man.he.net/man8/tc for the manpage on 'tc'.

See http://www.linuxfoundation.org/collaborate/workgroups/networking/netem for info on how to use the netem module with tc.

share|improve this answer
    
tc would let me do all traffic control needed. However, I'm struggling with the creation of the virtual interfaces and to set up proper routing between these. What I have done so far is to create a set of virtual interfaces of type macvlan. How do I force traffic to one interface to pass though another one? –  prinsen Apr 27 '13 at 9:40
    
Check out this other SF question: serverfault.com/questions/332229/… <-- not sure if helpful, I have no experience using 'macvlan' int's myself... –  Will Dennis Apr 29 '13 at 17:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.