centos 7 modify ip

nmtui command to bring up the Modify window: nmtui

Restart card: /etc/init.d/network restart

 

Or: service network restart

 

 

 

Second way:

Network Configuration File Directory

First, make sure to operate under the root user. Network configuration file into the network-scripts directory.

cd /etc/sysconfig/network-scripts/

 

We find the need to modify the configuration file

Use the ls command to list files in that directory. Where "ifcfg-ens33" file, as we need to modify the network configuration file.

 

Modify the configuration file

Use the command vim (vi commands can also be), the file configuration,

We need to modify BOOTPROTO = "static" is replaced by the dhcp static, modify ONBOOT = "yes" means that the card is set to turn on, while adding in the text below.

= 192.168.0.230 IPADDR  # static IP

= 192.168.0.1 GATEWAY  # default gateway

= 255.255.255.0 NETMASK  # Subnet Mask

= 192.168.0.1 the DNS1  #DNS configuration

= 8.8.8.8 DNS2  # Google address

 

ESC: + WQ, save and exit!

 

Network Service Restart

Using service network restart command to restart the network services.

Guess you like

Origin www.cnblogs.com/hushuning/p/12195495.html