我已经将 Linux 机器设置为路由器。目前我的网络相当简单:
- 我已将路由器连接到光纤盒,并使用 与我的 ISP 进行身份验证
pppd
。 - 我有一个以太网接口,
enp2s0
它是路由器上的网关:
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.1.1 netmask 255.255.255.0 broadcast 0.0.0.0
inet6 fe80::20d:b9ff:fe5a:2f91 prefixlen 64 scopeid 0x20<link>
ether 00:0d:b9:5a:2f:91 txqueuelen 1000 (Ethernet)
RX packets 57348511 bytes 31510953543 (29.3 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 116229180 bytes 129467792313 (120.5 GiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xf7a00000-f7a1ffff
- 我有一个无线接口:
wlp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.1.1.2 netmask 255.255.255.0 broadcast 0.0.0.0
inet6 fe80::6f0:21ff:fe91:cf90 prefixlen 64 scopeid 0x20<link>
ether 04:f0:21:91:cf:90 txqueuelen 1000 (Ethernet)
RX packets 493730 bytes 595814115 (568.2 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 355275 bytes 344035494 (328.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
我希望客户端能够连接到它。
- 我有
nftables
一些路由流量的基本路由规则。
我的客户端可以正常连接到以太网接口。互联网等也按预期工作。但是,当连接到无线接口并 ping 时:
-> % ping -I wlp65s0 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 10.1.1.48 wlp65s0: 56(84) bytes of data.
^C
--- 8.8.8.8 ping statistics ---
60 packets transmitted, 0 received, 100% packet loss, time 60428ms
我好像没有收到任何回复。
在路由器上,启用时我看到以下内容nftables trace
:
trace id 85cd7345 ip filter trace_chain packet: iif "ppp0" ip saddr 8.8.8.8 ip daddr 10.1.1.48 ip dscp af21 ip ecn not-ect ip ttl 61 ip id 0 ip length 84 icmp type echo-reply icmp code net-unreachable icmp id 12 icmp sequence 59 @th,64,96 0xd9d22c6700000000d1790900
trace id 85cd7345 ip filter forward packet: iif "ppp0" oif "enp2s0" ip saddr 8.8.8.8 ip daddr 10.1.1.48 ip dscp af21 ip ecn not-ect ip ttl 60 ip id 0 ip length 84 icmp type echo-reply icmp code net-unreachable icmp id 12 icmp sequence 59 @th,64,96 0xd9d22c6700000000d1790900
trace id 3626e73a ip filter trace_chain packet: iif "wlp4s0" ether saddr 48:ad:9a:9d:5e:a4 ether daddr 04:f0:21:91:cf:90 ip saddr 10.1.1.48 ip daddr 8.8.8.8 ip dscp cs0 ip ecn not-ect ip ttl 64 ip id 52040 ip length 84 icmp type echo-request icmp code net-unreachable icmp id 12 icmp sequence 60 @th,64,96 0xdad22c67000000006cd70900
trace id 3626e73a ip filter forward packet: iif "wlp4s0" oif "ppp0" ether saddr 48:ad:9a:9d:5e:a4 ether daddr 04:f0:21:91:cf:90 ip saddr 10.1.1.48 ip daddr 8.8.8.8 ip dscp cs0 ip ecn not-ect ip ttl 63 ip id 52040 ip length 84 icmp type echo-request icmp code net-unreachable icmp id 12 icmp sequence 60 @th,64,96 0xdad22c67000000006cd70900
trace id a6c3e760 ip filter trace_chain packet: iif "ppp0" ip saddr 8.8.8.8 ip daddr 10.1.1.48 ip dscp af21 ip ecn not-ect ip ttl 61 ip id 0 ip length 84 icmp type echo-reply icmp code net-unreachable icmp id 12 icmp sequence 60 @th,64,96 0xdad22c67000000006cd70900
trace id a6c3e760 ip filter forward packet: iif "ppp0" oif "enp2s0" ip saddr 8.8.8.8 ip daddr 10.1.1.48 ip dscp af21 ip ecn not-ect ip ttl 60 ip id 0 ip length 84 icmp type echo-reply icmp code net-unreachable icmp id 12 icmp sequence 60 @th,64,96 0xdad22c67000000006cd70900
我无法理解。
这里的任何指点都会非常有帮助。
如果我将无线接口地址更改为 10.1.2.1,我就能连接到 LAN/WAN 上的其他主机。