在 FreeBSD 机器上设置多个监狱时,我(自然)还需要为每个监狱设置网络。在我看来,有两种方法可以实现同一目标
设置多个克隆接口
或者
为一个克隆设置多个别名。
在第一种方法下,我做(在/etc/rc.conf
)
cloned_interfaces="lo1 lo2 ..."
ifconfig_lo1="inet 10.1.1.1 netmask 255.255.255.0"
ifconfig_lo2="inet 10.1.1.2 netmask 255.255.255.0"
...
Run Code Online (Sandbox Code Playgroud)
在第二种方法中,我可以做类似的事情
cloned_interfaces="lo1"
ifconfig_lo1_alias0="inet 10.1.1.1/24"
ifconfig_lo1_alias1="inet 10.1.1.2/24"
Run Code Online (Sandbox Code Playgroud)
我目前使用第一个并且它有效,并且我在某些权威上拥有它(类似于)第二个也可以。
问题是使用克隆接口和别名之间的根本区别是什么,特别是在这种情况下,以及哪种方法更好?