Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Setup as follows:

  • One gateway/firewall
  • One switch
  • Two servers behind firewall with 2 NICs each.

Each NIC is connected to the switch. The servers are running Ubuntu server.

One of the two NICs is now used for all traffic.
What I want is for all traffic between the two local servers to use the second currently-unused NICs; how can I do this?
I tried to add a static route with the route command but with not so much success...

share|improve this question

You're on the right track: a static route is definitely what you want to use to ensure traffic between those hosts travels on a specific interface. Here's a doc that might help:

share|improve this answer
The linked article advocates using route, but "modern distributions have deprecated ifconfig and route replacing them with iproute2" – Flexo Mar 3 '11 at 18:03
Hm; I can't really speak to that. We do static routes with ifconfig and route on RHEL 4/5/6; I hadn't been given to understand that was now old hat. Thanks for giving me something to research! – Jeff Albert Mar 3 '11 at 18:12

You can do this quite flexibly with iproute2 and iptables:

# Make a second routing table
/usr/sbin/ip route flush table 2
# Set a new default route for this new table
/usr/sbin/ip route add default via a.b.c.d dev eth5 table 2


# Make some packets use this table instead of the default table
/usr/sbin/ip rule add from to $SUBNET table 2


# Mark some packets in iptables mangle
/usr/sbin/iptables -t mangle -A PREROUTING -d $subnet -j MARK --set-mark 0x5
# make marked packets use this table
/usr/sbin/ip rule add fwmark 5 table 2

(paths may vary on your system and you can integrate it either with NetworkManager by writing a script in /etc/Networkmanager/dispatcher.d/, or /etc/network/interfaces as a pre/post up rule)

share|improve this answer

I think below captures your current setup

|---------|-Nic1  \
| Server A|        \ 
|---------|-Nic2    \--|----------|
                       | Switch 1 |    |------------|
                       |          |----| Firewall 1 |
                       |          |    |------------| 
|---------|-Nic2    /--|----------|
| Server B|        /   
|---------|-Nic1  /

(Server A) Nic 1 IP: 10.20.X.2/24 Nic 2 (Not Active) Default GW 10.20.X.1 (inside IP of Firewall)

(Server B) Nic 1 IP: 10.20.X.3/24 Nic 2 (Not Active) Default GW 10.20.X.1 (inside IP of Firewall)

All you need to do is to configure Nic2 on each server to a different subnet, eg. 192.168.X.2 and 192.168.X.3 . By doing this all communication between both nodes would be on its own local subnet with no need for a static route.

In fact this configuration is much preferable as it separate private traffic from public. Also if you switch can handle if you should set up two Vlans for each pair of nics.


share|improve this answer

Two questions back to the experts : a) Why not link the nic2s directly, bypassing the switch ? Will reduce load on the switch as well (if possible)

b) Why not just edit "/etc/hosts" to point "server2" to the nic2-address.

Example :

- nic1 =
- nic2 =

- nic1 =
- nic2 =

server1:/etc/hosts server2

server2:/etc/hosts server1

This would mean "local administration", yes, but would keep the switch-config clean and simple and keep the load on the switch down.

share|improve this answer

Sorry, perhaps I totally misunderstand, but can't you just use an internal DNS name to your server (using /etc/hosts) that would map to the IP of the second NIC ?

share|improve this answer

Your Answer


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.