Centos7 network configuration comparison with previous versions
Because the network configuration of Centos7 is significantly different from that of previous versions, we will discuss it separately.
Centos 7 has the automatic detection function for Nic devices:
(1) Nic naming mechanism
Systemd naming for network devices:
(A) if the index information provided by the Firmware or BIOS integration device on the master board is available and predictable, name the index, for example, eno1;
(B) if the index information provided by Firmware or BIOS for the PCI-E expansion slot is available and predictable, name the index, such as ens1;
(C) if the physical location information of the hardware interface is available, name it, for example, enp2s0;
(D) If you start the service explicitly, you can also name it based on the MAC address, enx2387a1dc56;
(E) If none of the above are available, the traditional naming mechanism is used;
Some of the above naming mechanisms require the participation of the biosdevname program;
(2) name composition format
En: ethernet
Wl: wlan
Ww: wwan wireless WAN
Name type:
O <index>: The device index Number of the Integrated Device;
S <slot>: Index Number of the expansion slot;
X <MAC>: MAC address-based naming;
P <bus> s <slot>: enp2s1
Nic device naming process:
Step 1:
Udev, auxiliary tool/lib/udev/rename_device,/usr/lib/udev/rules. d/60-net.rules
Read configuration files
Step 2:
Biosdevname will be based on/usr/lib/udev/rules. d/71-biosdevname.rules
Step 3:
Check the network interface device according to/usr/lib/udev/rules. d/75-net-description
ID_NET_NAME_ONBOARD, ID_NET_NAME_SLOT, ID_NET_NAME_PATH
Return to the traditional naming method:
(1) edit the/etc/default/grub configuration file
GRUB_CMDLINE_LINUX = "net. ifnames = 0 rhgb quiet"
(2) generate its configuration file for grub2
Grub2-mkconfig-o/etc/grub2.cfg
(3) restart the system
Address Configuration tool: nmcli:
Display Network Information: nmcli device show [dev eth0]
Nmcli con {show | up | down | add | modify | edit | delete | reload | load}
How to modify attributes such as IP addresses:
# Nmcli connection modify interface name [+ |-] setting. property value
Setting. property:
Ipv4.addresses
Ipv4.gateway
Ipv4.dns1
Ipv4.method
Manual
Network Interface Configuration tui tool: nmtui
Host Name Configuration tool: hostnamectl
Status
Set-hostname