Networking Forums

Networking Forums > Computer Networking > Linux Networking > Question: IPROUTES2 Multiple default routes restricted to specificNICs

Reply
Thread Tools Display Modes

Question: IPROUTES2 Multiple default routes restricted to specificNICs

 
 
zedkay
Guest
Posts: n/a

 
      12-23-2010, 08:14 AM
Dear all,


*** BACKGROUND
I have been trying to work out how to configure routing tables on a
server. The problem I came across is that all traffic that comes in on
one interface has to leave on that interface.


*** THE GOAL
Below is the routing table that I would like to create. The O/S is
Suse 11.

# eth0 - 10.254.66.90 netmask 255.255.252.0
# eth0's default gateway is: 10.254.64.73
# eth0's gateway for all traffic to or from 10.0.0.0 is: 10.254.64.50
# --------------------------------------------------
# eth1 - 10.254.42.13 netmask 255.255.252.0
# eth1's default gateway is: 10.254.40.73
# eth1's gateway for all traffic to or from 10.0.0.0 is: 10.254.40.50
# --------------------------------------------------
# All netmasks are /22 255.255.252.0
# All traffic that enters on eth1 should exit on eth1, the same is
true for eth0. Each NIC is isolated on its own VLAN.


Here is the currently working routes file, that is used with only eth0,
and works:
# cat /etc/sysconfig/network/routes
default 10.254.64.73 255.255.252.0 -
10.0.0.0 10.254.64.50 255.0.0.0 -

*** EARLIER ATTEMPTS AND FAILURE
Using the file above above as a template, I tried to do this with the
usual routing style, but this causes the server to have messed up
routing tables successfully disconnecting the server from the network:
# cat /etc/sysconfig/network/routes
default 10.254.64.73 255.255.252.0 eth0
default 10.254.40.73 255.255.252.0 eth1
10.0.0.0 10.254.64.50 255.0.0.0 eth0
10.0.0.0 10.254.40.50 255.0.0.0 eth1
I do not think this is the best way to go.


*** IPROUTES
I decided that this was not the best way and IPROUTE2 would be the
better choice.

I read that iproutes could be able to perform this, but cannot really
get to grips with the syntax. I think something could be achieved with
: ip rule add iff eth0 <insert rest of command>, and then use several of
these to route the traffic, but I am very unsure. I am certain that
there are better ways to do this, but I only typed 'ip rule show' for
the first time last night...


*** CRY FOR HELP
Does anyone know whether what I want is possible, and if so could offer
some advise on how to go about this, because I am pretty lost with this?

Best regards.
Z

--
Please do not reply to my Email address. It is a faux Email address.
Cyberpunk FPS/MMORG www.neocron.com
Runs on Windows, platinum in latest WINE/Ubuntu. Running since 2002.
 
Reply With Quote
 
 
 
 
zedkay
Guest
Posts: n/a

 
      12-23-2010, 02:05 PM
