ubuntu雙網絡設置

ubuntu16.04 eth0 eth5,eth0:內網(靜態IP),eth5:外網(DHCP分配)

root@localhost:~# ifconfig
eth5     Link encap:Ethernet  HWaddr 00:11:22:33:44:51
          inet addr:172.21.171.68  Bcast:172.21.171.255  Mask:255.255.254.0
          inet6 addr: fe80::4a41:bfd0:68b9:e9c8/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6086 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4452 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5477360 (5.4 MB)  TX bytes:639104 (639.1 KB)

eth0      Link encap:Ethernet  HWaddr 00:0b:ab:11:22:33
          inet addr:169.254.8.120  Bcast:169.254.8.255  Mask:255.255.255.0
          inet6 addr: fe80::157b:8a3e:c6e:468c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:262 errors:0 dropped:0 overruns:0 frame:0
          TX packets:74 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:21647 (21.6 KB)  TX bytes:9379 (9.3 KB)
          Interrupt:24
root@localhost:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         172.21.171.254  0.0.0.0         UG    100    0        0 eth5
default         169.254.8.254   0.0.0.0         UG    101    0        0 eth0
169.254.8.0     *               255.255.255.0   U     100    0        0 eth0
adhcp2.acn.a 172.21.171.254  255.255.255.255 UGH   100    0        0 eth5
172.21.170.0    *               255.255.254.0   U     100    0        0 eth5

修改如下:

root@localhost:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 169.254.8.120
        netmask 255.255.255.0
        gateway 169.254.8.254
        #DNS=10.0.0.1 8.8.8.8 114.114.114.114

 

root@localhost:~# cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
dns=dnsmasq

[ifupdown]
managed=true

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章