zoukankan      html  css  js  c++  java
  • ubuntu系统添加ip

    默认情况下,我们买服务器都会给我们5个以上的ip,一般主机都对应一个主ip,如果想把4个剩余ip加到主机上,需要手动配置,具体操作是

    打开vim /etc/network/interfaces

    默认是

    auto lo
    iface lo inet loopback
    auto eth0
    iface eth0 inet static
    address 8.8.8.8(根据自己的ip)
    netmask 255.255.255.248
    gateway 8.8.8.8(根据自己的getway)

    要再添加就加上

    auto eth0:1
    iface eth0:1 inet static
    address 8.8.8.8(根据自己的ip)
    netmask 255.255.255.248
    gateway 8.8.8.8(根据自己的getway)

    auto eth0:2
    iface eth0:2 inet static
    address 8.8.8.8(根据自己的ip)
    netmask 255.255.255.248
    gateway 8.8.8.8(根据自己的getway)

    以此类推

    加完后保存,重启

    /etc/init.d/networking restart

    ok

    可能会遇到的错误

    /etc/init.d/networking restart错误分析案例:
    root@www.ctohome.com:/etc/network# /etc/init.d/networking restart
    * Reconfiguring network interfaces...
    /etc/network/interfaces:165: interface eth0:28 declared allow-auto twice
    ifdown: couldn't read interfaces file "/etc/network/interfaces"
    /etc/network/interfaces:165: interface eth0:28 declared allow-auto twice
    ifup: couldn't read interfaces file "/etc/network/interfaces"
    ...fail!

    说明eth0:28有重复,解决办法:vi interfaces找到eth0:28,删除掉重复的

    root@www.ctohome.com:/etc/network# /etc/init.d/networking restart
    * Reconfiguring network interfaces...
    /etc/network/interfaces:166: duplicate interface
    ifdown: couldn't read interfaces file "/etc/network/interfaces"
    /etc/network/interfaces:166: duplicate interface
    ifup: couldn't read interfaces file "/etc/network/interfaces"
    ...fail!

    说明166行有重复,解决办法:vi interfaces找到166行(set number),删除掉重复的

    root@www.ctohome.com:/etc/network# /etc/init.d/networking restart
    * Reconfiguring network interfaces...
    /etc/network/interfaces:162: duplicate interface
    ifdown: couldn't read interfaces file "/etc/network/interfaces"
    /etc/network/interfaces:162: duplicate interface
    ifup: couldn't read interfaces file "/etc/network/interfaces"

    说明162行有重复,解决办法:vi interfaces找到166行(set number),删除掉重复的
  • 相关阅读:
    ultraiso:usb-hdd+ v2
    ntfs格式uefi启动u盘
    M.2、U.2谁更好?主流硬盘接口大扫盲
    高清(200万像素)多灯红外防水枪型网络摄像机 DH-IPC-HFW5200-IRA
    佳能 imageclass mf40120
    hotswapagent——热更新代码而无需重启生产环境
    S5700&S5710 产品文档 : 配置
    hp 88a加粉
    传真机色带安装
    Idea下Android的安装与配置 (2019.11更新)
  • 原文地址:https://www.cnblogs.com/you-jia/p/4691611.html
Copyright © 2011-2022 走看看