openwrt 可以从路由器 ping 出去,但不能从外面 ping 出去

openwrt 可以从路由器 ping 出去,但不能从外面 ping 出去

我使用 openwrt 固件设置了 TPLINK WDR3600。

我有一个调制解调器 (192.168.1.253),我将其设置为桥接模式,并使用一根电缆将此 LAN 连接到 WDR WAN (192.168.1.1)。另一根电缆将 WDR 连接到 PC。

我可以从 WDR 内部 ping 通(我通过 putty 连接),但无法从我的浏览器 ping 通(互联网连接在 PC 上不起作用)。

ifconfig:

br-lan    Link encap:Ethernet  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:633 errors:0 dropped:0 overruns:0 frame:0
          TX packets:512 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:76468 (74.6 KiB)  TX bytes:74782 (73.0 KiB)

eth0      Link encap:Ethernet 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:22008 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24684 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4654823 (4.4 MiB)  TX bytes:8707067 (8.3 MiB)
          Interrupt:4

eth0.1    Link encap:Ethernet  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:640 errors:0 dropped:0 overruns:0 frame:0
          TX packets:515 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:77897 (76.0 KiB)  TX bytes:74920 (73.1 KiB)

eth0.2    Link encap:Ethernet  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:87 errors:0 dropped:67 overruns:0 frame:0
          TX packets:9895 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:41394 (40.4 KiB)  TX bytes:3888735 (3.7 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:566 errors:0 dropped:0 overruns:0 frame:0
          TX packets:566 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:59162 (57.7 KiB)  TX bytes:59162 (57.7 KiB)

tap0      Link encap:Ethernet  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4317 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 B)  TX bytes:884846 (864.1 KiB)

wlan0     Link encap:Ethernet  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:64 errors:0 dropped:0 overruns:0 frame:0
          TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:8640 (8.4 KiB)  TX bytes:9920 (9.6 KiB)

在/etc/config/网络:

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config interface 'lan'
    option type 'bridge'
    option proto 'static'
    option ipaddr '192.168.1.1'
    option broadcast '192.168.1.255'
    option _orig_ifname 'eth0.1 radio0.network1 radio1.network1'
    option _orig_bridge 'true'
    option ifname 'eth0.1 tap0'

config interface 'wan'
    option ifname 'eth0.2'
    option proto 'pppoe'
    option username 'user_isp'
    option password 'password'



config switch
    option name 'eth0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'eth0'
    option vlan '1'
    option ports '0t 2 3 4 5'

config switch_vlan
    option device 'eth0'
    option vlan '2'
    option ports '0t 1'

我做错什么了吗?

答案1

这可能是防火墙的问题,但更有可能是未设置 ip_forwarding。

看看输入“echo 1 > /proc/sys/net/ipv4/ip_forward”是否能解决您的问题。如果能,请将“net.ipv4.ip_forward=1”行添加到 /etc/sysctl.conf 以使此更改永久生效。

如果这不起作用,请提供 route -n; iptables -vnL; iptables -t nat -vnL 的输出以显示您的路由表和 IPTABLES 规则

相关内容