SSH stops working when I add an IP alias

Hi all,

I have a freebsd FreeBSD client on a Linux host through a bridge. Everything is alright, I can access my client from the host via SSH with DSA keys. Then I progress to the installation of my client and I am at the stage of setting up jails.

When I add an alias on my em0 interface, the SSH connection is lost and I cannot recreate it after having killed the process. In the QEMU window where I have my client, ifconfig shows my interface em0 with the right settings (with the alias). The network looks like it is working since I can ping http://www.google.com.

Code:
# ifconfig em0 inet alias 192.168.99.1 netmask 255.255.255.0
# ifconfig em0
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC>
	ether 02:5a:4b:3c:2d:1e
	inet6 fe80::5a:4bff:fe3c:2d1e%em0 prefixlen 64 scopeid 0x1 
	inet 192.168.99.66 netmask 0xffffff00 broadcast 192.168.99.255
	inet 192.168.99.1 netmask 0xffffff00 broadcast 192.168.99.255
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active

Does someone know the reason why I cannot keep working with the SSH connection please?
 
FreeBSD has different semantics in interface aliases compared to other OSes, from the ifconfig(8) manual page:

Code:
 alias   Establish an additional network address for this interface.  This
             is sometimes useful when changing network numbers, and one wishes
             to accept packets addressed to the old interface.  If the address
             is on the same subnet as the first network address for this
             interface, a non-conflicting netmask must be given.  Usually
             0xffffffff is most appropriate.

You have to add the second address like this:

# ifconfig em0 inet alias 192.168.99.1 netmask 255.255.255.255

Or in rc.conf(5):

Code:
ifconfig_em0_alias0="inet 192.168.99.1 netmask 255.255.255.255"

Or with more modern and convinient and less error prone CIDR notation:

Code:
ifconfig_em0_alias0="inet 192.168.99.1/32"
 
Back
Top