インターフェイスのセカンダリIP(Debian 8)

インターフェイスのセカンダリIP(Debian 8)

職場で古いDebian 8サーバーにセカンダリIPを追加しようとしたときに問題が発生しました。設定は次のとおりです(/etc/networking/interfacesのIPセクションのみ)。

auto eth0
allow-hotplug eth0
iface eth0 inet static
    address 192.168.0.10
    netmask 255.255.255.0
    gateway 192.168.0.1

auto eth0:0
allow-hotplug eth0:0
iface eth0:0 inet static
    address 10.10.0.10
    netmask 255.255.255.0
    gateway 10.10.0.1

ネットワークサービスを再起動すると、すべてがうまくいくように見え、ifconfigで必要なものがすべて表示されました。 "route -n"でルーティングテーブルを見ると正しいです。

問題は、新しいIPを使用してサーバーに接続できないことです。 pingできず、http / https(Webサーバー)を介してアクセスすることもできません。 Nutanixでも、サーバーに2つのIPがあることを示しています。

何か抜けましたか?それとも(サーバーではなく)ファイアウォールで変更する必要がありますか?

ベストアンサー1

試してみてください仮想インターフェイス:

auto eth0
allow-hotplug eth0 eth0.1
iface eth0 inet static
    address 192.168.0.10
    netmask 255.255.255.0
    gateway 192.168.0.1

iface eth0:1 inet static
    address 10.10.0.10
    netmask 255.255.255.0
    gateway 10.10.0.1

Debian 8で動作するかもしれませんが、テストしていません。 Debian 11 の場合は、代わりに systemd-networkd を使用し、古い ifupdown から遠ざけることをお勧めします。

おすすめ記事