CentOS7.4 network.service NetworkManager.service 冲突

最近在玩dpdk kni,往kni虚拟口上使用ifconfig配置ip地址,发现配置的ip会无缘无故消失,以为是kni的bug,后面经同事指点,说有可能是networkmanager导致的,故查看了一下syslog日志:

tailf /var/log/message
Nov 29 16:02:55 localhost NetworkManager[843]: <warn>  [1575014575.9582] dhcp4 (veth0): request timed out
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9582] dhcp4 (veth0): state changed unknown -> timeout
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9661] dhcp4 (veth0): canceled DHCP transaction, DHCP client pid 7268
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9661] dhcp4 (veth0): state changed timeout -> done
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9663] device (veth0): state change: ip-config -> failed (reason 'ip-config-unavailable') [70 120 5]
Nov 29 16:02:55 localhost NetworkManager[843]: <warn>  [1575014575.9666] device (veth0): Activation: failed for connection '有线连接 1'
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9668] device (veth0): state change: failed -> disconnected (reason 'none') [120 30 0]
Nov 29 16:02:55 localhost avahi-daemon[837]: Withdrawing address record for fe80::e4f6:11b0:eb3b:c94b on veth0.
Nov 29 16:02:55 localhost avahi-daemon[837]: Withdrawing address record for 172.28.106.10 on veth0.
Nov 29 16:02:55 localhost avahi-daemon[837]: Leaving mDNS multicast group on interface veth0.IPv4 with address 172.28.106.10.
Nov 29 16:02:55 localhost avahi-daemon[837]: Interface veth0.IPv4 no longer relevant for mDNS.
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9709] policy: auto-activating connection '有线连接 1'
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9716] device (veth0): Activation: starting connection '有线连接 1' (355aaef2-573d-39d3-b197-3c711d960b9d)
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9735] device (veth0): state change: disconnected -> prepare (reason 'none') [30 40 0]
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9739] device (veth0): state change: prepare -> config (reason 'none') [40 50 0]
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9740] device (veth0): driver 'unknown' does not support carrier detection.
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9743] device (veth0): state change: config -> ip-config (reason 'none') [50 70 0]
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9744] dhcp4 (veth0): activation: beginning transaction (timeout in 45 seconds)
Nov 29 16:02:55 localhost NetworkManager[843]: <info>  [1575014575.9758] dhcp4 (veth0): dhclient started with pid 7319
Nov 29 16:02:55 localhost dhclient[7319]: DHCPDISCOVER on veth0 to 255.255.255.255 port 67 interval 4 (xid=0x216e37f9)
Nov 29 16:02:57 localhost avahi-daemon[837]: Registering new address record for fe80::e4f6:11b0:eb3b:c94b on veth0.*.
Nov 29 16:02:59 localhost dhclient[7319]: DHCPDISCOVER on veth0 to 255.255.255.255 port 67 interval 8 (xid=0x216e37f9)

这里面会对kni虚拟接口进行操作,会使用dhcp获取IP地址,罪魁祸首原来是NetworkManager,那就把NetworkManager给关闭。使用如下命令进行关闭:

systemctl stop NetworkManager
systemctl disable NetworkManager
systemctl start network

重启设备后,发现ifconfig看不到网卡相关信息,这要修改网卡配置,具体目录为:/etc/sysconfig/network-scripts/,修改示例如下所示:

TYPE=Ethernet
BOOTPROTO=none
DEVICE=eth0
ONBOOT=yes  # 需要设置为开机启动
#DNS2=114.114.114.114
#DNS1=127.0.0.1
IPADDR=10.0.0.57
PREFIX=24
GATEWAY=10.0.0.1
NM_CONTROLLED=no  # add this line,关键

修改完相关网卡的配置,保存,重启后就可以了。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值