Networking Forums

Networking Forums > Computer Networking > Linux Networking > source based routing - network unreachable

Reply
Thread Tools Display Modes

source based routing - network unreachable

 
 
hobosalesman@gmail.com
Guest
Posts: n/a

 
      07-05-2006, 06:12 AM
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

 
Reply With Quote
 
 
 
 
jewo
Guest
Posts: n/a

 
      07-05-2006, 01:09 PM
> 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


is $INET_GW realy part of the subnet of eth1?
 
Reply With Quote
 
hobosalesman@gmail.com
Guest
Posts: n/a

 
      07-07-2006, 11:51 PM
jewo wrote:
> > 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

>
> is $INET_GW realy part of the subnet of eth1?


Yep.

INET_GW = x.y.246.254
eth1 uses x.y.246.186
The subnet is x.y.246.0/24

I'm really confused because all the commands are literally cut/paste
from setting up eth2, but it doesn't work.

 
Reply With Quote
 
hobosalesman@gmail.com
Guest
Posts: n/a

 
      07-08-2006, 12:18 AM
Still beating my head against the wall, heres my script:

ip route flush table main
ip route flush table servers

ip rule add from $LAN_NET_SERVERS table servers

ip route add $INET_NET dev $EXT_IFACE_2
ip route add default via $INET_GW dev $EXT_IFACE_2

ip route add $INET_NET dev $EXT_IFACE_1 table servers
ip route add default via $INET_GW dev $EXT_IFACE_1 table servers
#At this point the command above fails with "RTNETLINK answers: network
unreachable"

ip route add $LAN_NET dev $LAN_IFACE

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
source based routing help needed Jack Snodgrass Linux Networking 4 02-29-2008 10:31 AM
VPN server: routing based on source IP? Ryan Windows Networking 5 10-14-2007 04:41 AM
rtnetlink: network unreachable for Routing for multiple uplinks using ip route add joerg sauer Linux Networking 6 04-19-2005 11:13 AM
linux routing rules (based on session source) Moonstruck Linux Networking 3 09-16-2003 01:32 AM
linux routing rules (based on session source) Moonstruck Linux Networking 0 09-13-2003 02:13 PM



1 2 3 4 5 6 7 8 9 10 11