Network Configuration of ifconfig Nic in Linux (1)
The Ifconfig command allows the LINUX core to know some network interfaces such as software delivery and network card, so that Linux can use them.
In addition to the usage described above, the ifconfig command is used to monitor and change the status of network interfaces. It can also contain many command line parameters. The following is a general syntax for calling ifconfig:
- #ifconfig interface [[-net -host] address [parameters]]
The interface is the network interface Name: address is the host name or IP address assigned to the specified interface. The host names used here are resolved to their peer IP addresses. this parameter is required. The-net and-host parameters respectively tell ifconfig to use this address as the network number or host address.
If the ifconfig command is followed by only the port device name, the configuration of the port is displayed. If no parameter is specified, the ifconfig command displays all information about the interfaces configured so far. If the-a option is included, the current inactive interfaces can also be displayed.
An ifconfig call that checks the Ethernet interface eth0 can get the following output:
- #ifconfig eth0
- eth0 Link encap 10Mbps Ethernet HWaddr 00:00:C0:90:B3:44
- inet addr xxx.xxx.xxx.xxx Bcast xxx.xxx.xxx.255 Mask 255.255.255.0
- UP BROADCAST RUNNING MTU 1500 Metric 0
- RX packets 3136 errors 217 dropped 7 overrun 26
- TX packets 1752 errors 25 dropped 0 overrun 0
Note: XXX. XXX is an IP address)
The MTU and Metric columns show the maximum data transfer value and interface measurement value of the current eth0 interface. The interface metric value indicates the cost of sending a group in this path. Currently, no route is used in the kernel, but it may be used later. RX receiving group count) and TX transmission group count) These two rows show the number of receive and transfer groups, the number of group errors, and the number of lost groups, one possible cause is the small memory) and an exceeded number usually occurs when the receiver receives data faster than the core processing speed ).
ParametersParameters supported by ifconfig. You can use these parameters to conveniently monitor and change the status of network interfaces.
IfconfigCommand line parameters:
UpActivate the specified Interface
DownDisable the specified interface. This parameter can effectively block the IP information stream through the specified interface. If you want to permanently disable an interface, you also need to delete all the routing information of this interface from the Core routing table.
Netmask maskSet the IP Address Mask for the interface. The mask can be a 32-bit hexadecimal number with a prefix of 0x, or four decimal numbers separated by dots. If you do not want to divide the network into subnets, skip this option. If you want to use subnets, remember that each system in the network must have the same subnet mask.
PointpointOpen the point-to-point mode of the specified interface. It tells the core that this interface is a direct connection to another machine. When an address is included, the address is assigned to the machine at the other end of the list. If no address is provided, open the POINTPOINT option of the specified interface. Add a negative sign to disable the pointpoint option.
Broadcast addressWhen an address is used, set the broadcast address of this interface. If no address is provided, enable the IFF_BROADCAST option of the specified interface. Add a negative sign to disable this option.
Metric numberSet the interface measurement value to an integer number. The measurement value indicates the cost of sending a group to this path. At present, there is no routing cost in the kernel, but it will be in the future.
Mtu bytesSet the maximum number of bytes that can be processed by the interface during one transmission to an integer bytes. Currently, the core network code does not process IP segments. Therefore, you must set the maximum MTU data transmission unit value to a large enough value.
ArpEnable or disable the ARP protocol used on the specified interface. Add a negative sign to disable this option.
AllmutiEnable the normal mode of the specified interface. In this mode, the interface sends all the information flows on the network to the core, not just the information of your machine to the core. Add a negative sign to disable this option.
HwSet the hardware address for the specified interface. ASCII characters that match the hardware type and sub-hardware address must be followed by this keyword. Ethernet ether), AMPR, AX.25, and PPP traliers are currently supported to enable the tracker on the Ethernet frame. These configurations are not yet implemented in LINUX networks.
IfconfigYou can set everything you need only by the interface name, network mask, and assigned IP address. When ifconfig misses or has a complex network, you only need to reset most parameters.