How to solve the problem that ip configuration does not take effect in centos

WJ
Release: 2020-06-05 16:00:34
Original
8640 people have browsed it

How to solve the problem that ip configuration does not take effect in centos

How to solve the problem that the ip configuration in centos does not take effect?

1. Check the configuration file in the /etc//etc/sysconfig/network-scripts directory

1. I saw a strange configuration fileifcfg-Wired_connection_1, Du Niang checked that this configuration file is the network card configuration file called by the system startup and is related to the NetworkManager service.

2. On the CentOS system, there are currently two network management tools: NetworkManager and network. Conflicts will occur if both are configured, and NetworkManager will clear the routes when the network is disconnected. If some customized routes are not added to the NetworkManager configuration file, the routes will be cleared and need to be customized after the network is connected. Add it.

2. Solution

1. Stop the NetworkManager service

systemctl stop NetworkManager.service
Copy after login

2. Set it not to start automatically at boot

systemctl disable NetworkManager.service
Copy after login
----------------------输出信息---------------------------
Removed /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.
Copy after login

3 , systemctl is-enabled NetworkManager #Check whether it is disabled

4. Set the network service to start automatically at boot

systemctl enable network.service
Copy after login

------------- ----------Output information---------------------------

network.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig network on
Copy after login

5. Approximate output This means that you need to execute **/sbin/chkconfig network on**

6. After the above execution is completed, configure your physical network card information

vim /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none  #静态地址
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eth0
DEVICE=eth0
ONBOOT=yes  #启用网卡
IPADDR=x.x.x.x  #IP地址   
NETMASK=255.255.255.0  #子网掩码
GATEWAY=x.x.x.x  #网关
Copy after login

7. The configuration is completed Then restart the server

Related reference:centOS tutorial

The above is the detailed content of How to solve the problem that ip configuration does not take effect in centos. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template