I have a debian sarge router with 3 NICs, one on the LAN, two have
external IPs from my ISP (DSL). I want some hosts on my LAN to use one
IP (with NAT), and other hosts to use the other IP. I have a rule to
match the hosts I want and I've created a table called "servers" that
uses a different interface/IP than the main routing table. The problem
is that even though both sets of commands are basically identical
except for the interface they work with, the one operating on the
"servers" table fails.
THe very last line fails with "RTNETLINK answers: Network is
unreachable". Presumably it means $INET_NET is unreachable, and hence
using a host on that network ($INET_GW) isn't possible so it fails.
Since there's a route to that network already created on both the
"main" and "servers" tables I don't understand why.
EXT_IFACE_1="eth1"
EXT_IFACE_2="eth2"
INET_GW="????????" #my ISPs gateway
INET_NET="????????/24" #my ISPs subnet
LAN_NET="10.0.0.0/16"
echo "# MAIN TABLE - $EXT_IFACE_2"
ip route add $INET_NET dev $EXT_IFACE_2
ip route add default via $INET_GW dev $EXT_IFACE_2
echo "# SERVERS TABLE - $EXT_IFACE_1"
ip route add $INET_NET dev $EXT_IFACE_1 table servers
ip route add default via $INET_GW dev $EXT_IFACE_1 table servers
|