Configuring the default gateway
●Confirmation of the current default gateway
Execute the "route -n" command. "-n" is an option to display the hostname as IP.
[root@Lion ~]# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.11.1 0.0.0.0 UG 100 0 0 eth0 192.168.11.0 0.0.0.0 255.255.255.0 U 100 0 0 eth0 |
The Gateway with default Destination is 192.168.11.1, so we know that the default gateway is 192.168.11.1.
●Remove the default gateway
Set "del" as the argument of the route command, and set the IP address of the default gateway device (192.168.11.1) that you want to delete after "default gw".
[root@Lion ~]# route del default gw 192.168.11.1
[root@Lion ~]# route -n |
●Setting up a new default gateway
Set "add" as the argument of the route command, and set the IP address (192.168.11.2) of the default gateway device you want to set after "default gw".
[root@Lion ~]# route add gw 192.168.11.2
[root@Lion ~]# route -n |