Ubuntu多IP

sudo vi /etc/network/interfaces

auto lan1
iface lan1 inet static
address 192.168.2.2
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
dns-nameservers 192.168.2.1

auto lan1:0
iface lan1:0 inet static
address 192.168.1.2
netmask 255.255.255.0

sudo /etc/init.d/networking restart
ifconfig 没生效
sudo service networking restart
stop: Job failed while stopping
start: Job is already running: networking
还是没生效
直接sudo reboot now!!!

lan1 Link encap:Ethernet HWaddr 40:00:00:03:00:76
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::0000:0000:fe03:0076/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1366 errors:0 dropped:1 overruns:0 frame:0
TX packets:198 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:107322 (107.3 KB) TX bytes:18459 (18.4 KB)

lan1:0 Link encap:Ethernet HWaddr 40:00:00:03:00:76
inet addr:192.168.1.2 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

https://www.cnblogs.com/prettyshuang/p/5553700.html

标签: none

添加新评论