Linode VPS 添加IP方法

当然首先,你需要向Linode申请新购IP。默认情况下,Linode VPS 是采用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 并重启服务器即可.

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注