4.6. Configuring the Default Gateway
The default gateway is determined by the network scripts which parse the
/etc/sysconfig/networkfile first and then the network interface
ifcfgfiles for interfaces that are “up”. The
ifcfgfiles are parsed in numerically ascending order, and the last GATEWAY directive to be read is used to compose a default route in the routing table.
You can specify the default route using the GATEWAY directive, either globally or in interface-specific configuration files. However, in Red Hat Enterprise Linux the use of the global
/etc/sysconfig/networkfile is deprecated, and specifying the gateway should now only be done in per-interface configuration files.
In dynamic network environments, where mobile hosts are managed by NetworkManager, gateway information is likely to be interface specific and is best left to be assigned by
DHCP. In special cases where it is necessary to influence NetworkManager's selection of the exit interface to be used to reach a gateway, make use of the
DEFROUTE=nocommand in the
ifcfgfiles for those interfaces which do not lead to the default gateway.