ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

linux – ip-tools vs old ifconfig

2019-08-13 01:53:06  阅读:309  来源: 互联网

标签:linux centos command-line networkmanager network-interface


当我在网络脚本中将dhcp更改为静态然后重新启动servicesystemctl后重新启动NetworkManager.静态IP设置假设要更新,但事实并非如此.所以我试试

ip link设置dev enp0s3向下然后向上

没有更新ip

然后我尝试ifdown enp0s3然后ifup enp0s3

有效

为什么它与ifup一起使用?

解决方法:

序言:ip和ifconfig是用于控制和监控网络的实用程序.它们通常不用于读/写持久性配置文件 – 这就是为什么ip link不起作用的原因.持久配置管理必须通过其他方式完成,例如NetworkManager.

(这可能不用说了,但是,作为旁注,iproute2,提供ip,has been/is being adopted由许多发行版作为网络工具的替代品,提供ifconfig.出于兼容性原因,它们通常作为默认包发布在发行版中) .

为什么ifup工作和systemctl重启NetworkManager没有:

在CentOS上(我已经检查过CentOS 7),ifup和ifdown是由initscripts提供的;它们对/ etc / sysconfig / network-scripts /中的脚本进行操作,由同一个包提供.因此,ifup能够应用您在那里所做的更改并不奇怪.

NetworkManager – CentOS从上游继承的默认网络服务提供商 – 在Red Hat和Fedora上配置为使用the ifcfg-rh plugin从/ etc / sysconfig / network-scripts / ifcfg- *读取/写入网络配置.但它不会监视这些文件.

man nm-settings-ifcfg-rh警告说

Users can create or modify the ifcfg-rh connection files manually, even if that is not the recommended way of managing the profiles. However, if they choose to do that, they must inform NetworkManager about their changes (see monitor-connection-file in nm-settings(5), and nmcli con (re)load).

因此,systemctl重载NetworkManager不应该从CentOS上的文件重新加载网络连接的配置.为此,您可以调用nmcli连接重新加载或更改NetworkManager配置,如manManagerManager.conf中所述:

monitor-connection-files
Whether the configured settings plugin(s) should set up file monitors and immediately pick up changes made to connection files while NetworkManager is running. This is disabled by default; NetworkManager will only read the connection files at startup, and when explicitly requested via the ReloadConnections D-Bus call. […]

标签:linux,centos,command-line,networkmanager,network-interface
来源: https://codeday.me/bug/20190813/1645844.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有