Linux to solve the problem changes after the restart ip

Enter the command in Linux, edit the network configuration file

vim /etc/sysconfig/network-scripts/ifcfg-ens33

The following modifications in the configuration

BOOTPORTO = dhcp 

originally automatically obtain ip, now into a fixed ip, instead

BOOTPORTO = static
ONBOOT = yes after this card is automatically enabled, if yes, indicate modify the configuration

And add the following configuration

If you are 192.168.xx network segment , we add these lines to configure, such as where I fixed ip 192.168.1.6

IPADDR=192.168.1.6

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

If you are 10.xxx network segment, add these lines to configure, such as where I fixed ip 10.0.0.6

 

IPADDR=10.0.0.6

NETMASK=255.255.255.0

GATEWAY=10.0.0.1

Then restart your network configuration service network restart

After viewing the ifconfig

Here ip is 192.168.1.6 the

Then ping www.baidu.com, you can ping through

After rebooting Linux ip will not change the

 

Guess you like

Origin www.cnblogs.com/banbosuiyue/p/12614573.html