27.2 "Linux learning is not difficult" Linux Network Command (2): Ifconfig command to display and configure the network interface
Use the Ifconfig command to display and configure network interfaces, such as setting an IP address, MAC address, activating or shutting down a network interface.
Command syntax:
Ifconfig [interface] [Options | IP Address]
The meanings of the options in the command are as shown in the table.
Options |
option meaning |
-A |
Show status of all network interfaces |
Netmask < Subnet mask > |
set the subnet mask for a network device |
Up |
activates the specified network device |
down |
Close the specified network device |
HW < type > < hardware address > |
set the hardware address of this interface ( MAC address). Currently supported hardware types include ether(Ethernet),ax25 ( ampr ax.25),ARCnet, and netrom (ampr net/rom) |
Example: Configure the IP address of the NIC eno16777736 and activate the device at the same time.
[Email protected] ~]# ifconfig eno16777736 192.168.0.2 netmask 255.255.255.0 up
Example: Configure the IP address of the alias device eno16777736:1 for the NIC eno16777736.
[Email protected] ~]# ifconfig eno16777736:1 192.168.0.3
Example: Activating the NIC eno16777736:1 device.
[Email protected] ~]# ifconfig eno16777736:1 up
Example: Check the configuration of the NIC eno16777736 device.
[Email protected] ~]# ifconfig eno16777736
Example: View all the network card devices.
[Email protected] ~]# ifconfig-a
Example: Turn off the NIC Eno16777736:1 device.
[Email protected] ~]# ifconfig eno16777736:1 down
This article extracts from "Linux Learning is not difficult" textbook, which is one of the most practical, theoretical and practical Linux Introductory materials. To read the entire book, visit the Linux ops (www.linuxywz.com) website .
Linux learning is not difficult "Linux Network Command (2): ifconfig command display and configure network interfaces