Ubuntu 22.04では、セカンダリインターフェイスにセカンダリゲートウェイを追加できません。

Ubuntu 22.04では、セカンダリインターフェイスにセカンダリゲートウェイを追加できません。

2つのインターフェイスがあり、どちらもパブリックIPアドレスを持っています。そのうちの1つ(eth0)はプライマリ、もう1つ(eth1)はセカンダリです。 netplan + iproute2で設定しようとしています。 Ubuntu 18.04では、すべてがうまく機能します。

/etc/iproute2/rt_tables:

#
# reserved values
#
255     local
254     main
253     default
0       unspec
#
# local
#
#1      inr.ruhep
801 801
800 800

私のネットワーク計画の構成は次のとおりです。

network:
  version: 2
  ethernets:
    eth1: 
      addresses: 
      - 10.0.2.10/24
      gateway4: 10.0.2.1
      mtu: 1500 
      nameservers: 
        addresses: 
        - 8.8.8.8 
        - 8.8.4.4 
        search: [] 
      routes: 
        - to: 0.0.0.0/0 
          via: 10.0.2.1 
          metric: 50
          table: 800
      routing-policy: 
        - from: 10.0.2.10 
          table: 800 
          priority: 100
    eth0:
      addresses:
      - 10.0.1.10/24
      mtu: 1500
      gateway4: 10.0.1.1
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
        search: []
      routes:
        - to: 0.0.0.0/0
          via: 10.0.1.1
          metric: 100
          table: 801
      routing-policy:
        - from: 10.0.1.10
          table: 801
          priority: 200

gateway4このプロパティは廃止され、Ubuntu 22.04(またはそれ以前)以降は廃止されました。 Ubuntu 22.04にアップグレードした後、gateway4プロパティを削除しました。しかし今ではない

network:
  version: 2
  ethernets:
    eth1:
      addresses:
      - 10.0.2.10/24
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
      routes:
      - metric: 50
        to: 0.0.0.0/0
        via: 10.0.2.1
        table: 800
      routing-policy:
      - from: 10.0.2.10
        table: 800
        priority: 100
    eth0:
      addresses:
      - 10.0.1.10/24
      nameservers:
        addresses:
        - 8.8.8.8
        - 8.8.4.4
      routes:
      - metric: 100
        to: 0.0.0.0/0
        via: 10.0.1.1
        table: 801
      routing-policy:
      - from: 10.0.1.10
        table: 801
        priority: 200

そしてnetplan apply試してみた後もroute -nゲートウェイはまったく見えませんでした! netplanまたはiproute2が破損していますか?それとも一部の設定を変更する必要がありますか?

ベストアンサー1

おすすめ記事