Ubuntu单个网卡绑定多个ip
常常我们有需要一个网卡像windows一样设置多个IP。
下面我们看看在ubuntu下怎么样做.
我们先打开网络接口的文件sudo vi /etc/network/interfaces会看到
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface auto eth0
iface eth0 inet staticaddress 202.205.XXX.XXnetmask 255.XXX.XXX.Xnetwork 202.205.XXX.XXbroadcast 202.205.XXX.XXXgateway 202.205.XXX.XX# dns-* options are implemented by the resolvconf package, if installeddns-nameservers 202.205.XXX.XX
照上边eth0添加eth0:0
auto eth0:0
iface eth0:0 inet static
name Ethernet address 202.205.XXX.XXnetmask 255.XXX.XXX.Xnetwork 202.205.XXX.XXbroadcast 202.205.XXX.XXXgateway 202.205.XXX.XX# dns-* options are implemented by the resolvconf package, if installeddns-nameservers 202.205.XXX.XX
重启服务
sudo /etc/init.d/networking restart
测试新的ip地址是否生效
ping 202.205.XXX.XX
ping 202.205.XXX.XX
==============以上为添加同一网段内的IP地址=================
还没有评论,来说两句吧...