< 返回

    美国服务器Linux系统下添加IP教程

    2009-07-21 09:22 作者: 阅读量:1487

    美国服务器Linux系统,如果是redhat或CentOS版本,则如下:

    cd /etc/sysconfig/network-scripts
    ls ifcfg-eth0*
    可以看到有
    ifcfg-eth0
    如果以前配过别的ip,可能会有
    ifcfg-eth0:0
    ifcfg-eth0:1
    等等
    如果没有,就编辑一个ifcfg-eth0:0的文件,如果有,就在最大数上加一。文件内容:
    IPADDR=”192.168.0.10″
    NETMASK=””
    IPADDR就是要加的新的IP,如果有多个连续IP,可以写成:
    IPADDR=”192.168.0.10-11″
    NETMASK=””

    文件编辑完之后,运行:
    /etc/init.d/network reload

    用ifconfig看新的IP是否已经加上。

    如果为Debian系统,则如下:

    IP Address (/etc/network/interfaces)
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    allow-hotplug eth0
    iface eth0 inet static
    address 192.168.18.4
    netmask 255.255.255.0
    gateway 192.168.18.1

    修改好后可能需要执行:
    #/etc/init.d/networking restart
    重启。

    联系我们
    返回顶部