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.

I have a linux box with 9 NICs on it, and I want eight of them to have unique addresses on the same subnet, e.g.:

ifconfig eth1 192.168.123.1 netmask 255.255.0.0
ifconfig eth2 192.168.123.2 netmask 255.255.0.0
ifconfig eth3 192.168.123.3 netmask 255.255.0.0
...
ifconfig eth8 192.168.123.8 netmask 255.255.0.0

The default ARP behaviour is extremely counterproductive in this case, since it results in all traffic for all IPs passing exclusively through eth1, which is pretty much the exact opposite of what I want.

So I rummaged around and ended up making some changes to sysctl such as this:

net.ipv4.conf.all.arp_filter=1
net.ipv4.conf.all.arp_ignore=1
net.ipv4.conf.all.arp_announce=2

That did prevent eth1 from impersonating all the others, but I still can't ping anything other than eth1's address successfully. (e.g. from a second computer on the same switch, only 192.168.123.1 responds to ping)

I'm guessing that I need to do something with arptables or iproute or SOMETHING, but I'm lost at sea in this field.

Bonus Points: Solution must be compatible with Linux 2.6.27.27. (More specifically, Slax 6.1.2)

share|improve this question
    
Can you post the routing table? –  ponsfonze Aug 8 '12 at 0:40
2  
What is your purpose in creating this configuration? What are you trying to accomplish? –  David Schwartz Aug 8 '12 at 1:03
    
this way madness lies. –  Sirex Aug 8 '12 at 3:51
    
if you want to bond these interfaces you're going to have to actually bond them. –  resmon6 Aug 8 '12 at 13:20
1  
@DavidSchwartz No, the machine is not supposed to act like a switch (or router). Think of it more as running 8 virtual machines with a dedicated physical NIC for each VM (Note: I am not running VMs, this is just an analogy). From the point of view of another box on the same network, my single PC should be utterly indistinguishable from eight discrete PCs. –  frustrated_tester Aug 8 '12 at 22:17

3 Answers 3

up vote 4 down vote accepted

You need a strong end system model. Linux is fundamentally built around a weak send system model, so it's really not a good OS choice for this application.

You will have to fake every piece of the behavior you need, from ARP to policy routing to source address selection. You will also need filters to prevent packets from being accepted if they arrive on the wrong interface.

The definitely necessary steps are:

  1. Configure arp_filter=1 and arp_ignore=2 on all interfaces.

  2. Add per-interface, source-based routing for outgoing traffic. (Destination interface must be chosen based on source address.)

  3. Add per-interface ingress filtering to silently drop packets received on the wrong interface. (Packets with a destination address assigned to another interface.)

Unfortunately, there is no consensus on whether these three steps are all that is needed. The weak end system model is built into the entire Linux TCP/IP stack, and it's not clear what might go wrong with subtle issues like multicast.

It's not clear how you would choose the output interface for broadcasts, for example. Should it go out all of them? Maybe. What is the right behavior if the stack gets an outbound broadcast with a source address not assigned to one of the interfaces?

Again, you have chosen the wrong tool for the job.

share|improve this answer

I would recommend bonding the physical interfaces then configure all of the addresses on the single bonded interface.

You'll need support on the switch as well.

Here's a mini tutorial that you can use to get started.

share|improve this answer

It seems you want a test environment equivalent to 9 separate machines, and believed that 9 interfaces on one machine could emulate that. In Linux it simply cannot do this through a single stack for reasons David Schwartz described. BTDT and have the scars. It was bad enough with 2 interfaces.

A better solution might be to run 8 or 9 discrete virtual machines in your one host, and bridge 8 or 9 interfaces to these virtual machines.

share|improve this answer
    
Reading resources: Unix Network Programming: The Sockets Networking API, by Stevens, Fenner, and Rudoff. Also see RFC1122 and RFC4907. –  Skaperen Aug 9 '12 at 1:40

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.