Linode VPS 添加IP方法

默认情况下,Linode VPS 是采用DHCP(DHCP解释见维基百科http://zh.wikipedia.org/zh/DHCP)方式分配IP,如果你购买了新的IP是不生效的.你要指定静态地址才行.

由于我这里装的是centos 这里只说下centos 5.4 &Fedora 下面添加新的IP的设置方法吧.

首先VI 编辑File: /etc/sysconfig/network-scripts/ifcfg-eth0

# Configuration for eth0
DEVICE=eth0
BOOTPROTO=none

# This line ensures that the interface will be brought up during boot.
ONBOOT=yes 

# eth0 - This is the main IP address that will be used for most outbound connections.
# The address, netmask and gateway are all necessary.
IPADDR=12.34.56.78  (这里是你的第一个IP地址)
NETMASK=255.255.255.0 (这里是子网掩码)
GATEWAY=12.34.56.1 (网关)

添加第二个IP,  File: /etc/sysconfig/network-scripts/ifcfg-eth0:0

# Configuration for eth0:0
DEVICE=eth0:0
BOOTPROTO=none

# This line ensures that the interface will be brought up during boot.
ONBOOT=yes

# eth0:0
IPADDR=34.56.78.90
NETMASK=255.255.255.0
GATEWAY=12.34.56.1

添加第三个IP File: /etc/sysconfig/network-scripts/ifcfg-eth0:1

# Configuration for eth0:1
DEVICE=eth0:1
BOOTPROTO=none

# This line ensures that the interface will be brought up during boot.
ONBOOT=yes

# eth0:1 - Private IPs have no gateway (they are not publicly routable) so all you need to
# specify is the address and netmask.
IPADDR=192.168.133.234
NETMASK=255.255.128.0
GATEWAY=12.34.56.1

当然这一切配置完之后,执行 service network restart即可.

12 Responses to “Linode VPS 添加IP方法”

  1. burst.net VPS上也碰到这个问题,手工设置网络,出现错误。 最后提交ticket,很快就解决了。

    [Reply]

  2. 断峰狼 CHINA Internet Explorer Windows says:

    mark
    留作备用,谢谢久酷哈~

    [Reply]

  3. hamo CHINA Google Chrome Windows says:

    Linode的文档里有多ip的设置方法
    其实也可以不用重启,在控制台用ifdown和ifup命令就可以

    [Reply]

    久酷 AUSTRALIA Mozilla Firefox Windows Reply:

    @hamo, 他的文档我还没怎么研究,以后多研究研究 ^_^

    [Reply]

  4. Timothy CHINA Internet Explorer Microsoft PocketPC says:

    Linux技术越来越强了,以后要多向你请教

    [Reply]

    久酷 AUSTRALIA Mozilla Firefox Windows Reply:

    @Timothy, 还是菜鸟级别,菜菜啊……呵呵

    [Reply]

  5. zwwooooo CHINA Mozilla Firefox Ubuntu Linux says:

    我通常没有环境去折腾就不去折腾,哈

    [Reply]

    久酷 AUSTRALIA Mozilla Firefox Windows Reply:

    @zwwooooo, 折腾起来也是比较费劲啊 :oops: :oops:

    [Reply]

  6. 断峰狼 CHINA Internet Explorer Windows says:

    “技术活”越来越到家了~

    [Reply]

    久酷 AUSTRALIA Mozilla Firefox Windows Reply:

    @断峰狼, 比较折腾人哇

    [Reply]

  7. Youwei CHINA Mozilla Firefox Windows says:

    你技术又进步了,以后可能来和你同居,哈哈

    [Reply]

    久酷 AUSTRALIA Mozilla Firefox Windows Reply:

    @Youwei, 来吧来吧,给你留着位置 :lol: :lol:

    [Reply]

Leave a Reply

:wink: :-| :-x :twisted: :) 8-O :( :roll: :-P :oops: :-o :mrgreen: :lol: :idea: :-D :evil: :cry: 8) :arrow: :-? :?: :!:


正在读取数据……