linode centos下添加多个IP和DNS

2011.01.27 No Comments

Linode VPS默认情况下是通过DHCP自动获取IP的,如果另外购买了IP,就必须手动添加。

使用编辑器编辑 /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.
# The address, netmask and gateway are all necessary.
IPADDR=12.34.56.78 #你的IP地址
NETMASK=255.255.255.0 #子网掩码
GATEWAY=12.34.56.1 #网关

一般这样设置好,再执行命令:service network restart 重启网络就好了,如果还是不通,重启试一下。

添加第2个IP,可以创建/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

添加DNS的办法

使用编辑器编辑/etc/resolv.conf

search members.linode.com #可以不填
nameserver 98.76.54.32 #在后台Remote Access标签中的DNS Resolvers
nameserver 76.54.32.10 #在后台Remote Access标签中的DNS Resolvers
options rotate #必须有这行

Related Posts:
No Response
Comment (0)
Trackback (1)
Leave a Reply
icon_wink.gif icon_neutral.gif icon_mad.gif icon_twisted.gif icon_smile.gif icon_eek.gif icon_sad.gif icon_rolleyes.gif icon_razz.gif icon_redface.gif icon_surprised.gif icon_mrgreen.gif icon_lol.gif icon_idea.gif icon_biggrin.gif icon_evil.gif icon_cry.gif icon_cool.gif icon_arrow.gif icon_confused.gif icon_question.gif icon_exclaim.gif