ubuntu下双网卡,如何选择第二张网卡上网?
aree 2018-06-11 03:15:40 哪位兄弟能帮忙检查一下。
ubuntu下双网卡,如何选择第二张网卡上网?第一个网站走内网,第二张走外网。
配置如下:
root@ubuntu:/etc# ifconfig
eno1 Link encap:Ethernet HWaddr 45:69:c6:3f:b4:6e
inet addr:10.92.35.225 Bcast:10.92.35.255 Mask:255.255.255.0
inet6 addr: fe80::f12b:321c:9a85:bc65/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:266904448 errors:0 dropped:0 overruns:0 frame:0
TX packets:249582652 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:324687451815 (324.6 GB) TX bytes:215951829090 (215.9 GB)
Interrupt:20 Memory:f7c00000-f7c20000
enp0s20u1 Link encap:Ethernet HWaddr 9b:26:03:3c:67:e3
inet addr:192.168.42.11 Bcast:192.168.42.255 Mask:255.255.255.0
inet6 addr: fe80::7eca:1daa:da3:398a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2402 errors:0 dropped:0 overruns:0 frame:0
TX packets:3215 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:233239 (233.2 KB) TX bytes:463146 (463.1 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:69465629 errors:0 dropped:0 overruns:0 frame:0
TX packets:69465629 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:15830765569 (15.8 GB) TX bytes:15830765569 (15.8 GB)
root@ubuntu:/etc# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.92.35.1 0.0.0.0 UG 100 0 0 eno1
0.0.0.0 192.168.42.129 0.0.0.0 UG 101 0 0 enp0s20u1
10.92.32.6 10.92.35.1 255.255.255.255 UGH 100 0 0 eno1
10.92.35.0 0.0.0.0 255.255.255.0 U 100 0 0 eno1
192.168.42.0 0.0.0.0 255.255.255.0 U 0 0 0 enp0s20u1
192.168.42.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s20u1
-----------------
root@ubuntu:/etc# vi /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto eth0
iface eth0 inet static
address 10.92.35.225
netmask 255.255.255.0
iface eth1 inet static
address 192.168.42.11
netmask 255.255.255.0
gateway 192.168.42.129
auto eth1
root@ubuntu:/etc# /etc/init.d/networking restart
[....] Restarting networking (via systemctl): networking.serviceJob for networking.service failed because the control process exited with error code. See "systemctl status networking.service" and "journalctl -xe" for details.
failed!
上面这个,启动一直失败failed
是不是 vi /etc/network/interfaces 哪里配置错误了?