Specifying the gateway globally has certain advantages in static networking environments, especially if more than one network interface is present. It can make fault finding simpler if applied consistently. This option is not recommend as it can have unexpected consequences if an interface goes down and it can complicate fault finding. This file specifies gateway and host information for all network interfaces.
For more information about this file and the directives it accepts, refer to Section The default gateway is traditionally a dedicated network router. If static routes are required, they can be added to the routing table by means of the ip route add command and removed using the ip route del command. The more frequently used ip route commands take the following form: ip route [ add del change append replace ] destination-address See the ip-route 8 man page for more details on the options and formats.
Use the ip route command without options to display the IP routing table. The network prefix is the number of enabled bits in the subnet mask. The dev option can be omitted, it is optional.
If a route to a remote network is required, a static route can be specified as follows. Each line is parsed as an individual route:. The address It is preferably the next hop address but the address of the exit interface will work. The dev option can be used to specify the exit interface interface but it is not required.
Add as many static routes as required. The following is an example of a route- interface file using the ip command arguments format. The default gateway is The two static routes are for reaching the In the above example, packets going to the local Packets going to the In the above example, packets going to the local Packets going to the Packets to unknown, remote, networks will use the default gateway therefore static routes should only be configured for remote networks or hosts if the default route is not suitable.
Remote in this context means any networks or hosts that are not directly attached to the system. Specifying an exit interface is optional. It can be useful if you want to force traffic out of a specific interface.
0コメント