linux 网络配置 nm_controlled,LINUX centos7.6修改静态IP与配置参数NM_CONTROLLED

目前,各种OS操作系统版本疯狂升级,并且随之而变的操作系统设置也有很大的改变。对于CENTOS目前最新版本已经

是8.x,但是,centos 7.6相对与以前的老版本,操作系统相关的部分配置已经有比较大的变化,举例:静态IP与配置参数

NM_CONTROLLED,当网络配置文件中没有改参数时,即便其IP配置使用静态IP,也不起作用。

--ifcfg-ens34的配置

[root@centos76mysqlpri network-scripts]# cat ifcfg-ens34

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=static #此处已经声明使用静态IP

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=ens34

UUID=af87d788-f524-4095-81c9-367eba488f9a

DEVICE=ens34

ONBOOT=yes

IPADDR=192.168.192.201

PREFIX=24

GATEWAY=192.168.192.1

IPV6_PRIVACY=no

[root@centos76mysqlpri network-scripts]#

--ifcfg-ens34启动后的IP地址缺不是期望中的    ​

[root@centos76mysqlpri network-scripts]# ifup ens34

[root@centos76mysqlpri network-scripts]# ifconfig -a

ens33: flags=4163mtu 1500

inet 192.168.248.129  netmask 255.255.255.0  broadcast 192.168.248.255

inet6 fe80::7391:3e5e:cead:f642  prefixlen 64  scopeid 0x20

ether 00:0c:29:26:76:0c  txqueuelen 1000  (Ethernet)

RX packets 13523  bytes 17404331 (16.5 MiB)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 5554  bytes 343077 (335.0 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens34: flags=4163mtu 1500

inet 192.168.192.128 netmask 255.255.255.0  broadcast 192.168.192.255

inet6 fe80::2162:583:8ee:d0be  prefixlen 64  scopeid 0x20

ether 00:0c:29:26:76:16  txqueuelen 1000  (Ethernet)

RX packets 63  bytes 7008 (6.8 KiB)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 138  bytes 20565 (20.0 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73mtu 65536

inet 127.0.0.1  netmask 255.0.0.0

inet6 ::1  prefixlen 128  scopeid 0x10

loop  txqueuelen 1000  (Local Loopback)

RX packets 224  bytes 18384 (17.9 KiB)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 224  bytes 18384 (17.9 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099mtu 1500

inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255

ether 52:54:00:2f:86:09  txqueuelen 1000  (Ethernet)

RX packets 0  bytes 0 (0.0 B)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 0  bytes 0 (0.0 B)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0-nic: flags=4098mtu 1500

ether 52:54:00:2f:86:09  txqueuelen 1000  (Ethernet)

RX packets 0  bytes 0 (0.0 B)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 0  bytes 0 (0.0 B)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@centos76mysqlpri network-scripts]#

到此,感觉有点莫名其妙!经查询是:centos7.6使用NM_CONTROLLED参数控制是否通过网络管理器进行管理。

--修改ifcfg-ens34的配置

[root@centos76mysqlpri network-scripts]# cat ifcfg-ens34

TYPE=Ethernet

PROXY_METHOD=none

BROWSER_ONLY=no

BOOTPROTO=static

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=ens34

UUID=af87d788-f524-4095-81c9-367eba488f9a

DEVICE=ens34

ONBOOT=yes

NM_CONTROLLED=no

IPADDR=192.168.192.201

PREFIX=24

GATEWAY=192.168.192.1

IPV6_PRIVACY=no

[root@centos76mysqlpri network-scripts]#

--ifcfg-ens34网卡重启后

[root@centos76mysqlpri network-scripts]# ifup ens34

[root@centos76mysqlpri network-scripts]# ifconfig -a

ens33: flags=4163mtu 1500

inet 192.168.248.129  netmask 255.255.255.0  broadcast 192.168.248.255

inet6 fe80::7391:3e5e:cead:f642  prefixlen 64  scopeid 0x20

ether 00:0c:29:26:76:0c  txqueuelen 1000  (Ethernet)

RX packets 13523  bytes 17404331 (16.5 MiB)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 5554  bytes 343077 (335.0 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens34: flags=4163mtu 1500

inet192.168.192.201 netmask 255.255.255.0  broadcast 192.168.192.255

inet6 fe80::20c:29ff:fe26:7616  prefixlen 64  scopeid 0x20

ether 00:0c:29:26:76:16  txqueuelen 1000  (Ethernet)

RX packets 81  bytes 8664 (8.4 KiB)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 167  bytes 24573 (23.9 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73mtu 65536

inet 127.0.0.1  netmask 255.0.0.0

inet6 ::1  prefixlen 128  scopeid 0x10

loop  txqueuelen 1000  (Local Loopback)

RX packets 224  bytes 18384 (17.9 KiB)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 224  bytes 18384 (17.9 KiB)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099mtu 1500

inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255

ether 52:54:00:2f:86:09  txqueuelen 1000  (Ethernet)

RX packets 0  bytes 0 (0.0 B)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 0  bytes 0 (0.0 B)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0-nic: flags=4098mtu 1500

ether 52:54:00:2f:86:09  txqueuelen 1000  (Ethernet)

RX packets 0  bytes 0 (0.0 B)

RX errors 0  dropped 0  overruns 0  frame 0

TX packets 0  bytes 0 (0.0 B)

TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@centos76mysqlpri network-scripts]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值