In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the configuration of linux static routes". In the daily operation, I believe that many people have doubts about the configuration of linux static routes. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "the configuration of linux static routes". Next, please follow the editor to study!
When learning linux, you may encounter the problem of configuring static routes. Here we will introduce the solutions to the problem of configuring linux static routes, and share them with you here. Now there are five devices, PC1, ROUT1,ROUT1, ROUT2,ROUT2, ROUT3,ROUT3, PC2. The topology diagram is shown below:
□-○-□
PC1 ROUT1 ROUT2 ROUT3 PC2
The linux static route IP addresses for the five devices are:
PC1 192.168.1.88/24
ROUT1 192.168.1.128/24 192.168.2.128/24
ROUT2 192.168.2.66/24 192.168.3.66/24
ROUT3 192.168.3.100/24 192.168.4.33/24
PC2 192.168.4.66/24
The PC1 configuration is as follows:
# ifconfig eth0 192.168.1.88 netmask 255.255.255.0
# route add default gw 192.168.1.128
The ROUT1 configuration is as follows:
# ifconfig eth0 192.168.1.128 netmask 255.255.255.0
# ifconfig eth0: 1 192.168.2.128 netmask 255.255.255.0
# route add-net 192.168.4.0 take 24 gw 192.168.2.66
The ROUT2 configuration is as follows:
# ifconfig eth0 192.168.2.66 netmask 255.255.255.0
# ifconfig eth0: 1 192.168.3.66 netmask 255.255.255.0
# route add-net 192.168.1.0 take 24 gw 192.168.2.128
# route add-net 192.168.4.0Accord 24 gw 192.168.3.100
The ROUT3 configuration is as follows:
# ifconfig eth0 192.168.3.100 netmask 255.255.255.0
# ifconfig eth0: 1 192.168.4.33 netmask 255.255.255.0
# route add-net 192.168.1.0 take 24 gw 192.168.3.66
The PC2 configuration is as follows:
# ifconfig eth0 192.168.4.66 netmask 255.255.255.0
# route add default gw 192.168.4.33
So PC1 can ping PC2.
Note:
The above three devices are replaced by three PC. To use the computer replacement, you must enable the IP forwarding function of the computer. Change the content in / proc/sys/net/ipv4/ip_forward to 1 (default is 0), and complete it with the following command
# e cho 1 > / proc/sys/net/ipv4/ip_forward
After the network is restarted, the above file is automatically changed to 0
Add a few commands:
1. Delete the default route
# route del default
2. View linux static routes
# route-n
3. Set the specified network segment route
# route add-net 192.168.3.0 netmask 255.255.255.0 gw 192.168.6.66
Or
# route add-net 192.168.3.0 take 24 gw 192.168.6.66
4. Delete the specified network segment route
# route del-net 192.168.3.0 netmask 255.255.255.0
Or
# route del-net 192.168.3.0 take 24
At this point, the study on "the configuration of linux static routes" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.