Scene:
The computer network segment of the classroom is 172.16.30.0/24 some learning materials and the IP of the Yum source is 172.16.8.100
By default the classroom computer is interoperable and connected to the teaching ftp172.16.8.100
Now need to surf the internet but with the Android phone USB sharing computer online found that 172.16.30.0 network segment is through, but is not on the net, to the Internet can only disable eth0
Card:
The computer eth0 connects the intranet 172.16.30.0/24 gateway through the network cable 172.16.30.254
Mobile usb0 Connect the extranet 192.168.42.0/24 gateway via WiFi 192.168.42.129
Final effect: Computer connection teacher VNC Normal connection teaching material ftp:172.16.8.100 normal connection outside the network normal
650) this.width=650; "src=" Http://www.3glong.com/content/uploadfile/201605/cb4e1463450603.png "title=" Click to view Original "alt= "Screenshot-2.png" width= "852" border= "0" height= "516"/>
Including the KVM in the 192.168.122.0 network segment can also be connected to the FTP and connected to the external network normal
Resolution process:
[[email protected] ~]# route #查看路由表Kernel ip routing tableDestination Gateway genmask flags metric ref Use Iface172.16.30.0 * 255.255.255.0 U 1 0 0 eth0192.168.42.0 * 255.255.255.0 U 1 0 0 usb0192.168.122.0 * 255.255.255.0 u 0 0 0 virbr0default bogon 0.0.0.0 UG 0 0 0 eth0[ [email protected] ~]# route add default gw 192.168.42.129 #添加网关 [ [email protected] ~]# routekernel ip routing tabledestination Gateway Genmask Flags Metric Ref Use Iface172.16.30.0 * 255.255.255.0 U 1 0 0 eth0192.168.42.0 * 255.255.255.0 U 1 0 0 usb0192.168.122.0 * 255.255.255.0 u 0 0 0 virbr0default bogon 0.0.0.0 ug 0 0 0 usb0default bogon 0.0.0.0 ug 0 0 0 eth0[[email protected] ~]# route add -net 192.168.42.0 netmask 255.255.255.0 dev usb0 #设置192. The 168.42.0 network segment uses the USB0 NIC by default [[email protected] ~]# ping 172.16.8.100 #这个时候还是不通PING 172.16.8.100 (172.16.8.100) 56 (+) BYTES OF DATA.^C--- 172.16.8.100 ping statistics ---2 packets transmitted, 0 received, 100% packet loss, time 1437ms[[email Protected] ~]# route add -net 172.16.8.0 netmask 255.255.255.0 dev eth0 # Set 172.16.8.0 network segment to use eth0 NIC by default [[email protected] ~]# ping 172.16.8.100ping 172.16.8.100 (172.16.8.100) 56 (+) bytes of data.64 bytes from 172.16.8.100: icmp_seq=1 ttl=63 time=2.60 ms^c--- 172.16.8.100 ping statistics ---1 packets transmitted, 1 received, 0% packet loss, time 934msrtt min/avg/max/mdev = 2.609/2.609/2.609/0.000 ms[[email protected] ~]# routekernel ip routing tabledestination gateway genmask Flags Metric Ref Use Iface172.16.30.0 * 255.255.255.0 u 1 0 0 eth0192.168.42.0 * 255.255.255.0 U 0 0 0 usb0192.168.42.0 * 255.255.255.0 U 1 0 0 usb0172.16.8.0 * 255.255.255.0 U 0 0 0 eth0192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0default bogon 0.0.0.0 UG 0 0 0 usb0default bogon 0.0.0.0 UG 0 0 0 eth0[[email protected] ~]#
Starting address: The Dragon blog http://www.3glong.com/post-59.html
This article is from the "Dragon Blog" blog, please be sure to keep this source http://3glong.blog.51cto.com/11271871/1774298
To solve the problem of not being able to access Linux dual NIC