一个接口上的辅助 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 (它是一个网络服务器)访问它。甚至 Nutanix 也显示服务器有两个 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。

相关内容