On 12/23/2010 10:14 AM, zedkay wrote:
> Dear all,
>
>
> *** BACKGROUND
> I have been trying to work out how to configure routing tables on a
> server. The problem I came across is that all traffic that comes in on
> one interface has to leave on that interface.
>
>
> *** THE GOAL
> Below is the routing table that I would like to create. The O/S is
> Suse 11.
>
> # eth0 - 10.254.66.90 netmask 255.255.252.0
> # eth0's default gateway is: 10.254.64.73
> # eth0's gateway for all traffic to or from 10.0.0.0 is: 10.254.64.50
> # --------------------------------------------------
> # eth1 - 10.254.42.13 netmask 255.255.252.0
> # eth1's default gateway is: 10.254.40.73
> # eth1's gateway for all traffic to or from 10.0.0.0 is: 10.254.40.50
> # --------------------------------------------------
> # All netmasks are /22 255.255.252.0
> # All traffic that enters on eth1 should exit on eth1, the same is
> true for eth0. Each NIC is isolated on its own VLAN.
>
>
> Here is the currently working routes file, that is used with only eth0,
> and works:
> # cat /etc/sysconfig/network/routes
> default 10.254.64.73 255.255.252.0 -
> 10.0.0.0 10.254.64.50 255.0.0.0 -
>
> *** EARLIER ATTEMPTS AND FAILURE
> Using the file above above as a template, I tried to do this with the
> usual routing style, but this causes the server to have messed up
> routing tables successfully disconnecting the server from the network:
> # cat /etc/sysconfig/network/routes
> default 10.254.64.73 255.255.252.0 eth0
> default 10.254.40.73 255.255.252.0 eth1
> 10.0.0.0 10.254.64.50 255.0.0.0 eth0
> 10.0.0.0 10.254.40.50 255.0.0.0 eth1
> I do not think this is the best way to go.
>
>
> *** IPROUTES
> I decided that this was not the best way and IPROUTE2 would be the
> better choice.
>
> I read that iproutes could be able to perform this, but cannot really
> get to grips with the syntax. I think something could be achieved with
> : ip rule add iff eth0 <insert rest of command>, and then use several of
> these to route the traffic, but I am very unsure. I am certain that
> there are better ways to do this, but I only typed 'ip rule show' for
> the first time last night...
>
>
> *** CRY FOR HELP
> Does anyone know whether what I want is possible, and if so could offer
> some advise on how to go about this, because I am pretty lost with this?
>
> Best regards.
> Z
>


Problem solved at an application level: Squid: Force the outgoing IP
to be used by squid (as this is the only application that'll make use of it)
tcp_outgoing_address 1.2.3.4 (or whatever IP it is)


--
Please do not reply to my Email address. It is a faux Email address.
Cyberpunk FPS/MMORG www.neocron.com
Runs on Windows, platinum in latest WINE/Ubuntu. Running since 2002.
 
Reply With Quote
 
Chris Davies
Guest
Posts: n/a

 
      12-24-2010, 08:24 AM
zedkay <(E-Mail Removed)> wrote:
> I have been trying to work out how to configure routing tables on a
> server.


> Below is the routing table that I would like to create


> # eth0 - 10.254.66.90 netmask 255.255.252.0
> # eth0's default gateway is: 10.254.64.73
> # eth0's gateway for all traffic to or from 10.0.0.0 is: 10.254.64.50
> # --------------------------------------------------
> # eth1 - 10.254.42.13 netmask 255.255.252.0
> # eth1's default gateway is: 10.254.40.73
> # eth1's gateway for all traffic to or from 10.0.0.0 is: 10.254.40.50
> # --------------------------------------------------
> # All netmasks are /22 255.255.252.0
> # All traffic that enters on eth1 should exit on eth1, the same is
> true for eth0. Each NIC is isolated on its own VLAN.


Which interface should be chosen for traffic originating on
this server destined for targets outside your interface LANs
10.254.66.90/255.255.252.0 and 10.254.42.13/255.255.252.0? For example,
10.1.2.3 or 87.127.161.67.

You *cannot* have two default routes: the default route is by definition
the default for all traffic not explicitly routed.


> Does anyone know whether what I want is possible, and if so could offer
> some advise on how to go about this, because I am pretty lost with this?


As described, this is not possible. But you may be able to achieve what
you want by thinking your network requirements.

Chris
 
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
Multiple default routes j-k-l@mail.ru Linux Networking 0 04-09-2008 11:20 AM
Multiple default routes - sorting by interface priority =?UTF-8?B?TGFzc2UgS8Okcmtrw6RpbmVuIC8gVHJvbmlj?= Linux Networking 2 03-05-2006 11:02 AM
Multiple default routes on multiple interfaces t_pascal@my-deja.com Linux Networking 3 07-07-2005 03:28 PM
redundant default routes? Jay McCanta Linux Networking 1 10-11-2004 01:15 PM
Multiple default routes Kool Breeze Linux Networking 5 12-04-2003 01:41 AM



1 2 3 4 5 6 7 8 9 10 11