2つの異なるゲートウェイを使用したルーティング

2つの異なるゲートウェイを使用したルーティング

次の質問があります。 8.8.4.4 pingできません

ping -I ens192 8.8.4.4

PING 8.8.4.4 (8.8.4.4) from 192.168.4.44 ens192: 56(84) bytes of data.
^C
--- 8.8.4.4 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1023ms


ping -I ens192:1 8.8.4.4
ping: invalid source address ens192:1

私のネットワークは、1つのネットワークインターフェイスと2番目の仮想インターフェイスで構成されています。ゲートウェイも2つあります。両方のゲートウェイを構成する必要があります。

以前確認しましたが、Debian の通常のゲートウェイ回線を介して Google サーバーに接続できます。両方のゲートウェイで。では、どのように機能させることができますか?

マイインターフェイス設定ファイル

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto ens192
allow-hotplug ens192
iface ens192 inet static
        address 192.168.4.44
        netmask 255.255.255.0
        post-up ip route add 192.168.4.0/24 dev ens192 src 192.168.4.44 table rt1
        post-up ip route add default via 192.168.4.1 dev ens192 table rt1
        post-up ip rule add from 192.168.4.44/32 table rt1
        post-up ip rule add to 192.168.4.44/32 table rt1

auto ens192:1
allow-hotplug ens192:1
iface ens192:1 inet static
        address 192.168.4.201
        netmask 255.255.255.0
        post-up ip route add 192.168.4.0/24 dev ens192:1 src 192.168.4.201 table rt2
        post-up ip route add default via 192.168.4.3 dev ens192 table rt2
        post-up ip rule add from 192.168.4.201/32 table rt2
        post-up ip rule add to 192.168.4.201/32 table rt2

ベストアンサー1

いくつか:

  • インターフェイスのIPアドレスを転送します-I。つまり-I 192.168.4.201
  • 2番目のインターフェイスのデフォルトパスはdev ens192次のとおりです。dev ens192:1
  • 私はあなたが192.168.4.1と192.168.4.3をpingできないか、ここに表示されていない他の設定があると思います。

おすすめ記事