Linux ifconfig command usage summary

  

Ifconfig command is mainly used to display configuration network devices in Linux system, and many people are not very familiar with the command, the following system home small series will be for the use of ifconfig command for everyone to do A detailed introduction, let's get to know it.

usually need to log in or use sudo ifconfig tool for use on a Linux machine as root. Depending on the use of some option attributes in the ifconfig command, the ifconfig tool can be used not only to simply get network interface configuration information, but also to modify these configurations.

1. Command format:

ifconfig [network device] [parameters]

2. Command Function:

The ifconfig command is used to view and configure network devices. When the network environment changes, you can use this command to configure the network accordingly.

3. Command parameters:

up Starts the specified network device/network card.

down Turn off the specified network device/network card. This parameter can effectively block the IP information flow through the specified interface. If you want to permanently close an interface, we also need to delete the routing information of the interface from the core routing table.

arp Set whether the specified NIC supports ARP.

-promisc Set whether to support the promiscuous mode of the network card. If this parameter is selected, the network card will receive all the packets sent to it in the network.

-allmulti Set whether to support multicast mode, if you choose With this parameter, the NIC will receive all multicast packets in the network

-a Display all interface information

-s Display summary information (similar to netstat -i)

Add Configure IPv6 address for the specified NIC

del Delete the IPv6 address of the specified NIC

Hardware Address Configuring the largest transmission unit of the NIC

mtu Bytes Setting the NIC Maximum transmission unit (bytes)

netmask "subnet mask" Set the subnet mask of the network card. 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 plan to divide the network into subnets, you can leave this option alone; if you are using subnets, keep in mind that every system in the network must have the same subnet mask.

tunel to establish a tunnel

dstaddr set a remote address to establish peer-to-peer communication

-broadcast "address" Set the broadcast protocol for the specified NIC

- Pointtopoint "Address" Set the peer-to-peer communication protocol for the network card

multicast Set the multicast flag for the network card

address Set the IPv4 address for the network card

txqueuelen "Length" Set the transmission queue for the network card Length

4. Example of use:

Example 1: Display network device information (active state)

Command: ifconfig

Output:

The code is as follows:

[root@localhost ~]# ifconfig

eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:20

inet addr:192.168.120.204 Bcast:192.168. 120.255 Mask:255.255.255.0

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0

TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB) "/p" "p"lo Link encap:Local Loopback

inet addr:127.0.0.1 Mask:255.0.0.0

UP LOOPBACK RUNNING MTU:16436 Metric:1

RX packets:68 errors:0 dropped:0 overruns:0 frame:0

TX packets:68 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen: 0

RX bytes: 2856 (2.7 KiB) TX bytes: 2856 (2.7 KiB)

Description:

eth0 represents the first network card, where HWaddr represents the physical address of the network card, you can see the current The physical address (MAC address) of this network card is 00:50:56:BF:26:20

inet addr is used to indicate the IP address of the network card. The IP address of this network card is 192.168.120.204, broadcast address. Bcast: 192.168.120.255, mask address Mask: 255.255.255.0

lo is the return address of the host. This is generally used to test a network program, but does not want users on the LAN or external network to View, you can only run and view the network interface used on this host. For example, if you specify the HTTPD server to return to a bad address, you can see your WEB website by typing 127.0.0.1 in the browser. But you can only see it, other hosts or users of the LAN do not know.

First line: Connection type: Ethernet HWaddr (hardware mac address)

Second line: IP address, subnet, and mask of the network card

The third line: UP (represents the NIC open state) RUNNING (representing the network cable of the NIC is connected) MULTICAST (supports multicast) MTU: 1500 (maximum transmission unit): 1500 bytes

The fourth and fifth lines: Receive and send data packet statistics

The seventh line: Receive and send data byte count statistics.
Previous123Next page Total 3 pages

Copyright © Windows knowledge All Rights Reserved