AnolisOS dragon lizard network card configuration

1. Enable the network card
If the network is not configured during installation, you need to log in to the system and configure the network card separately (of course, the system must first have a network card)

# Execute the following code


You can see that the system has a network card named ens18 , use vi to edit the configuration file of ifcfg-ens18

vi ifcfg-ens18
 set ONBOOT=on , BOOTPROTO=DHCP to restart the system, the network card will start together with the system;

TYPE=Ethernet #Network card type
PROXY_METHOD=none  
BROWSER_ONLY=no
BOOTPROTO=dhcp #Set dhcp method to obtain IP address or set static to set static IP address
DEFROUTE=yes #When there are multiple network cards, use this option to set the default routing network card IPV4_FAILURE_FATAL=
no
IPV6INIT=yes #IPV6 related settings IPV6_AUTOCONF
=yes IPV6_DEFROUTE
=yes
IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE
=stable-privacy
NAME=ens18 #Network card name
UUID=eaf57a83-dd7f-4f5e-9500-5bf7ef3e41v
DEVICE=ens18 
ONBOOT=on #After the system starts, follow the system to start

 Use the ip a command to view network card information

 

2. Set a static IP address
In daily use, we need to set the IP address of the server to be static for easy use. Modify ifcfg-ens18 as follows:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static #设置静态
IPADDR=192.168.66.79 #设置自己的IP
NETMASK=255.255.255.0 #设置子网掩码
GATEWAY=192.168.66.1  #设置网关
DNS1=223.5.5.5  #设置DNS
DNS2=223.6.6.6
 
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=ens18
UUID=eaf57a83-dd7f-4f5e-9500-5bf7ef3e412c
DEVICE=ens18
ONBOOT=on

 After saving and restarting, check the network information with ip a

 

Use cat /etc/resolv.conf to view DNS configuration

 

3. Check the network
Use PING to check whether the previous network is valid

ping 223.5.5.5 -c 10 # ping Alibaba Cloud DNS 10 times


 If the PING fails, you need to check the internal network step by step.

Guess you like

Origin blog.csdn.net/z09364517158/article/details/131454403