再起動せずにDebian 10に永続ルーティングを追加する

再起動せずにDebian 10に永続ルーティングを追加する

Debian 10コンピュータを再起動せずに固定永続パスを追加しようとしています。私の/etc/network/interfaces外観は次のとおりです。

# 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
allow-hotplug ens192
iface ens192 inet static
        address xxx.xxx.xxx.xxx/xx
        gateway xxx.xxx.xxx.xxx
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx
        dns-search domain.com
        up /bin/ip route add yyy.yyy.yyy.yyy/yy via yyy.yyy.yyy.yyy

質問を投稿した後、/etc/init.d/networking restartインターネット接続が失われました。 IPアドレスをpingすると、このメッセージが表示されますconnect: Network is unreachable

マシンを再起動すると、すべてのもの(新しい静的パスを含む)が正しく機能します。

コンピュータを再起動せずに固定永続パスを追加する方法についてヒントを与えることができる人はいますか?

ベストアンサー1

@stoneyが述べたように、完全なオンライン方法はコマンドをファイルに追加してからinterfaces手動で実行することです。手動で実行する代わりに、次のことができます。

  • ifdown ens192 && ifup ens192または
  • /etc/init.d/networking restartallow-hotplug交換後auto(もちろん実際にホットスワップ機能に依存しない限り)

interfacesどちらの方法も短いネットワークハングを引き起こしますが、ファイルの実際の内容(指定されたセクションのみまたは全体)をテストできます。

おすすめ記事