Bruce32903 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to set up Ethernet test fixtures for several different types of equipment. I am using Perl and had a couple of problems that Perl Monks helped me fix (thank you) in socket communication problems. I still have a problem that seems to be related to the router inside Linux.

For a sample equipment configuration assume I have a 8-port switch to test. Assume I have 2 boxes with a quad NIC card in each. Assume I use 8 patch cables to connect the 8 switch ports to the 8 ports on the two quad NIC cards. Finally, both boxes use code based upon the sample in the above link to run traffic in and out of each of the switch’s 8 ports.

Here is the problem. Linux seems to be routing all my “parallel path” traffic to the default “eth” port. Thus, I am only using one port even though my code has an assortment of IP addresses matching what I assigned to the various cards. Is there some way (ideally within Perl) that I can overcome this problem? I have made many attempts with “route add”, “route del”, “ip route add x.x.x.x/y via z.z.z.z” and others. I just want my Perl code to send and receive transmissions over the eth ports I specify, not the eth ports that provide the best route.

I am running Ubuntu 6.10 Desktop on the boxes.

Thank you,
Bruce

20070208 Janitored by Corion: Localized link

Replies are listed 'Best First'.
Re: Can I Disable Router Optimization?
by gt8073a (Hermit) on Feb 03, 2007 at 18:23 UTC

    Have you looked at Net::RawIP?

    It's a little lower level than IO::Socket::INET; you create your own packets. There are a few requirements, but if you are testng routers/firewalls/etc, nothing beats the control.



    JJ
Re: Can I Disable Router Optimization?
by BrowserUk (Patriarch) on Feb 03, 2007 at 16:17 UTC
Re: Can I Disable Router Optimization?
by polettix (Vicar) on Feb 04, 2007 at 13:51 UTC
    It would help if you provided some bits of information:
    • which addresses (and masks) are assigned to each NIC (ifconfig's output should suffice, if available on the two boxes, otherwise the correspondent ip subcommand)
    • routing configuration (route -n if available, otherwise the correspondent ip subcommand)
    • switch configuration
    • the code you're using for your tests
    Looking at your previous code, it seems that each NIC should have a different address living in a different network (I assume a default of 255.255.255.0 netmask when I see stuff in 192.168.x.y, but CIDR lets you override this so please confirm). If this applies, it should suffice to create a different socket bound to each particular address (using LocalAddr) and use the one corresponding to the NIC you want to send traffic through.

    Flavio
    perl -ple'$_=reverse' <<<ti.xittelop@oivalf

    Don't fool yourself.
Re: Can I Disable Router Optimization?
by badaiaqrandista (Pilgrim) on Feb 04, 2007 at 13:47 UTC

    Have you tried putting each NIC on different subnets?

    This sounds more of a routing problem than Perl problem. If you provide your network configuration details we might be able to help you better.

    -cheepy-
Re: Can I Disable Router Optimization?
by ambrus (Abbot) on Feb 04, 2007 at 10:13 UTC

    You might try reading the ip(7) manpage. I'm not really good in these network issues so I don't know if you'll find anything.

Re: Can I Disable Router Optimization?
by wazoox (Prior) on Feb 05, 2007 at 21:34 UTC
    The way I understand your question it has close to no relation with perl, it's entirely a Linux optimisation question. However you're looking in the wrong direction, IMO if you really want to use all ports, simply use interface bonding, it's pretty easy, and will manage high availability automatically.
    See bonding howto. Though the howto talks about 2 NICs, I tried it with up to 6 gigE interfaces without any problem.