ubuntu 单网卡双 ip

局域网一套物理网络里有两个 ip 段,单网卡设置多 ip 可实现同时访问两个网段。

$ cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto eth0
iface eth0 inet static
address 192.168.9.250
gateway 192.168.9.1
netmask 255.255.255.0

auto eth0:1
iface eth0:1 inet dhcp

启用添加 的 ip

sudo ifup eth0:1

以上设置两个 ip,其中一个静态,另一个 dhcp 获取。

posted @ 2016-05-12 17:53  sammei  阅读(938)  评论(0编辑  收藏  举报