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]

  • 相关阅读:
    CentOS7 PXE安装批量安装操作系统
    004_MySQL 主从配置
    CentOS 桥接网卡配置
    玩转 Jupyter Notebook (CentOS)
    搭建专属于自己的Leanote云笔记本
    wetty 安装(web+tty)
    wget命令详解
    linux 下find---xargs以及find--- -exec结合使用
    Linux 交换分区swap
    Linux 时区的修改
  • 原文地址:https://www.cnblogs.com/configure/p/6531313.html
Copyright © 2011-2022 走看看