Linux - IP configuration modification

1. ip configuration file ifcfg-ensxxx

cd /etc/sysconfig/network-scripts/

There are ifcfg-ensxxx files in the network-scripts/ directory
insert image description here

2. The vi command opens the configuration file
insert image description here
. Modify:

BOOTPROTO="static" # Use a static IP address, the default is dhcp
ONBOOT="yes" # Whether to enable it on boot

Add or modify ip address, subnet mask, gateway, DNS server (optional) according to your needs:

IPADDR=0.0.0.0 # ip address
GATEWAY=0.0.0.0 # gateway
NETMASK=255.255.255.0 # subnet mask
DNS1=0.0.0.0 # DNS server

3. Restart the network or restart the system

重启网络:service network restart
重启系统:reboot

Guess you like

Origin blog.csdn.net/qq_43325582/article/details/127414170