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

我总是使用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

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

相关文章

Linux中的ARP防火墙主要用于防御ARP欺骗攻击,其效果取决于多...
insmod和modprobe加-f参数导致Invalid module format错误 这...
将ArchLinux安装到U盘 几个月前入门Arch的时候上网搜了不少安...
1、安装Apache。 1)执行如下命令,安装Apache服务及其扩展包...
一、先说一下用ansible批量采集机器信息的实现办法: 1、先把...
安装配置 1. 安装vsftpd 检查是否安装了vsftpd # rpm -qa | ...