How to set up the Linux gateway: first use xshell to log in to the Linux server; then use ip add to check the local address and manually add a route; finally write the route add command into the configuration file.
【Recommended related articles: linux tutorial】
How to set up the Linux gateway:
Step 1: Use xshell to log in to our Linux server. This machine uses centos6.5,
Step 2: Use route -n to view the routing table of this machine and see that this machine has no default route
Step 3: Use ip addView the local address, the local address is 192.168.101.2, set the planned gateway to 192.168.101.254
Step 4: Manually add a route
route add default gw 192.168.101.254 to add a default gateway, and then route -n to see that the route has taken effect
Step 5: Using the route add command to add it will only take effect temporarily and will restart. Lost, you need to write it into the configuration file. Follow the following configuration to take effect permanently
vim/etc/sysconfig/network
GATEWAY=192.168.101.254
If you want to know more about programming learning, please pay attention to the php training column!
The above is the detailed content of How to set up linux gateway. For more information, please follow other related articles on the PHP Chinese website!