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 am running OpenBSD on a network appliance hardware. It has 5 NICs.

I want to give different IP's in same subnet to 3 nics. Eg:

em0: 192.168.1.5 em1: 192.168.1.90 em2: 192.168.1.56

I make the necessary configuration with ifconfig, all interfaces works as expected when all the ethernet ports are plugged in to switch. But there is something wrong in routing. If I connect to 192.16.1.5 via any service(http, smtp etc.), traffic goes over link#3. If I unpug the cable from em2 I can't reach any IP's binded on device. Is there any way to route traffic over different links in this IP configuration?

share|improve this question

migrated from stackoverflow.com Mar 4 '11 at 15:01

This question came from our site for professional and enthusiast programmers.

    
You're doing it wrong. Put all three IPs on a single interface (if you want redundancy or higher throughput, use link aggregation such as LACP or similar). –  Chris S Mar 4 '11 at 15:17
    
This is what OpenBSD has CARP for. –  Alex Holst Mar 9 '11 at 23:29

5 Answers 5

any Reason you need to have 3 ips on 3 separate Nics? you can use netstat -rn to look at all the routing tables, but normally this doesn't work like you want.

Does your switch support LACP or the like? IF so you can build a LACP group, put all 3 interfaces in it, and then assign 1 IP to the link,and the other IPs at aliases.

share|improve this answer

What you want is Policy based routing.

I'm guessing a that you have the default gw set to the em2 device. Thus when that link is down any traffic directed at em0/1 will default will default to em2 which is then unavailable.

Make sure the traffic to em0/1 is routed back though each respective device and you should be good.

share|improve this answer
    
While this will work, it's probably the least efficient and most complicated solution to the problem. –  Chris S Mar 4 '11 at 15:18

You have a case of asymmetric routing. iproute 2 maybe able to help you. If you really can't use a channel bonding solution with one ip then read this for more information.

http://www.linuxjournal.com/article/7291

share|improve this answer

If you are looking for more throughput/bandwidth than a single NIC can give you there are several ways to do this. The simplest ways are combine NICs in a port-channel (LACP) or put each interface in a different IP subnet. What do they give you?

--Port-channel-- Pro: 1 large capacity virtual NIC Con: The directly connected device must support configuration options for a Port-channel, and it must be of the same type, as there are several different types.

--Different IP Subnet-- Pro: Port-channel supported device is not necessary (low-cost, ubiquitous) Con: An IP router is needed to route packets from one subnet to the others.

If you choose the second option because you have a low-cost, basic switch, heavy use devices must be placed on different subnets to keep the traffic separated. Its difficult for a low-cost switch to help you accomplish this with certainty. If you have multiple low-cost switches, you could use one for each subnet and use the appliance as the router.

Do you have routing turned on in OpenBSD (ip.forwarding=1 in sysctl.conf), or on another device? I can't tell from the info given.

So, what switch/device(s) are you plugging your appliance into? What features does it support?

If it supports VLANs and basic IP routing, then subnets are an option. This means that you can configure routing on the switch/router and your appliance doesn't need to do that work. You setup a VLAN for each subnet, a router IP address for each subnet on the switch, and put a different interface on your appliance on each subnet.

If your switch/device supports port-channeling and you can get it to work, most likely it won't be a bottleneck for the attached devices (unless it is really dated). You don't tell us why you need to run multiple NICs specifically.

share|improve this answer

You don’t say why you are doing this, but if you are doing this because of a scenario like having multiple customers using the same IP address ranges, you’ll need to use routing table IDs to handle this. man route for details on routing tables.

share|improve this answer

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.