I am trying to add an alias to my network card (I would like to use jails) on my FreeBSD box. It is running version 10.2-RELEASE-p7 (generic amd64 kernel). The machine is running in a Hyper-V virtual machine, but I experience the same thing on my physical box, the only difference is that is is running the x86 (32bit) version of the same 10.2 kernel.

The network interface hn0 has a static IP address:, my default router is Everything works fine, until I add the alias:

ifconfig hn0 inet alias

This creates the alias on hn0 as ifconfig shows:

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
    inet netmask 0xff000000
hn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 00:15:5d:00:0f:00
    inet netmask 0xffffff00 broadcast
    inet netmask 0xffffffff broadcast

The problem is that as soon as I have the alias in place, I cannot reach any host outside my subnet (even when using the host's IP address). E.g. a google nameserver:

ping ( 56 data bytes

However, I can ping anything using the alias as the source:

ping -S
PING ( from 56 data bytes
64 bytes from icmp_seq=0 ttl=56 time=11.137 ms

If the alias is created by jail(8) when starting a jail, the jail using the alias has network access, while the host does not. After removing the alias I have to restart the services netif and routing to regain network access on the primary IP of the host.

When the jail runs, I can ssh into it or I can ping it using the IP alias.

Based on the fact that I cannot ping external nodes using their IP my guess would be that there is something wrong with the routing. Name resolving does not work as my box is unable to reach the DNS servers. Here is my netstat -rn output before adding the alias:

Destination        Gateway            Flags      Netif Expire
default          UGS         hn0          link#1             UH          lo0     link#2             U           hn0       link#2             UHS         lo0

and after the alias has been created:

Destination        Gateway            Flags      Netif Expire
default          UGS         hn0          link#1             UH          lo0     link#2             U           hn0       link#2             UHS         lo0      link#2             UHS         lo0   link#2             U           hn0

IPv6 values are omitted as I have disabled IPv6 by adding


to /etc/rc.conf

I am no expert at network setup, but I have read everything I could find about jails and IP aliases but I haven't found anything helpful. Maybe I am overlooking something trivial, but I have no idea what breaks network access on the host.

  • 1
    I can also repro the issue from regular configuration if — and only if — I specify the interface card, (ie ip4.addr += "em0|"). To provide IPs only doesn't break network (ip4.addr += ""). To flush routes and reconfigure them works well (or /etc/rc.d/netif restart ; /etc/rc.d/routing restart). – Dereckson Oct 20 '16 at 13:30

net mask is too wide, try

ifconfig hn0 inet alias

Alias must be on same network usually.

  • Thanks, I have just tried it, but unfortunately the result is the same. Moreover, jail creates the alias automatically with a /32 netmask (maybe it can be changed somehow). – LittlePilgrim Dec 5 '15 at 17:56
  • Aliases within the same subnet usually use a /32 netmask. It's documented in ifconfig(8) – Richard Smith Dec 5 '15 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.