给Linode VPS添加IP

本文编写于3663天前,最后编辑于 3663天前,部分内容可能已经过时,请您自行斟酌确认。

一.首先是要找linode要IP,要不到,都是扯淡.
以Centos为例
编辑eth0,网关和子网掩码可以通过ifconfig查看.

vi /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

vi /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

搞定
此时重启网络就可以了

service network restart

给Linode VPS添加IP》上有一条评论

发表评论 取消回复

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