maketop’s blog

Just another WordPress weblog

Archive for July, 2009

注意添加ip的如果出现错误会导致无法连接服务器,因此改动过程中要非常注意

准备工作
- 认清主机商给你提供的是哪些ip
- ifconfig查看当前服务器的ip
- ping ips -t 查看链接状况,如果此时这是能够Ping通,有可能该ip并没有真正分配给你

开始添加
- 修改 /etc/network/interfaces 文件
- 当前文件可能是如下样式
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 200.63.48.64
netmask 255.255.255.0
network 200.63.48.0
broadcast 200.63.48.255
gateway 200.63.48.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 208.67.222.222
dns-search alicestore.info

- 添加第二个ip
将第一个ip的inferce修改为以下样式
….
# The primary network interface
allow-hotplug eth0:0
iface eth0:0 inet static
…..

eth0可以看作网卡,:0 是绑定的第一个ip
假如主机上分配给你的是 200.63.48.80
直接在文件末尾添加
…..
auto eth0:1
iface eth0:1 inet static
address 200.63.48.80
netmask 255.255.255.0
network 200.63.48.0
broadcast 200.63.48.255
gateway 200.63.48.1
…..

- 认真检查是否正确
- 重新启动networking
执行

# /etc/init.d/networking restart

执行的结果例子
debian:/etc/network# /etc/init.d/networking restart
Reconfiguring network interfaces…if-up.d/mountnfs[eth0:1]: waiting for interface eth0:2 before doing NFS

mounts (warning).
done.
debian:/etc/network# /etc/init.d/networking restart
Reconfiguring network interfaces…if-up.d/mountnfs[eth0:1]: waiting for interface eth0:2 before doing NFS

mounts (warning).
done.

系统应当马上就生效,这是Ping这个ip的话应该就能够Ping通了。

Comments (0) Posted on Thursday, July 30th, 2009

    Popular Post

    Most Commented Posts

    Random Posts