# Issues with WiFi aliases and connectivity



## Rand0m (Apr 1, 2017)

Hi all,
I have a set network aliases in /etc/rc.conf to use them in my jails.


```
# Adding alias for wlan0 for jails
ifconfig_wlan0_alias0="inet 192.168.0.100 netmask 0xffffff00 broadcast 192.168.0.255"
ifconfig_wlan0_alias1="inet 192.168.0.101 netmask 0xffffff00 broadcast 192.168.0.255"
ifconfig_wlan0_alias2="inet 192.168.0.102 netmask 0xffffff00 broadcast 192.168.0.255"
ifconfig_wlan0_alias3="inet 192.168.0.103 netmask 0xffffff00 broadcast 192.168.0.255"
ifconfig_wlan0_alias4="inet 192.168.0.104 netmask 0xffffff00 broadcast 192.168.0.255"
ifconfig_wlan0_alias5="inet 192.168.0.105 netmask 0xffffff00 broadcast 192.168.0.255"
```

when I start my desktop sometimes it doesn't create all the aliases (few of them will be missing) and consequently some of the jails won't have network.

I usually restart my wlan0 `service netif restart wlan0`. And when I do that all the alias will be loaded correctly but will wlan0 won't connect to the SSID.


```
~ % ifconfig -a
msk0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=c019b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,VLAN_HWTSO,LINKSTATE>
    ether 00:1d:72:f0:48:dc
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: Ethernet autoselect
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    inet 127.0.0.1 netmask 0xff000000
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
    groups: lo
wlan0: flags=8c43<UP,BROADCAST,RUNNING,OACTIVE,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 00:21:6b:51:73:20
    inet 192.168.0.100 netmask 0xffffff00 broadcast 192.168.0.255
    inet 192.168.0.101 netmask 0xffffff00 broadcast 192.168.0.255
    inet 192.168.0.102 netmask 0xffffff00 broadcast 192.168.0.255
    inet 192.168.0.103 netmask 0xffffff00 broadcast 192.168.0.255
    inet 192.168.0.104 netmask 0xffffff00 broadcast 192.168.0.255
    inet 192.168.0.105 netmask 0xffffff00 broadcast 192.168.0.255
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
    status: no carrier
    ssid "" channel 157 (5785 MHz 11a)
    regdomain FCC country US authmode WPA1+WPA2/802.11i privacy MIXED
    deftxkey UNDEF txpower 23 bmiss 10 mcastrate 6 mgmtrate 6 scanvalid 60
    wme roaming MANUAL bintval 0
    groups: wlan
```

As you see all the aliases are there but the SSID comes as "" and the router IP 192.168.0.16 is missing.
I tried to check the dhclient

```
:~ % sudo dhclient wlan0
wlan0: no link .............. giving up
```
I tried using ifconfig to set manually the ssid and the IP they will show up but still won't have internet.

Eventually I have to disable the aliases in rc.conf and restart wlan0 to have the internet back (connection to the router). No matter how much I try it doesn't work... Any help will be appreciated.


----------



## SirDice (Apr 3, 2017)

You can remove the aliases from the interface and add the IP to the jail's configuration. That way the IP will be dynamically added/removed when you start/stop the jail.


----------



## Rand0m (Apr 3, 2017)

Thanks, well I am using ezjail to manage my jails and checking the configuration in /usr/local/etc/ezjail/source_jail for example;  I can see the IPs are there

```
% cat /usr/local/etc/ezjail/source_jail
# To specify the start up order of your ezjails, use these lines to
# create a Jail dependency tree. See rcorder(8) for more details.
#
# PROVIDE: standard_ezjail
# REQUIRE:
# BEFORE:
#

export jail_source_jail_hostname="source.jail"
export jail_source_jail_ip="192.168.0.102"
export jail_source_jail_rootdir="/usr/jails/source.jail"
export jail_source_jail_exec_start="/bin/sh /etc/rc"
export jail_source_jail_exec_stop=""
export jail_source_jail_mount_enable="YES"
export jail_source_jail_devfs_enable="YES"
export jail_source_jail_devfs_ruleset="devfsrules_jail"
export jail_source_jail_procfs_enable="YES"
export jail_source_jail_fdescfs_enable="YES"
export jail_source_jail_image=""
export jail_source_jail_imagetype=""
export jail_source_jail_attachparams=""
export jail_source_jail_attachblocking=""
export jail_source_jail_forceblocking=""
export jail_source_jail_zfs_datasets=""
export jail_source_jail_cpuset=""
export jail_source_jail_fib=""
export jail_source_jail_parentzfs=""
export jail_source_jail_parameters="allow.raw_sockets=1"
export jail_source_jail_post_start_script=""
export jail_source_jail_retention_policy=""
```

yet when it is not set as alias in the interface my jail will be offline


----------



## SirDice (Apr 3, 2017)

Add the interface:

```
export jail_source_jail_ip="wlan0|192.168.0.102"
```


----------



## Rand0m (Apr 3, 2017)

Brilliant.... thanks so much. This solved the issue and another issue I have with the jails.
Cheers


----------

