码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS 6 单网卡绑定双IP

时间:2020-04-27 15:37:25      阅读:59      评论:0      收藏:0      [点我收藏+]

标签:ipv4   route   sysconf   add   art   fat   size   生效   gateway   

 CentOS 6 单网卡绑定双IP

OS:CnetOS 6.8

初始网卡配置文件
    
[root@localhost /]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
    
DEVICE=eth0
TYPE=Ethernet
UUID=d3fde489-9b67-453c-84df-4827f3becf1a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.110
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:0C:29:F6:F8:A8
LAST_CONNECT=1489157101

方法一:在原网卡配置文件直接增加新IP
    
[root@localhost /]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
    
DEVICE=eth0
TYPE=Ethernet
UUID=d3fde489-9b67-453c-84df-4827f3becf1a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.110
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no

NAME="System eth0"
IPADDR2=192.168.1.111
PREFIX2=24
HWADDR=00:0C:29:F6:F8:A8
LAST_CONNECT=1489129249

方法二:新增网卡配置文件:
    
[root@localhost /]# cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0:0
[root@localhost /]# vim /etc/sysconfig/network-scripts/ifcfg-eth0:0
    
DEVICE=eth0:0
TYPE=Ethernet
UUID=d3fde489-9b67-453c-84df-4827f3becf1a
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.111
PREFIX=24
GATEWAY=192.168.1.1
DNS1=114.114.114.114
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:0C:29:F6:F8:A8
LAST_CONNECT=1489130355

修改网卡配置文件后,需要重启网络服务才会生效:
    
[root@localhost /]# service network restart

CentOS 6 单网卡绑定双IP

标签:ipv4   route   sysconf   add   art   fat   size   生效   gateway   

原文地址:https://www.cnblogs.com/walkersss/p/12786598.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!