This document describes how to manage the network performance of a Linux system and how to use route, netstat, and tcpdump.
When configuring the network, you must specify the path through which the packet is received for the machine. In Linux, a command route is provided, which can be used to set a static route for the NIC configured by the ifconfig command. This setting is usually introduced in/etc/rc. d/rc. inet1 during system boot.
Here are several examples to illustrate how to use the Linux testing tool route command:
Route add-net 127.0.0.0
This command adds a route entry with a specified address or network to the routing table. Note that the network is A Class A address, the mask is set to 255.0.0.0, and the newly added entry is connected to the lo device.
Route add-net xxx. xxx netmask limit 255.255.0 dev eth0
This command adds a route for the host whose IP address is xxx. xxx, and its network mask is set to 255.255.255.0.
Route del-net xxx. xxx
This command will delete the route of the network xxx. xxx.
The route command of the Linux testing tool can also be used to conveniently manage the route information of the entire network. The output result is the route table of the network. As follows:
- [root@lee /root]#route
- Kernel IP routing table
- Destination Gateway Genmask Flags Metric Ref Use Iface
- 10.10.8.224 * 255.255.255.255 UH 0 0 0 eth0
- 10.10.8.0 * 255.255.255.0 U 0 0 0 eth0
- 127.0.0.0 * 255.0.0.0 U 0 0 0 lo
- default dgc8.njupt.edu 0.0.0.0 UG 0 0 0 eth0
- default dgc8.njupt.edu 0.0.0.0 UG 1 0 0 eth0
- [root@lee /root]#
The meaning of each field in the output result is:
· Destination indicates the Destination IP address of the route.
· Gateway indicates the host name or IP address used by the Gateway. The output "*" indicates no gateway.
· Genmask indicates the network mask of the route. Which of the following describes how to configure routing by bitwise "and" the IP address of the packets and the IP address of the packets sent to the website.
· Flags indicates a route entry. The available flag indicates that the route is starting. H indicates that the target is a host, G indicates that the gateway is used, R indicates that the dynamic route is reset. D indicates that the route is dynamically installed, M indicates modifying the route ,! Indicates that the route is denied.
· Metric indicates the sales volume of the route.
· Ref indicates the number of other routes that depend on the current status of the current route.
· Use indicates the number of route table entries used.
· Iface indicates the destination network of the packet sent by the route.
By viewing the output information, we can conveniently manage the route table of the network.