Re: How to set default gw not by route command in linux?



Unruh <unruh-spam@xxxxxxxxxxxxxx> wrote:
"ChaoZhang" <chaozh@xxxxxxxxxx> writes:

My linux pc has two adapters, eth0 is 192.168.1.2 and eth1 is
172.16.2.100. I manually set these ip addresses in ifcfg-eth0 and
ifcfg-eth1 files. I also set 192.168.1.1 and 172.16.2.1 as gateways for
eth0 and eth1. After this, I found the default gw is 172.16.2.1 not

Why do you set gateways for both? Gateways are for default routes. You can
only have one default route. The last one set.

A gateway is for *any* address that is not on a physically connected
network. There might well be multiple physical networks accessable
via gateways through a single interface. Each of those non-directly
connected physical networks will necessarily have a gateway to forward
from one physical network to the other.

It has *nothing* to do with a default, other than that a default route
has to have a gateway specified.

192.168.1.1. I know I can change it through route command. But I think
there must be another way for system to set the default gw is
192.168.1.1. Could you please tell me how to configure it? many thanks!

Get rid of the GATEWAY option for the address you do not want.

What if he needs that gateway to access a non-directly connected
physical network?

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.



Relevant Pages

  • Re: VPN and remote gateway
    ... > It seems you use the wrong route add command. ... > when the VPN connection is established. ... > | using the remote network as my gateway. ...
    (microsoft.public.windows.server.sbs)
  • Re: Persistent Route ignored on W2K when destination network is unavailable
    ... a global setting like the gateway to a particular subnet should be set ... this network access the internet via a NAT firewall (connected to ... via a WAN link. ... route on the Cisco firewall so that any traffic to the internet gets ...
    (microsoft.public.win2000.networking)
  • Re: AIX 1.3 Failures and Fables
    ... DESTINATION GATEWAY FLGS REFCNT USE INTERFACE ... Is my interpretation of the AIX 1.3 #man route correct? ... Manually manipulates the routing tables. ... Is the destination host or network. ...
    (comp.sys.ibm.ps2.hardware)
  • Re: AD-DNS-DHCP
    ... If I do NOT remove the gateway configurationfrom my DHCP ... scope but add route command to my logon script, ...
    (microsoft.public.windows.server.active_directory)
  • Re: AD-DNS-DHCP
    ... Ipconfig will show a second default gateway. ... You could set a metric for the additional gateway, or you could run Route Delete 0.0.0.0 first, ... "Jorge Silva" wrote in message ... If I do NOT remove the gateway configurationfrom my DHCP scope but add route command to my logon script, which one will ultimately prevail, the DHCP gateway configuration or the route add command in the logon script? ...
    (microsoft.public.windows.server.active_directory)