This article is the co-ordination of the Linux system network performance, mainly describes the route, netstat, tcpdump three network tuning test tools and its functionality can be achieved.
When you configure the network route to the machine specified receive packets to go through the path of the package. On Linux systems, to provide a command route, this command ifconfig command can be configured network card setting static routes. This setting is usually introduced in/etc/rc.d/rc.inet1, conducted when the system boots. We passed a few examples of how to use the route command: this command will provide routeadd-net127.0.0.0 routing table to add a specified address or network routing. Note at this point network to A class of address mask is set to 255.0.0.0, the newly added entry is connected to lo device. Routeadd-netxxx.xxx.xxx.xxxnetmask255.255.255.0devet0 this command is the IP address for a host of xxx.xxx.xxx.xxx routing, its network mask is set to 255.255.255.0. Routedel-netxxx.xxx.xxx.xxx this command deletes the network routing xxx.xxx.xxx.xxx. Use the route command can also be easily on the entire network routing information for management, the output is the network routing tables. As follows:-----------------------------------------------------------------root @ lee/root] # route KernelIProutingtable DestinationGatewayGenmaskFlagsMetricRefUseIace 10.10.8.224 * 255.255.255.255UH000et0 10.10.8.0 * 255.255.255.0U000et0 127.0.0.0 * 255.0.0.0U000lo defaultdgc8.njupt.edu0.0.0.0UG000et0 defaultdgc8.njupt.edu0.0.0.0UG100et0 root @ lee/root] #------------------------------------------------------------------each field in the output mean: · Destination represents the routing destination IP address. gateway · Gateway that uses the host name or IP address. The above outputs "*" indicates no gateway Genmask indicates that routing ·. network mask. In it and the destination address for the route before comparing the kernel through Genmask and packet IP address with the bitwise and operation to set the route Flags mean ·. routing. The significance of available flags are: U said routing in startup, h for target host, is a means to use the gateway G, R said on dynamic routing for reset settings; D represents a dynamic Setup routing, routing, M represents a modification that reject route.! · Metric indicates that routing overhead of units · Ref represents the dependency., the routing status of other routing number Use indicates that routing ·. table entries used. · Iface represents the routing of packets sent to the network. By viewing the output information, we can easily manage network routing tables. The netstat command netstat is a monitoring TCP/IP network of very useful tool, it can display the routing table, the actual network connections, and each network interface device status information. On the computer, perform the netstat, its output is as follows:-----------------------------------------------------------------root @ lee/root] # netstat ActiveInternetconnections (w/oservers) ProtoRecv-QSend-QLocalAddressForeignAddressState ActiveUNIXdomainsockets (w/oservers) ProtoRefCntFlagsTypesStateI-NodePat Unix5 [] DGRAM460/dev/log Unix0 [] STREAMCONNECTED173  @ 00000014 DGRAM662 Unix0 Unix0 [] [] [] DGRAM631 Unix0 DGRAM544 DGRAM484 Unix0 Unix0 [] [] DGRAM470 root @ lee/root] #------------------------------------------------------------------overall, netstat output can be divided into two parts: part I: YesActiveInternetconnections, called active TCP connections, in the above output, this part has no content, said no TCP connections. Part II: is ActiveUNIXdomainsockets, called active Unix domain socket. The output shows the Unix domain socket connection: · Proto shows connection using protocols. · RefCnt represents the connection to the objective of this process, on the interface Types display set ·. interface type. · State displays the current status of the socket. · path represents connected to the set of interfaces to other processes using the path name. You can use netstat-a to view all sockets of the State, when you debug the network program is very useful. Netstat-r will display the contents of the routing table to specify both the General "-n" option so that you can get the address of a digital format, you can display the default router's IP address. Use the show all netstat-i network interface information. Use netstat also can obtain the current network status, and network topology, which in reality is very useful. Tcpdump tcpdump command is used to monitor the TCP/IP connection and direct read data link layer packet header. You can specify which package a watched, which control to display format. For example we want to monitor all of the communication on Ethernet traffic, perform the following command: tcpdump-iet0 even in a relatively calm network, there are also a lot of traffic, so we might just need to be of interest to those packets of information. In General, the TCP/IP stack to the local host to receive inbound packets binding while ignoring the other computers on the network address (unless you are using a router). When you run tcpdump command, it adds the TCP/IP stack to promiscuous mode. This method receives all packets and to make it valid. If we care about is our local host communication situation, one approach is to use the "-p" argument against promiscuous mode, another approach is to specify the host name: tcpdump-ieth0hosthostname at this point, the system will only host named hostname communication packets. The hostname can be a local host, or network to any computer. The following command to read host hostname to send all data: tcpdump-ieth0srchosthostname following command allows you to monitor all sent to host hostname packets: tcpdump-ieth0dsthosthostname we can also monitor through the specified gateway packets: tcpdump-ieth0gatewayGatewayname if you also want to monitor the addressed to the specified port in TCP or UDP packets, then execute the following command: tcpdump-ieth0hosthostnameandport80 this command displays from each packet outgoing headers and hostname from the host on port 80 of the addressed. Port 80 is the default port number for the HTTP service. If we only need to list sent to port 80, use dstport; if we only want to see the return to port 80, use srcport.
No comments:
Post a Comment