Home>Article>Operation and Maintenance> How to set up linux gateway

How to set up linux gateway

coldplay.xixi
coldplay.xixi Original
2020-08-31 14:36:08 27515browse

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.

How to set up linux gateway

【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,

How to set up linux gateway

Step 2: Use route -n to view the routing table of this machine and see that this machine has no default route

How to set up linux gateway

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

How to set up linux gateway

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

How to set up linux gateway

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

How to set up linux gateway

If you want to know more about programming learning, please pay attention to thephp trainingcolumn!

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn