Article title: Nic network configuration basics. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
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 10 Mbps Ethernet HWaddr 00: 00: C0: 90: B3: 44
Inet addr xxx. xxx Bcast xxx. xxx. xxx.255 Mask limit 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. The RX (number of receiving groups) and TX (number of transfer groups) rows show the number of receive and transfer groups, as well as the number of group errors, the number of lost groups (one possible cause is a small amount of memory) and the number of overrun (usually occurs when the receiver receives data faster than the core processing speed ).
Parameters indicates various Parameters supported by ifconfig. using these Parameters, you can conveniently monitor and change the status of network interfaces.
Command line parameters of ifconfig:
Up to activate the specified interface
Down to close the specified interface. This parameter can effectively block the IP information of a specified interface.
Stream. if you want to permanently close an interface, you also need
Delete all route information of this interface
Netmask mask sets the IP address mask for the interface. The mask can be a 32-bit hexadecimal system with a prefix of 0x.
It can also be four decimal numbers separated by vertices. If you do not plan to divide the network
Subnet, regardless of this option. if you want to use a subnet, remember that the network
Each system must have the same subnet mask.
Pointpoint enables the point-to-point mode of the specified interface. It tells the core that this interface is for another server
Is directly connected. When an address is included, the address is assigned to another
Machines at one end. If no address is provided, open
POINTPOINT option. Add a negative sign to disable the pointpoint option.
Broadcast address when an address is used, set the broadcast address of this interface. If
If no address is provided, enable the IFF_BROADCAST option of the specified interface.
Add a negative sign to disable this option.
Metric number sets the interface metric value to an integer number. The measurement value indicates that
The cost of sending a group. At present, there is no routing cost in the kernel, but it will be in the future.
Mtu bytes sets 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, MTU (maximum data
Transmission Unit) value is set to large enough
Arp enables or disables the ARP protocol used on the specified interface. Add a negative sign before
Disable this option.
Allmuti enables the normal mode of the specified interface. Enable this mode to enable the interface
All information flows are sent to the core, not just to the information of your machine.
Core. Add a negative sign to disable this option.
Hw sets the hardware address for the specified interface. Hardware Type and sub-hardware address are equivalent
ASCII characters must be followed by this keyword. Currently, Ethernet is supported.
(Ether), AMPR, AX.25, and PPP
Traliers enables the tracker on the Ethernet frame. Not yet implemented in LINUX
Generally, you do not need to use all these configurations. Ifconfig can only set everything required 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.
Use netstat to check network status
The following section describes a very useful command, netstat. you can use the netstat command to monitor TCP/IP network configurations and working conditions. It can display the kernel route table,
Active Network status and useful statistics for each network interface. For more information, see man page.
-A: displays information about all Internet connections, including those being monitored.
-I: displays the statistics of all network devices.
-C constantly displays the network update status. This parameter uses netstat to output the network status once per second.
List until the program is interrupted
-N: the remote address, local address, and port information is displayed in the numeric/original format, instead of the host name.
And server
-O: Display the end time of the counter and the back off status of each network connection.
-R: displays the kernel route table.
-T: only TCP socket information is displayed, including information being monitored.
-U only displays UDP socket information
-V: Display netstat version information
-W: raw socket information
-X: Display socket information of UNIX domain
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service