Skip to contentSkip to conversation

Routing rule for two gateways.

DISCUSSION Sundaram 4 participants 8 messages Sep 20, 2002 – Sep 24, 2002

lore
Share & tools
lore

Sundaram

author
#0 lore raw

Routing rule for two gateways.

I have two Linux netfilter gateways for my network (1) 192.168.1.10, (1) 192.168.1.100 public IP in the external interface. Inside LAN I am running ftp server (192.168.1.50) with default gateway as 192.168.1.10. From Internet using Fist gateway public IP address I was able to access the ftp server, but using second gateway public IP address I was not able to access the ftp server.

Where I need to set the routing, so that I can access the ftp server using both gateway.

Thanks in advance

-SR

#1 lore raw

Hi Sundaram,
I think you can specify both the gws as the default gateways and can connect
from internet using both the gateways.
Regards,
Dharmendra.T
Linux Security Expert
www.nsecure.net
[email protected]

Quoted 21 lines · Sundaram

Routing rule for two gateways.

I have two Linux netfilter gateways for my network (1) 192.168.1.10, (1) 192.168.1.100 public IP in the external interface. Inside LAN I am running ftp server (192.168.1.50) with default gateway as 192.168.1.10. From Internet using Fist gateway public IP address I was able to access the ftp server, but using second gateway public IP address I was not able to access the ftp server.

Where I need to set the routing, so that I can access the ftp server using both gateway.

Thanks in advance

-SR

#2 lore raw

What is the Linux command and syntax to set two default gateway.

Thanks

----- Original Message -----
From: "Dharmendra.T" <[email protected]>
To: "Sundaram" <[email protected]>; <[email protected]>
Sent: Friday, September 20, 2002 4:47 AM
Subject: Re: Routing rule for two gateways.

Quoted 2 lines

Hi Sundaram,
I think you can specify both the gws as the default gateways and can

connect

Quoted 12 lines

from internet using both the gateways.
Regards,
Dharmendra.T
Linux Security Expert
www.nsecure.net
[email protected]

Quoted 5 lines · Sundaram

Routing rule for two gateways.

I have two Linux netfilter gateways for my network (1) 192.168.1.10,

(1)

Quoted 1 line
Quoted 1 line

192.168.1.100 public IP in the external interface. Inside LAN I am

running

Quoted 2 lines
Quoted 2 lines

ftp server (192.168.1.50) with default gateway as 192.168.1.10. From Internet using Fist gateway public IP address I was able to access the

ftp

Quoted 1 line
Quoted 1 line

server, but using second gateway public IP address I was not able to

access

Quoted 5 lines
Quoted 5 lines

the ftp server.

Where I need to set the routing, so that I can access the ftp server

using

Quoted 10 lines
Quoted 7 lines

both gateway.

Thanks in advance

-SR

--

#3 lore raw
Quoted 1 line · Sundaram Ramasamy

What is the Linux command and syntax to set two default gateway.

The question does not make sense. You can have two (or more) gateways, but
only one of them can be the default.

Default means "the one to use when there is no reason to use any other".

Although it is perfectly possible to type on a Linux machine:

route add default gw 192.168.0.1
route add default gw 172.16.0.1
route add default gw 10.0.0.1

And produce a routing table with three "default gateways" listed, only one of them will ever get used, because the Linux routing table works on a "first match" basis, so all packets will match the same entry and go out by that route.

Antony.

Signature · 5 lines
Never write it in Perl if you can do it in Awk.
Never do it in Awk if sed can handle it.
Never use sed when tr can do the job.
Never invoke tr when cat is sufficient.
Avoid using cat whenever possible.
#4 lore raw
Quoted 6 lines · Antony Stone
Quoted 1 line · Sundaram Ramasamy

What is the Linux command and syntax to set two default gateway.

The question does not make sense. You can have two (or more) gateways, but
only one of them can be the default.

You'll find on http://www.lartc.org/howto/lartc.rpdb.multiple-links.html
that this is not entirely true - you can use multipath routes (but this require support compiled into the kernel). However this has nothing to do with iptables/netfilter at all.

/Rasmus

Signature · 4 lines
-- [ Rasmus "Møffe" Bøg Hansen ] ---------------------------------------
The reason we come up with new versions is not to fix bugs.
                                              -- Bill Gates
----------------------------------[ moffe at amagerkollegiet dot dk ] --
#5 lore raw
Quoted 10 lines · Rasmus Bøg Hansen
Quoted 5 lines · Antony Stone
Quoted 1 line · Sundaram Ramasamy

What is the Linux command and syntax to set two default gateway.

