Ubuntu Desktop 14.04 上每个 NIC 有多个 IP 地址

Ubuntu Desktop 14.04 上每个 NIC 有多个 IP 地址

我读了很多关于如何为每个 NIC 添加虚拟 IP 地址的教程,但对我来说不起作用。所有教程都要求我必须编辑 /etc/network/interfaces,但当我重新启动服务时,总是出现错误。

sudo nano /etc/network/interfaces

iface eth0:0 inet static
address 192.168.1.10
netmask 255.255.255.0
broadcast 192.168.1.255

iface eth0:1 inet static
address 192.168.1.11
netmask 255.255.255.0
broadcast 192.168.1.255

我如何使用 Ubuntu 桌面来实现这一点?非常感谢!

ps:我想使用这个文件而不是图形工具。

答案1

(我只是按照你发布的配置来操作)我已经在我的电脑上完成了这个操作。以下操作有效:

iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
broadcast 192.168.1.255

iface eth0:0 inet static
address 192.168.1.11
netmask 255.255.255.0
broadcast 192.168.1.255

请注意,初始 eth0 不是别名,您需要将其保留为 eth0。然后输入 eth0:# 作为别名。(假设这是您发布的整个文件)

相关内容