In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to add permanent static routes to the CentOS server. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.
1. Add permanent static routes to Linux
Method 1: modify the rc.local configuration file
Range: test Ubuntu 14.04, centos 6.4, debian 8.1, redhat 6.4 system available
How to use it:
1. Add the command route add-net 192.168.2.0 24 gw 192.168.2.254 (the default route of the server is 192.168.2.254) to the / etc/rc.local file of the linux system, or add the command route add-net 192.168.3.0 dev eth0, the former relies on the default route for data forwarding, and the latter relies on the network card interface for data forwarding.
2.reboot restart system command takes effect
3. Use the route-n command to see if the command is in effect
Method 2: modify the static-routes configuration file
Scope: test centos 6.4, redhat 6.4 system available
Usage (this method is more practical than rc.local method and can ensure the smooth network link):
1. Add the command any net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.254 (the default route for the server is 192.168.2.254) to the system's / etc/sysconfig/static-routes file (if the system does not have this file, you can create a new file), or add the command any net 192.168.2.0 netmask 255.255.255.0 dev eth0, which relies on the default route to forward data The latter relies on the network card interface to forward the data.
2.service network restart command to restart the network service
3. Use the route-n command to see if the command is in effect
Method 3: modify the interface configuration file
Range: test debian 8.1and Ubuntu 14.04system availability
How to use it:
1. Add the command up route add-net 192.168.2.0 24 gw 192.168.2.254 (the default route of the server is 192.168.2.254) to the system's / etc/network/interface file, or add the command up route add-net 192.168.3.0and24 dev eth0, the former relying on the default route for data forwarding, and the latter relying on the network card interface for data forwarding.
2.reboot restart system command takes effect
3. Use the route-n command to see if the command is in effect
* Note 1: (referencing online content) adding routes to rc.local will cause the problem that NFS cannot be mounted automatically, so the method of using static-routes is the best. Both the restart of the system and the service network restart will take effect. According to the order of linux startup, the contents of rc.local are executed only after all the services of linux are started, that is to say, the contents are executed after netfs. That is to say, when netfs starts, the static route on the server is not added, so netfs mount cannot be successful.
* Note 2: the above commands can be added to the second line of the corresponding file through the linux command sed-I'2i route add-net 192.168.2.0qpr 24 gw 192.168.2.254' + file path command or to the end of the file using echo route add-net 192.168.2.0and24 gw 192.168.2.254 > file path
II. Add permanent static routes to windows
Method 1:
Scope: test windows2008 system availability
How to use it:
1. Open and run cmd.exe as an administrator
two。 Use the command: route-p add 192.168.2.0 mask 255.255.255.0 192.168.2.1 (the default route for the server is 192.168.2.1)
3. Use route print to see if the command is in effect
About how to add permanent static routes to the CentOS server? So much for sharing here. I hope the above content can help you to some extent and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.