首页 >
系统 >
linux
ubuntu 12.04单网卡如何设置双IP
时间:2014-05-30 08:31:50 点击: 来源: 作者:
服务器有时只有一个网卡,如果对内对外都要能使用,就要使用双IP设置,在ubuntu 12.04下,直接修改/etc/network/interfaces,在后面加上如下内容:auto eth0:0iface eth0:0 inet staticaddress 192.168.2.230netmask 2 ...

服务器有时只有一个网卡,如果对内对外都要能使用,就要使用双IP设置,在ubuntu 12.04下,直接修改/etc/network/interfaces,在后面加上如下内容:auto eth0:0iface eth0:0 inet staticaddress 192.168.2.230netmask 255.255.255.0gateway 192.168.2.1
其中关键内容在eth0:0这个字眼,其中eth0表示机器的第一块网卡,后面的0表示子网卡。如果还要再设置一个IP,就用eth0:1,以此类推。其余参数address、netmask、gateway根据需要进行修改。
然后重新启动网络服务器
sudo /etc/init.d/networking restart
使用ifconfig查看eth0:0
ifconfig eth0:0

单网卡设置双IP
”您可通过以下微信二维码,赞赏作者“
