1. Command format:
ifconfig [Network Devices] [parameters]
2. Command function:
The Ifconfig command is used to view and configure network devices. This command can be used to configure the network appropriately when the network environment changes.
3. Command parameters:
Up starts the specified network device/NIC.
Down to turn off the specified network device/NIC. This parameter can effectively block the IP traffic through the specified interface, and if you want to permanently shut down an interface, we also need to remove all the routing information from the core routing table from that interface.
The ARP setting specifies whether the NIC supports the ARP protocol.
-promisc sets whether the promiscuous mode of the NIC is supported, and if this parameter is selected, the NIC will receive all packets sent to it in the network
-allmulti Settings Support multicast mode, if you select this parameter, the NIC will receive all multicast packets in the network
-A displays all interface information
-S Display summary information (similar to netstat-i)
Add to configure the IPV6 address for the specified NIC
Del deletes the IPV6 address of the specified network card
< hardware address > Configure the Maximum transmission unit of the NIC
mtu< bytes > Set the Maximum Transmission Unit (bytes) of the NIC
netmask< Subnet mask > Set subnet mask for network card. The mask can be a 32-bit hexadecimal number with a prefix of 0x, or 4 decimal digits separated by dots. If you do not plan to divide the network into subnets, you can ignore this option, and if you want to use subnets, remember that each system in the network must have the same subnet mask.
Tunel establishing a tunnel
DSTADDR set a remote address to establish point-to-point communication
-broadcast< address > Set up a broadcast protocol for a specified network card
-pointtopoint< address > Set up Point-to-point communication protocol for network card
Multicast setting the multicast flag for the network card
Address sets IPV4 addresses for network cards
txqueuelen< length > Set the length of the transmission queue for the network card
Example 1: Displaying network device information (active state)
Command:
Ifconfig
Example 2: Start and close the specified NIC
Ifconfig eth0 up to start the NIC Eth0;
Ifconfig eth0 down to turn off the NIC Eth0.
SSH login Linux Server operation be careful, shut down can not be turned on, unless you have multiple network cards.
Example 3: Configuring and removing IPV6 addresses for network cards
Ifconfig eth0 Add 33FFE:3240:800:1005::2/64
Ifconfig eth0 del 33ffe:3240:800:1005::2/64
Example 4: Modifying MAC addresses with Ifconfig
ifconfig eth0 hw ether 00:aa:bb:cc:dd:ee
Example 5: Configuring IP Addresses
Ifconfig eth0 192.168.120.56 Configure IP to eth0 NIC : 192.168.120.56
Ifconfig eth0 192.168.120.56 netmask 255.255.255.0 Configure IP address for eth0 NIC: 192.168.120. 56, plus the child mask: 255.255.255.0
Ifconfig eth0 192.168.120.56 netmask 255.255.255.0 broadcast 192.168.120.255/to ETH0 network adapter Configure IP address: 192.168.120.56, plus child mask: 255. 255.255.0, add a broadcast address: 192.168.120.255
Example 6: Enabling and shutting down the ARP protocol
Command:
Ifconfig eth0 ARP to open the network card eth0 ARP protocol;
Ifconfig Eth0-arp shut down the network card eth0 ARP protocol;
Example 7: Setting the Maximum transmission unit
Command:
Ifconfig eth0 MTU 1500 setting can pass the maximum packet size of bytes
Note: The NIC information configured with the Ifconfig command does not exist after the machine restarts after the network card restarts. In order to keep the above configuration information in the computer forever, it is necessary to modify the network card configuration file.
The Linux ifconfig command