Centos7 network configuration details

  • 2020-06-19 12:11:37
  • OfStack

Centos7 network configuration details

1. View the current network card information


[root@localhost ~]# nmcli connection show
NAME UUID         TYPE   DEVICE
enp0s3 5d58d8cc-8caf-458b-a672-ed0cdf58292e 802-3-ethernet ---

In CentOS7, the naming rules on the Internet have been changed. The specific rules are as follows:


eno1  : Represents by the main board  BIOS  Built network card 
ens1  : Represents by the main board  BIOS  � built  PCI-E  Interface network card 
enp2s0  Representative:  PCI-E  The interface of a separate network card, there may be more than one network card interface, so there will be  s0, s1...  The number of 
eth0  : If the above name does not apply, go back to the original default network card number 

Since the network card is not enabled and no configuration file has been created, the DEVICE field shows "-".

2. Manually configure the network card using nmcli command

Network information to be configured:


IP Address: 192.168.1.98
 The gateway : 192.168.1.98

DNS:202.96.69.38

Command:


[root@localhost ~]# nmcli connection modify eno1 \
> connection.autoconnect yes \
> ipv4.method manual \
> ipv4.address 192.168.1.98\
> ipv4.gateway 192.168.1.1 \

> ipv4.dns 202.96.64.68 

autoconnect is set to boot automatically connected

ipv4.method is set manually to configure IPV4 address

Restart network service


[root@localhost ~]# systemctl restart network

3. View the configured network card configuration information


[root@localhost ~]# nmcli connection show eno1

The above is the detailed explanation of the network configuration of centos 7. If you have any questions, please leave a message or discuss and exchange in the community of this site. Thank you for reading.


Related articles: