ルータの3つのインターフェイス間のパスを指定する方法

ルータの3つのインターフェイス間のパスを指定する方法

私は次の設定を持っています:

                                       10.5.128.150
Ubuntu                              Ubuntu eth2 <------>   server (10.5.128.154)
client  eth1     <---->    eth1     Router eth3 <------>
    10.5.129.179       10.5.129.39       10.5.130.201

したがって、Ubuntu ルータは 3 つのドメインを管理します。

  • 10.5.129.0/24: クライアントが住んでいる場所です。
  • 10.5.128.0/24: eth2 によって管理され、サーバーに接続されます。
  • 10.5.130.0/24: eth3で管理

ここに答えてください。https://askubuntu.com/a/168037/347674、ルータを10.5.128.0/24トラフィックのゲートウェイとして使用するようにクライアントを設定しました。

これはルータのルーティングテーブルです。

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
....
10.5.128.0      *               255.255.255.0   U     0      0        0 eth2
10.5.129.0      *               255.255.255.0   U     0      0        0 eth1
10.5.130.0      *               255.255.255.0   U     0      0        0 eth3

私はビューには問題ありませんが、クライアントがそのサーバーにpingしようとすると応答がありません。

# ping -n -I eth1 10.5.128.154                                                                                                                                  
PING 10.5.128.154 (10.5.128.154) from 10.5.129.179 eth1: 56(84) bytes of data.

ルータは、ping トラフィックがルータの eth1 に正しく入力されていることを示します。

# tcpdump -n -i eth1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
15:20:17.428153 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 909, seq 170, length 64
15:20:17.618104 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 874, seq 2534, length 64
15:20:18.427959 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 909, seq 171, length 64

しかし、ルーターのpingブラックホール。私が予想したように、eth2インターフェースから出ることはありません。

# tcpdump -n -i eth2
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth2, link-type EN10MB (Ethernet), capture size 262144 bytes

(空です。)

実際にはどこにも行きません。

# tcpdump -n -i any icmp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on any, link-type LINUX_SLL (Linux cooked), capture size 262144 bytes
15:31:53.138046 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 874, seq 3224, length 64
15:31:54.145980 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 874, seq 3225, length 64
15:31:55.154033 IP 10.5.129.179 > 10.5.128.154: ICMP echo request, id 874, seq 3226, length 64

ルーティングテーブルに従ってeth2でpingを要求しないでください。または、eth2からパケットを取得するには、Ubuntuルーターで別のものを構成する必要がありますか?

ベストアンサー1

活性化しましたか?今後

使用

/sbin/sysctl -w net.ipv4.conf.all.forwarding=1

永久に作りなさい。

おすすめ記事