首页 > 其他 > 详细

配置IP别名

时间:2017-05-02 15:54:26      阅读:141      评论:0      收藏:0      [点我收藏+]

配置IP别名

即为一个网卡设置多个IP地址

  1. 临时(即重启后失效)

    ifconfig eth0:1 192.168.1.110/24 up
    ifconfig eth0:2 192.168.1.111/24 up
    ifconfig eth0:3 192.168.1.112/24 up

    删除别名

    ifconfig eth0:1 down
    ifconfig eth0:2 down
    ifconfig eth0:3 down
  2. 永久(写入配置文件里)

手动将上述临时命令写入到`/etc/rc.local` 文件中(有时会失效,不推荐)

新建一个编写网卡配置文件

# cd /etc/sysconfig/network-scripts/
# cp ifcfg-eth0 ifcfg-eth0:0
# cat ifcfg-eth0:0
  DEVICE=eth0:0     #网卡名
  TYPE=Ethernet
  ONBOOT=yes        #开机自启动
  BOOTPROTO=static
  IPADDR=192.168.1.100 #需要配置的IP地址
  GATEWAY=192.168.1.1

2017/5/2 14:53:32


本文出自 “dianel简单不简单” 博客,谢绝转载!

配置IP别名

原文:http://dianel.blog.51cto.com/12170393/1921129

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!