1. Ifconfig
Ifconfig is mainly able to manually start, observe and modify the parameters of the network interface, can modify the parameters are very many, including IP parameters and MTU can be modified, his syntax is as follows:
[[email protected] ~]# Ifconfig {interface} {Up|down}
In general, the direct input ifconfig will list the cards that have been started, regardless of whether the card has a set IP, will be displayed. If you enter Ifconfig eth0, the relevant data for this interface is displayed, regardless of whether the interface is started or not. So, if you want to know the hardware Address of a network card, directly enter the "ifconfig" Network Interface Code "". As for the data appearing in the above code (the data is arranged from top to bottom, left and right).
eth0: The name of the network card, also has lo this loopback.
? HWADDR: The hardware address of the network card, used to be called Mac.
inet Addr:ipv4 IP address, followed by bcase, mask respectively represents broadcast and netmask.
? Inet6 Addr: Is the IPV6 version of the IP that we did not use, so skip over.
? RX: That line represents the data packet received by the network so far, packets represents the number of packets, errors represents the number of errors in the packet, and dropped represents the number of packets discarded due to a problem.
? TX: And Rx In contrast, for the network by booting up so far the transmission situation.
collisions: Represents a packet collision situation, if it happens too many times, indicates that your network condition is not very good.
Txqueuelen: Represents the storage length of the buffer used to transmit data.
? RX Bytes, TX Bytes: Total transmit, Bytes received.
? Interrupt, Memory: Data of the network card hardware, IRQ fork break, and RAM address.
by observing the above information, we can generally understand your network situation, especially the number of error in Rx, TX, and whether there is serious collision situation, it is necessary to pay attention to.
Example Two: Temporarily modify the network interface
[email protected] ~]# ifconfig eth0 192.168.100.100
# If all other parameters are not added, the system will be in accordance with the class range where the IP is located,
# automatically calculates netmask and network, broadcast and other IP parameters
[email protected] ~]# ifconfig eth0 192.168.100.100 netmask 255.255.255.128\
> MTU 8000
# Set the network interface while setting the value of the MTU
[email protected] ~]# ifconfig eth0 MTU 9000
# only the MTU value of the interface is modified and the others remain fixed
[email protected] ~]# ifconfig eth0:0 192.168.50.50
# Look closely at that interface, eth0:0. That is, on the network interface, and then simulate a network interface,
# That means to set multiple IPs on a network card.
[email protected] ~]# ifconfig
eth0 Link encap:ethernet HWaddr 00:0f:ea:a3:06:a2
inet addr:192.168.10.100 bcast:192.168.10.255 mask:255.255.255.0
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:3669 errors:0 dropped:0 overruns:0 frame:0
TX packets:2892 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:667547 (651.9 KiB) TX bytes:584799 (571.0 KiB)
interrupt:209 memory:fb000000-0
eth0:0 Link encap:ethernet HWaddr 00:0f:ea:a3:06:a2
inet addr:192.168.200.2 bcast:192.168.200.255 mask:255.255.255.0
Up broadcast RUNNING multicast mtu:1500 metric:1
interrupt:209 memory:fb000000-0
# Look closely, whether the hardware-related information is the same. That's right. Because it is the same NIC.
[email protected] ~]# ifconfig eth0:0 down
# Turn off eth0:0 This interface. If you want to start eth1 and do not set all network parameters
# ifconfig eth1 up can be achieved
[email protected] ~]#/etc/init.d/network restart
# The data you just set is all dead and will be based on IFCFG-ETHX settings
using Ifconfig can be used to temporarily set up or modify the relevant functions of an adapter card, and also through the eth0:0 of this virtual network interface to set up a network card above the multiple IP. The manual approach is relatively straightforward. And the setup error is not related, because we can use the/etc/init.d/network restart to restart the entire network interface, the previous manual setup data will all be invalidated. In addition, to start a network interface, but do not let him have IP parameters, directly to his ifconfig eth0 up. This operation is often done in the wireless card, because we need to activate the wireless card to let him detect the presence of APS and No.