我定制的Linux系统运行在设备A上,设备A采用ARM处理器。设备A有两个网卡:(eth2
固定IP:192.168.5.1)和wlan2
(固定IP:192.168.1.6)。wlan2
是一个 USB 转 WiFi 发射器。当我通过执行禁用数据转发时echo 0 > /proc/sys/net/ipv4/ip_forward
,但ping 192.168.1.6
仍然成功。这是怎么回事?
[root@dobot ~]# echo 0 > /proc/sys/net/ipv4/ip_forward
[root@dobot ~]# cat /proc/sys/net/ipv4/ip_forward
0
[root@dobot ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.5.1 0.0.0.0 UG 0 0 0 eth2
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 eth2
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 RUNNING MULTICAST MTU:1500 Metric:1
RX packets:37729 errors:0 dropped:0 overruns:0 frame:0
TX packets:55791 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3182517 (3.0 MiB) TX bytes:7180021 (6.8 MiB)
[root@dobot ~]# ifconfig wlan2
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:1110732 errors:0 dropped:503 overruns:0 frame:0
TX packets:4261 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:32466 (31.7 KiB) TX bytes:364864 (356.3 KiB)