This article introduces the management of Linux system network performance skills, mainly introduces the route, Netstat, tcpdump Three network management test tools and the implementation of the function.
Route
When configuring a network, specify the path that the package will go through when the packet is received. In a Linux system, a command route is provided, which sets a static route for the NIC configured by the Ifconfig command. This setup work is usually introduced in/etc/rc.d/rc.inet1 and is performed at system boot time.
We illustrate how to use the route command with several examples:
Route Add-net 127.0.0.0
This command adds a route to the routing table that specifies the address or network. Note that at this point 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.xxx.xxx netmask 255.255.255.0 Dev eth0
This command adds a route to the host with the IP address xxx.xxx.xxx.xxx, and its netmask is set to 255.255.255.0.
Route del-net xxx.xxx.xxx.xxx
This command deletes the route to xxx.xxx.xxx.xxx this network.
The route command also makes it easy to manage routing information for the entire network, and its output is the routing table for the network. As shown below:
-----------------------------------------------------------------
[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 meanings of each field in the output result are:
· Destination represents the destination IP address of the route.
· The gateway represents the host name or IP address used by the gateways. The output "*" above indicates no gateway.
· Genmask represents the network mask for the route. Before comparing it to the destination address of the route, the kernel sets the route through the bitwise AND operation of the IP address of the Genmask and packet.
· Flags are flags that represent routes. The available flags and their meanings are: U indicates that the route is started, h indicates that target is a host, G indicates that the gateway is used, and r represents the reset setting for dynamic routing; d indicates the dynamic installation of the route, m means to modify the route,!
· Metric indicates the unit sales for the route.
· Ref indicates the number of other routes that depend on the current routing status.
· Use indicates the number of routing table entries to be used.
· Iface represents the destination network for the packets sent by the route.
By looking at these output information, we can easily manage the routing table of the network.
Netstat
The netstat command is a very useful tool for monitoring TCP/IP networks, displaying routing tables, actual network connections, and status information for each network interface device. After the Netstat is executed on the computer, its output looks like this:
-----------------------------------------------------------------
[Root@lee/root] #netstat
Active Internet connections (w/o servers)
Proto recv-q send-q Local address Foreign
Active UNIX domain sockets (w/o servers)
Proto refcnt Flags Types State I-node Path
Unix 5 [] Dgram 460/dev/log
Unix 0 [] STREAM CONNECTED 173 @00000014
Unix 0 [] dgram 662
Unix 0 [] dgram 631
Unix 0 [] Dgram 544
Unix 0 [] dgram 484
Unix 0 [] dgram 470
[root@lee/root]#