zoukankan      html  css  js  c++  java
  • CentOS单网卡绑定双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
    

    [THE END]

  • 相关阅读:
    Json模块的详细介绍(序列化)
    Selenium 报错:Element is not clickable at point
    对于页面弹出框的处理
    RF操作滚动条(竖拉)
    xpath定位中starts-with、contains和text()的用法
    Python 之ConfigParser模块
    解读Loadrunner网页细分图(Web Page Diagnostics)
    ant 入门级详解
    Postman接口测试_添加断言
    算法:顺时针打印数组
  • 原文地址:https://www.cnblogs.com/configure/p/6531313.html
Copyright © 2011-2022 走看看