Disable Route Optimization in Linux

Tony Arnold tony.arnold at manchester.ac.uk
Sat Feb 3 20:07:02 UTC 2007


Bruce,

Bruce wrote:
> Tony Arnold wrote:
>> Bruce,
>>
>> Bruce wrote:
>>   
>>> Greetings,
>>>
>>> I'm working toward building up a couple of test fixtures that require me 
>>> to generate multiple channels of Ethernet traffic.  I have some Perl 
>>> code that will allow me to send and receive traffic using specified 
>>> local and peer ports.  I seem to have only one problem that is 
>>> preventing me from getting started.  Linux is optimizing all my traffic 
>>> to go through the default port.
>>>
>>> To be more specific, let's assume I have a 8 port switch to be tested.  
>>> Assume I have two Linux boxes with a quad NIC card in each.  Assume the 
>>> 8 ports from the two quad NIC cards all get plugged into the switch.  To 
>>> test each switch port I need to be able to generate traffic from all 8 
>>> ports of the two quad NIC cards.  Linux optimizes my routes and sends 
>>> all traffic through the default eth port, even when I specify another port.
>>>
>>> Is there any way to turn off the router in Linux or at least override it 
>>> with my desired routes?  I have tried many combinations of "route add", 
>>> "route del", "ip route add x.x.x.x via y.y.y.y.  So far I am striking 
>>> out.  Any help would be appreciated.
>>>     
>>
>> Do you have different networks numbers (i.e., logically and the netmask
>> with the ip address and you should get a different answer for each
>> interface) on each interface to make sure they are effectively on
>> different networks so far as IP is concerned? You would also need to set
>> up routes for each network/interface.
>>
>> Regards,
>> Tony.
>>   
> One of my many experiments was to try 192.168.25.x for one port and
> 192.168.26.y for the other port.  I made my best attempt to set up
> routes and masks but I don't know for sure that they were the best
> choice.  I was suprised that even though the third octet was different,
> the OS still routed them out the same port.

What I would try is this. Set up pairs of interfaces, one on each machine.

For the first pair set IP address of eth0 (say) as 192.168.25.1, netmask
255.255.255.0 and set a route to network 192.168.25.0 to be 192.168.25.1
on eth0. On the other machine set IP address of eth0 to 192.168.25.2
with netmask 255.255.255.0 and set a route to network 192.168.25.0 to be
192.168.25.2.

Do the same for the second pair on eth1 on each machine changing 25 as
above to 26.

The on the first machine send traffic to 192.168.25.2 and it should go
out on eth0. Send to 192.168.26.2 and it should go out on eth1.

Make sure you remove the default route.

You can use ifconfig to set interface addresses and masks.

For setting routes, you need something like:

	route add -net 192.168.25.0 netmask 255.255.255.0 gw 192.168.25.1 dev eth0

Regards,
Tony.
> 
> Bruce
> 

-- 
Tony Arnold, IT Security Coordinator, University of Manchester,
IT Services Division, Kilburn Building, Oxford Road, Manchester M13 9PL.
T: +44 (0)161 275 6093, F: +44 (0)870 136 1004, M: +44 (0)773 330 0039
E: tony.arnold at manchester.ac.uk, H: http://www.man.ac.uk/Tony.Arnold




More information about the ubuntu-users mailing list