Details of centos network card configuration

1. Network card file location

centos network card configuration file is generally located in / etc / sysconfig / network scripts/

The file name is generally ifcfg eno or ifcfg eth0. You can use the ip addr command or ifconfig command to view the network card information first

If a new machine does not have a configuration file, it will also have an ifcfg Lo loopback network card. You can copy one and edit it with vim (root permission)

Generally speaking, items that need to be modified by yourself

BOOTPROTO=static        #Static static, dhcp dynamic get, none unspecified (possible problems)

ONBOOT=yes              #Note that this is boot up and needs to be set to yes

DNS1=8.8.8.8            #IP address of DNS domain name resolution server

IPADDR=192.168.1.2      #IP address of network card

GATEWAY=192.168.1.1     #default gateway

NETMASK=255.255.255.0   #Subnet mask

Can be copied directly without notes

BOOTPROTO=dhcp
ONBOOT=yes             
DNS1=114.114.114.114           
IPADDR=192.168.1.2      
GATEWAY=192.168.1.1     
NETMASK=255.255.255.0   

Profile resolution:

DEVICE=ens33                         # Device name of network card
NAME=ens33                           # Alias of network card device
TYPE=Ethernet                        #Network type: Ethernet
BOOTPROTO=none                       #Boot protocol: static static, dhcp dynamic get, none not specified (possible problems
DEFROUTE=yes                         #Start default route
IPV4_FAILURE_FATAL=no                #Do not enable IPV4 error detection
IPV6INIT=yes                         #Enable IPV6 protocol
IPV6_AUTOCONF=yes                    #Automatically configure IPV6 address
IPV6_DEFROUTE=yes                    #Enable IPV6 default routing
IPV6_FAILURE_FATAL=no                #Do not enable IPV6 error detection
UUID=sjdfga-asfd-asdf-asdf-f82b      #UUID unique identification number of network card device
ONBOOT=yes                           #Start up the network card automatically
DNS=114.114.114.114                  #The IP address of DNS domain name resolution server can be set with one more DNS1
IPADDR=192.168.1.22                  #IP address of network card
PREFIX=24                            #Subnet prefix length
GATEWAY=192.168.1.1                  #Default gateway IP address
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPADDR=192.168.1.22                  #The fixed IP you want to set, in theory, can be set between 192.168.2.2-255, please verify by yourself; if it is dhcp, you can leave it blank
NETMASK=255.255.255.0                #Subnet mask, no need to modify;

The configuration of my virtual machine is attached for you to copy:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
DEVICE=ens33
ONBOOT=yes
IPADDR=192.168.1.22
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS=114.114.114.114

uuid, I deleted everyone's difference

Tags: Linux network DNS CentOS vim

Posted on Sun, 22 Mar 2020 10:46:05 -0400 by Topper