Mike Harris
2007-12-04 18:11:25 UTC
Hello,
Am writing to the list in the hope that someone out there might be able
to help me make sure I have the right configuration here. I'm not all
that au fait with routing using multiple interfaces.
Some time ago I configured a web server to have two different IP
addresses from two different network ranges on each of it's two ethernet
cards.
I followed the excellent instructions at
http://lartc.org/lartc.html#AEN268 and came up with the following
configuration:
#!/bin/bash
/sbin/ip route add 194.164.97.0 dev eth0 src 194.164.97.252 table T1
/sbin/ip route add default via 194.164.97.1 table T1
/sbin/ip route add 86.54.82.144 dev eth1 src 86.54.82.146 table T2
/sbin/ip route add default via 86.54.82.145 table T2
/sbin/ip route add 194.164.97.0 dev eth0 src 194.164.97.252
/sbin/ip route add 86.54.82.144 dev eth1 src 86.54.82.146
/sbin/ip route add default via 194.164.97.1
/sbin/ip rule add from 194.164.97.252 table T1
/sbin/ip rule add from 86.54.82.146 table T2
/sbin/iptables-save
I'm uncertain if the last line is actually needed there.
My understanding is that what is supposed to happen is that incoming
traffic to 86.54.82.146 is correctly routed back through the same
interface to the gateway at 86.54.82.145 and similarly traffic to
194.164.97.252 is routed back through 194.164.97.1.
I test this using ping but it doesn't seem to work properly, whichever
interface is set as the default route becomes just that. So 'ping -I
eth0 lartc.org' works but 'ping -I eth1 lartc.org' doesn't.
I've checked to make sure the kernel has the compile parameter
IP_MULTIPLE_TABLES in it and it does.
So I cannot work out where I've gone wrong. I've trawled back over the
LARTC HOWTO and can't spot anything else.
Can anyone help with this, or at least give me some pointers on things
to try?
Thanks in advance,
Mike.
--
----------
Mike Harris
Psand.net
Tlf: +44 7811 671 893 / +34 69 676 3122 / +44 870 162 4927 ext 2
Fax: +44 870 162 4925
Web: http://psand.net
PGP: http://www.psand.net/mike/mike.gpg.pub
IRC: irc://irc.psand.net:6667/#psand
----------
Psand Limited is registered in England and Wales
company number 03291616. Registered office:
54 Goodwin Road, Ramsgate, Kent, CT11 0JJ, UK.
Am writing to the list in the hope that someone out there might be able
to help me make sure I have the right configuration here. I'm not all
that au fait with routing using multiple interfaces.
Some time ago I configured a web server to have two different IP
addresses from two different network ranges on each of it's two ethernet
cards.
I followed the excellent instructions at
http://lartc.org/lartc.html#AEN268 and came up with the following
configuration:
#!/bin/bash
/sbin/ip route add 194.164.97.0 dev eth0 src 194.164.97.252 table T1
/sbin/ip route add default via 194.164.97.1 table T1
/sbin/ip route add 86.54.82.144 dev eth1 src 86.54.82.146 table T2
/sbin/ip route add default via 86.54.82.145 table T2
/sbin/ip route add 194.164.97.0 dev eth0 src 194.164.97.252
/sbin/ip route add 86.54.82.144 dev eth1 src 86.54.82.146
/sbin/ip route add default via 194.164.97.1
/sbin/ip rule add from 194.164.97.252 table T1
/sbin/ip rule add from 86.54.82.146 table T2
/sbin/iptables-save
I'm uncertain if the last line is actually needed there.
My understanding is that what is supposed to happen is that incoming
traffic to 86.54.82.146 is correctly routed back through the same
interface to the gateway at 86.54.82.145 and similarly traffic to
194.164.97.252 is routed back through 194.164.97.1.
I test this using ping but it doesn't seem to work properly, whichever
interface is set as the default route becomes just that. So 'ping -I
eth0 lartc.org' works but 'ping -I eth1 lartc.org' doesn't.
I've checked to make sure the kernel has the compile parameter
IP_MULTIPLE_TABLES in it and it does.
So I cannot work out where I've gone wrong. I've trawled back over the
LARTC HOWTO and can't spot anything else.
Can anyone help with this, or at least give me some pointers on things
to try?
Thanks in advance,
Mike.
--
----------
Mike Harris
Psand.net
Tlf: +44 7811 671 893 / +34 69 676 3122 / +44 870 162 4927 ext 2
Fax: +44 870 162 4925
Web: http://psand.net
PGP: http://www.psand.net/mike/mike.gpg.pub
IRC: irc://irc.psand.net:6667/#psand
----------
Psand Limited is registered in England and Wales
company number 03291616. Registered office:
54 Goodwin Road, Ramsgate, Kent, CT11 0JJ, UK.