The question does not make sense. You can have two (or more) gateways,
but only one of them can be the default.

You'll find on http://www.lartc.org/howto/lartc.rpdb.multiple-links.html
that this is not entirely true - you can use multipath routes (but this require support compiled into the kernel).

Um.... Although I agree that multipath routing can certainly be done, I
still don't think this is the same as "two default routes" (for the reason I gave above).

In fact on the webpage you quote it shows how to set up two routes with
specific routing tables for each. Once that is done, one of them is
designated to be the default route. One of them......

It is certainly possible to have two (or more) routes from a network of
computers to the Internet. However for each machine in the network, or for
each gateway router, there can only be one default route.

Antony.

Signature · 5 lines
All matter in the Universe can be placed into one of two categories:

1. things which need to be fixed
2. things which will need to be fixed once you've had a few minutes to play 
with them
#6 lore raw
Quoted 7 lines · Antony Stone
Quoted 3 lines

You'll find on http://www.lartc.org/howto/lartc.rpdb.multiple-links.html
that this is not entirely true - you can use multipath routes (but this require support compiled into the kernel).

Um.... Although I agree that multipath routing can certainly be done, I
still don't think this is the same as "two default routes" (for the reason I gave above).

Well, it will never be the same as true bundling - however close enough to be useful.

Quoted 3 lines

In fact on the webpage you quote it shows how to set up two routes with
specific routing tables for each. Once that is done, one of them is
designated to be the default route. One of them......

That's right, but with multipath routing the non-default route will be used too.

Quoted 3 lines

It is certainly possible to have two (or more) routes from a network of
computers to the Internet. However for each machine in the network, or for
each gateway router, there can only be one default route.

It does not matter for the client machines if you have a dedicated router, which is aware of multipath routing - but of course that router needs to know of the different routes and how to use them.

/Rasmus

Signature · 4 lines
-- [ Rasmus "Møffe" Bøg Hansen ] ---------------------------------------
The reason we come up with new versions is not to fix bugs.
                                              -- Bill Gates
----------------------------------[ moffe at amagerkollegiet dot dk ] --
author
#7 lore raw
In reply to Antony Stone

See the following output :
This is from my Sun Solaris Machine, it takes two default gateway.

bash-2.03$ netstat -rn

Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------

192.168.1.0          192.168.1.130         U        1    430  hme0
224.0.0.0            192.168.1.130         U        1      0  hme0
default              192.168.1.200         UG       1   1579
default              192.168.1.1           UG       1   1678
127.0.0.1            127.0.0.1             UH       3  14767  lo0

Routing Table: IPv6
Destination/Mask Gateway Flags Ref Use If
--------------------------- --------------------------- ----- --- ------ --- --
fe80::/10 fe80::a00:20ff:fef0:d1ac U 1 0
hme0
ff00::/8 fe80::a00:20ff:fef0:d1ac U 1 0
hme0
default fe80::a00:20ff:fef0:d1ac U 1 0
hme0
::1 ::1 UH 1 0 lo0
bash-2.03$

I have to add the ip address to /etc/defaultroute file.

bash-2.03$ cat /etc/defaultrouter
192.168.1.200
192.168.1.1
bash-2.03$

Same thing is not possible in Linux??
Thanks
Sundaram

----- Original Message -----
From: "Antony Stone" <[email protected]>
To: <[email protected]>
Sent: Monday, September 23, 2002 6:13 PM
Subject: Re: Routing rule for two gateways.

Quoted 7 lines · Rasmus Bøg Hansen
Quoted 6 lines · Antony Stone
Quoted 4 lines · Sundaram Ramasamy
Quoted 1 line

What is the Linux command and syntax to set two default gateway.

The question does not make sense. You can have two (or more)

gateways,

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

but only one of them can be the default.

You'll find on http://www.lartc.org/howto/lartc.rpdb.multiple-links.html
that this is not entirely true - you can use multipath routes (but this require support compiled into the kernel).

Um.... Although I agree that multipath routing can certainly be done, I
still don't think this is the same as "two default routes" (for the reason

I

Quoted 8 lines

gave above).

In fact on the webpage you quote it shows how to set up two routes with
specific routing tables for each. Once that is done, one of them is
designated to be the default route. One of them......

It is certainly possible to have two (or more) routes from a network of
computers to the Internet. However for each machine in the network, or

for

Quoted 10 lines

each gateway router, there can only be one default route.

Antony.

--

All matter in the Universe can be placed into one of two categories:

1. things which need to be fixed
2. things which will need to be fixed once you've had a few minutes to

play

Quoted 2 lines

with them