ubuntu单网卡双IP的设置方法
最近要设置一个双线IP服务器,系统是ubuntu,那么如何设置单网卡双IP呢?
按照步骤:
1,sudo vim /etc/network/interfaces
输入代码:
##lo配置
auto lo
iface lo inet loopback
##虚拟出一个eth0:0
auto eth0
auto eth0:0
##配置eth0的ip,默认网关,子网掩码
iface eth0 inet static
address 60.174.233.18
gateway 60.174.233.129
netmask 255.255.255.128
##配置eth0:0的ip,默认网关,子网掩码
iface eth0:0 inet static
address 42.157.5.18
gateway 60.174.233.129
netmask 255.255.255.128
2,保存,输入命令:sudo service networking restart
即可完成ubuntu单网卡双IP的设置方法。希望对你有用。
听说机房说不行,试试下面的:
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto em1
iface em1 inet static
address 60.174.234.11
gateway 60.174.234.1
netmask 255.255.255.128
auto em1:1
iface em1:1 inet static
address 42.157.4.11
netmask 255.255.255.128
近期评论