Add Loopback Network Interface with Alias on FreeBSD

t

Note that this page will be part of a documentation about setting up a server using FreeBSD with similar features to the existing server documentation. Also note that this page is still work in progress

To use EzJail on a FreeBSD host, e. g. to sandbox different services, you need to add a loopback network interface and add some aliases to it. Jails networking seems to require a dedicated network and loopback aliases can not run on the external interface. Follow the next paragraphs to add one loopback interface including three aliases.
First, create the loopback interface in rc.conf:

cloned_interfaces="lo1"

Then, add some aliases to the loopback interface in rc.conf:

ifconfig_lo1_alias0="inet 10.1.1.1 netmask 255.255.255.0"
ifconfig_lo1_alias1="inet 10.1.1.2 netmask 255.255.255.0"
ifconfig_lo1_alias1="inet 10.1.1.3 netmask 255.255.255.0"

If you happen to add an alias to an already running server, you might want to avoid rebooting and therefore also invoke the following command to add the alias while keeping the system running:

ifconfig lo1 alias 10.1.1.3 netmask 255.255.255.0 

That’s it.
iss

Flattr: