3

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...

5 Answers 5

4

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: http://www.ubuntugeek.com/howto-add-permanent-static-routes-in-ubuntu.html

2
2

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

Then:

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

Or:

# 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)

1

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.

J

1

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 :

Server1
- nic1 = 10.1.2.3
- nic2 = 192.168.2.3

Server2
- nic1 = 10.1.2.4
- nic2 = 192.168.2.4

server1:/etc/hosts

192.168.2.4 server2

server2:/etc/hosts

192.168.2.3 server1

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

0

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 ?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .