加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – 使用“ip”命令在CentOS / RHEL 6中重新启动时保留IP地

发布时间:2020-12-13 18:17:42 所属栏目:Linux 来源:网络整理
导读:我总是使用ifcfg-eth0:1别名文件来创建其他地址.但是,在 recent rhel documentation,它指出: As the ip command of the iproute package now supports assigning multiple address to the same interface it is no longer necessary to use this method of
我总是使用ifcfg-eth0:1别名文件来创建其他地址.但是,在 recent rhel documentation,它指出:

As the ip command of the iproute package now supports assigning multiple address to the same interface it is no longer necessary to use this method of binding multiple addresses to the same interface.

此外,本网站上的许多答案和评论都提到ifconfig已被弃用,而且应该使用“ip”.我很好地使用它进行实时更改,但是如何在不使用别名文件的情况下在重新启动后保留更改?

解决方法

将它们放在/ etc / sysconfig / network-scripts / ifcfg-eth0中,后跟2或3等,例如:
IPADDR2=192.0.2.48
NETMASK2=255.255.255.0
IPADDR3=192.0.2.49
NETMASK3=255.255.255.0

不幸的是,这似乎没有文档记录(或者我现在无法找到它;看起来红帽再次重新安排了他们的网站).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读