In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the use of linux route command to display and set up the route, the article is very detailed, has a certain reference value, interested friends must read it!
The route command is used to display and set the network routing table in the linux kernel, and the routes set by the route command are mainly static routes. To achieve communication between two different subnets, you need a router connecting two networks, or a gateway located in both networks.
The purpose of setting up routing in a linux system is usually to solve the following problems: the linux system has a gateway in a local area network that allows hosts to access Internet, so it is necessary to set the ip address of this machine to the default route of linux machines.
It is important to note that the route is added by executing the route command directly from the command line and will not be saved permanently. When the network card restarts or the machine restarts, the route fails. You can add the route command to / etc/rc.local to ensure that the routing setting is permanent.
Syntax format: route [parameters]
Common parameters:
-A sets address type (default IPv4)-C prints route cache for linux core-v detail mode-n does not perform DNS reverse lookup Directly display the ip address in digital form-enetstat format displays the routing table-net to the routing table of a network-host to the routing table of a host Add adds the specified route record Del deletes the specified route record Target destination network or destination host gw sets the default gateway mss sets the maximum block length (MSS) of TCP, unit MBwindow specifies the network interface represented by the TCP window size dev routing record connected through the routing table
Reference example
Show the current route:
[root@linuxcool ~] # routeKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault _ gateway 0.0.0.0 UG 10000 ens192192.168.60.0 0.0.0.0 255.255.255.0 U 10000 ens192
Add a routing record:
[root@linuxcool ~] # route add-net 192.168.60.11 netmask 192.168.60.1 dev ens192
Delete routing record:
[root@linuxcool ~] # route del-net 192.168.60.11 netmask 192.168.60.1 dev ens192
Add and remove default gateways:
[root@linuxcool ~] # route add default gw 192.168.60.1 [root@linuxcool ~] # route del default gw 192.168.60.1 and above are all the contents of displaying and setting routes using linux's route command. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.