私が構築したLinuxルーターでは、戻りパケットはルーティングされません。

私が構築したLinuxルーターでは、戻りパケットはルーティングされません。

PiでRaspbianを実行するルーターを作成し、ここに複数のクライアントを接続しました。

これはおもちゃのプロジェクトであり、ノード間のルーティングにのみ興味があるため、NATなどは使用しません。

レイアウトは次のとおりです(私はECMPを使用しているので、両方のノードのアドレスはです10.0.0.4)。

ネットワークレイアウト

ルータでARPプロキシとIP転送を有効にしました。

pi@raspberrypi-router:~ sysctl net.ipv4.conf.all.proxy_arp
net.ipv4.conf.all.proxy_arp = 1

pi@raspberrypi-router:~ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

リバースパスフィルタリングが無効になっています。

pi@raspberrypi-router:~ sysctl net.ipv4.conf.all.rp_filter
net.ipv4.conf.all.rp_filter = 0

ルータでいくつかのルートを設定しました。

pi@raspberrypi-router:~ ip route show
10.0.0.4
    nexthop dev eth0 weight 1
    nexthop dev eth1 weight 1 
10.0.0.50 via 10.0.0.8 dev eth2
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.85

10.0.0.50ルータのpingがスムーズに進行します。

pi@raspberrypi-router:~ ping 10.0.0.50
PING 10.0.0.50 (10.0.0.50) 56(84) bytes of data.
64 bytes from 10.0.0.50: icmp_seq=1 ttl=64 time=1.07 ms
64 bytes from 10.0.0.50: icmp_seq=2 ttl=64 time=1.04 ms
^C
--- 10.0.0.50 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.049/1.064/1.079/0.015 ms

10.0.0.4ルータからpingを送信するのと同じ

pi@raspberrypi-router:~ ip roping 10.0.0.4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=64 time=1.08 ms
64 bytes from 10.0.0.4: icmp_seq=2 ttl=64 time=1.05 ms
^C
--- 10.0.0.4 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 1.052/1.069/1.087/0.037 ms

10.0.0.4しかし、pingは10.0.0.50機能しません。の応答は10.0.0.4再ルーティングされません10.0.0.50。 TCPDumpを使用してこれを確認しました。

On では、10.0.0.4ICMP エコー要求が到着し、応答が送信されることを確認します。

21:30:01.078281 IP 10.0.0.50 > 10.0.0.4: ICMP echo request, id 3819, seq 2109, length 64
21:30:01.078388 IP 10.0.0.4 > 10.0.0.50: ICMP echo reply, id 3819, seq 2109, length 64

ルータeth0インターフェイスでこれまでに応答が送信されたことを確認します。

21:30:47.078732 IP 10.0.0.50 > 10.0.0.4: ICMP echo request, id 3819, seq 2155, length 64
21:30:47.079286 IP 10.0.0.4 > 10.0.0.50: ICMP echo reply, id 3819, seq 2155, length 64

しかしそれで終わり、返事は戻ってこない10.0.0.50

デバッグをやってみましたが、ip route大丈夫に見えますか?

pi@raspberrypi-router:~ $ sudo ip route get to 10.0.0.50 from 10.0.0.4 iif eth0
10.0.0.50 from 10.0.0.4 dev eth2
    cache  iif eth0

何の問題がありますか?

ベストアンサー1

おすすめ記事