From: Juanjillo on
Hello,

I need to put some static routes in Ubuntu Server 9.10.

Mi default GW is 172.16.4.240 and my network mask is 255.255.252.0

I want to all the trafic for a subnet 172.16.20.0 goes for other
gateway (172.26.4.20), but for only one ip the trafic goes for the
default gateway.

I add this in /etc/network/interfaces

#Static Routes
up route add -net 172.16.20.0/22 gw 172.16.4.20 dev eth0
up route add -host 172.16.20.240 gw 172.16.4.240 dev eth0

I restart the network and give some errors and doesn�t work.

Is this the correct way to do it?
Any advice?

Thanks.
Kind regards.


From: Tauno Voipio on
On 18.3.10 1:42 , Juanjillo wrote:
> Hello,
>
> I need to put some static routes in Ubuntu Server 9.10.
>
> Mi default GW is 172.16.4.240 and my network mask is 255.255.252.0
>
> I want to all the trafic for a subnet 172.16.20.0 goes for other gateway
> (172.26.4.20), but for only one ip the trafic goes for the default gateway.
>
> I add this in /etc/network/interfaces
>
> #Static Routes
> up route add -net 172.16.20.0/22 gw 172.16.4.20 dev eth0
> up route add -host 172.16.20.240 gw 172.16.4.240 dev eth0
>
> I restart the network and give some errors and doesn�t work.
>
> Is this the correct way to do it?
> Any advice?


Please post the error messages, and the output of

/sbin/route -n

--

Tauno Voipio
tauno voipio (at) iki fi


From: klaus zerwes on
Juanjillo wrote:
> Hello,

Hello

> I need to put some static routes in Ubuntu Server 9.10.
>
> Mi default GW is 172.16.4.240 and my network mask is 255.255.252.0
>
> I want to all the trafic for a subnet 172.16.20.0 goes for other gateway
> (172.26.4.20), but for only one ip the trafic goes for the default gateway.
>
> I add this in /etc/network/interfaces
>
> #Static Routes
> up route add -net 172.16.20.0/22 gw 172.16.4.20 dev eth0
> up route add -host 172.16.20.240 gw 172.16.4.240 dev eth0

Probably this is not the cause of the error you get, but you must change
the order of the two "up" commands.
Routing works like "first match wins" and 172.16.20.240 will always
match 172.16.20.0/22.

Do you really need the "dev eth0" part?
If not, leave it away. It may only cause you headache if you insert
another NIC into the server.

> I restart the network and give some errors and doesn�t work.

Please post the error message, so we all may see what you are speaking
about.

> Is this the correct way to do it?
> Any advice?
>
> Thanks.
> Kind regards.

Klaus


--
Klaus Zerwes
http://www.zero-sys.net
From: Moe Trin on
On Fri, 19 Mar 2010, in the Usenet newsgroup comp.os.linux.networking, in
article <ho0829$o1v$00$1(a)news.t-online.com>, klaus zerwes wrote:

>Juanjillo wrote:

>> up route add -net 172.16.20.0/22 gw 172.16.4.20 dev eth0
>> up route add -host 172.16.20.240 gw 172.16.4.240 dev eth0

>Probably this is not the cause of the error you get, but you must change
>the order of the two "up" commands.
>Routing works like "first match wins" and 172.16.20.240 will always
>match 172.16.20.0/22.

No, the order is "best match wins" so '172.16.20.240' will ONLY match
that specific host and nothing else. 172.16.20.0/22. will match any
address from 172.16.20.0 to 172.16.23.255, which includes 172.16.20.240
but the host route is better for that address alone.

Old guy