我定制的Linux系统运行在设备A上,设备A采用ARM处理器。设备 A 有一个eth2
(固定 IP 192.168.5.1)和一个wlan2
,它是具有固定 IP 192.168.1.6 的无线发射器。我的电脑可以通过192.168.1.6连接设备A,但是在这种情况下,在没有有线连接的情况下,我仍然可以使用192.168.5.1登录设备A;但是如果我使用有线连接后无法使用192.168.1.6登录设备A,请问是什么问题?
[root@dobot ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 wlan2
192.168.5.0 * 255.255.255.0 U 0 0 0 eth2
192.168.100.0 * 255.255.255.0 U 0 0 0 eth1
[root@dobot ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 4E:BF:B7:B3:54:5F
inet6 addr: fe80::4cbf:b7ff:feb3:545f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8681 errors:2 dropped:0 overruns:0 frame:2
TX packets:8689 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:627545 (612.8 KiB) TX bytes:356046 (347.7 KiB)
eth1 Link encap:Ethernet HWaddr 00:0E:C6:87:72:01
inet addr:192.168.100.6 Bcast:192.168.100.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
eth2 Link encap:Ethernet HWaddr 00:0E:C6:87:72:01
inet addr:192.168.5.1 Bcast:192.168.5.255 Mask:255.255.255.0
inet6 addr: fe80::20e:c6ff:fe87:7201/64 Scope:Link
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:28924 errors:0 dropped:0 overruns:0 frame:0
TX packets:41781 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2545558 (2.4 MiB) TX bytes:5457600 (5.2 MiB)
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:60760 errors:0 dropped:0 overruns:0 frame:0
TX packets:60760 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3955747 (3.7 MiB) TX bytes:3955747 (3.7 MiB)
wlan2 Link encap:Ethernet HWaddr D0:37:45:8A:68:90
inet addr:192.168.1.6 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::d237:45ff:fe8a:6890/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:157031 errors:0 dropped:589 overruns:0 frame:0
TX packets:15430 errors:0 dropped:82 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2875938 (2.7 MiB) TX bytes:4311430 (4.1 MiB)
我是这样理解的,eth2
有wlan2
不同的身份。eth2
是终端,wlan2
是节点(具有分配IP的功能)。之所以是192.168.1.6和192.168.1。 x 有线时无法ping通192.168.1.100,是因为192.168.1.1没有路由转发功能;无线连接时,由于192.168.1.x的特殊性wlan2
,192.168.1.x可以ping通192.168.1.x,所以192.168.1.x也可以ping通192.168.1.x。