ubuntu16 单网卡设置多个固定IP
    文章作者:恒爱网络 阅读次数:2070 发布时间:2021-4-7

    打开终端,输入命令 sudo vim /etc/network/interfaces 进入到文件中开始我们的配置

    auto lo

    iface lo inet loopback
    auto eth0         #网卡名       
    iface eth0 inet static     static 表示设置为静态

    address 103.200.68.237   #第一个IP

    netmask 255.255.255.0    #掩码

    gateway 103.200.68.1   #网关


    auto eth0:0     #注意网卡名
    iface eth0:0 inet static   
    address 103.200.68.238   #第二个IP
    netmask 255.255.255.0

    gateway 103.200.68.1


    auto eth0:1    #注意网卡名
    iface eth0:1 inet static
    address 103.200.68.239   #第三个IP
    netmask 255.255.255.0

    gateway 103.200.68.1

    dns-nameservers 8.8.8.8   #DNS
    dns-nameservers 8.8.4.4


    然后保存设置,rebboot重启