# No network interfaces inside jail



## johanhedberg (Nov 4, 2012)

I have setup a FreeBSD 9 server with a jail. When I enter my new jail it doesn't have any network interfaces available. ifconfig gives no output at all and trying to start any services which uses networking results in a failure. The jail was created in accordance to the handbook by using the following commands.


```
# cd /usr/src
# make buildworld
# make installworld DESTDIR=/storage/ntp
# make distribution DESTDIR=/storage/ntp
# mount -t devfs devfs /storage/ntp/dev
# cp /etc/resolv.conf /storage/ntp/etc/resolv.conf
# cp /etc/localtime /storage/ntp/etc/localtime
# /etc/rc.d/jail start
```

/etc/rc.conf:

```
hostname="jh5.mydomain.com"
keymap="swedish.iso.kbd"
defaultrouter="91.xxx.yyy.1"
ifconfig_bge0="inet 91.xxx.yyy.55 netmask 255.255.255.192"
ifconfig_bge0_alias0="inet 91.xxx.yyy.52 netmask 255.255.255.192"
jail_enable="YES"
jail_list="ntp"
jail_ntp_rootdir="/storage/ntp"
jail_ntp_hostname="ntp.mydomain.com"
jail_ntp_ip="91.xxx.yyy.52"
jail_ntp_devfs_enable="YES"
```

/etc/sysctl.conf:

```
security.jail.enforce_statfs=2
security.jail.mount_allowed=1
security.jail.set_hostname_allowed=1
security.jail.socket_unixiproute_only=1
security.jail.chflags_allowed=1
security.jail.sysvipc_allowed=1
security.jail.allow_raw_sockets=1
```

A session in the jail to show the issue:

```
jh5# jls
   JID  IP Address      Hostname                      Path
     2  91.xxx.yyy.52   ntp.mydomain.com    /storage/ntp
jh5# jexec 2 tcsh
root@ntp:/ # ifconfig -a
root@ntp:/ # ntpd -n
/usr/src/usr.sbin/ntp/libntp/../../../contrib/ntp/libisc/ifiter_getifaddrs.c:106: INSIST(ifa != ((void *)0)) failed.
Abort (core dumped)
```

I have another server with about the same configuration where it works. The only configuration difference that I can see between the two are other IP addresses and hostnames. Both are running FreeBSD 9 amd64 and live in the same subnet.


----------



## SirDice (Nov 5, 2012)

Remove this one:

```
ifconfig_bge0_alias0="inet 91.xxx.yyy.52 netmask 255.255.255.192"
```

It's already covered with this:

```
jail_ntp_ip="91.xxx.yyy.52"
```

You might want to add:

```
jail_ntp_interface="bge0"
```


----------



## johanhedberg (Nov 6, 2012)

I've changed configuration and rebooted. The issue is still the same. The strange thing is that I can ping external hosts. I can even ssh to and fetch from external hosts.

But ifconfig still shows no output at all, and while testing to start ntpd the getifaddrs call still fails.


----------



## gkontos (Nov 6, 2012)

Try adding the interface in the jail configuration:


```
jail_list="ntp"
jail_ntp_rootdir="/storage/ntp"
jail_ntp_hostname="ntp.mydomain.com"
[B]jail_ntp_interface="bge0"[/B]
jail_ntp_ip="91.xxx.yyy.52"
jail_ntp_devfs_enable="YES"
jail_ntp_interface="em0"
```


----------



## johanhedberg (Nov 11, 2012)

I already added the interface per advice from SirDice. It doesn't work either. I don't think it has to do with configuration since it works on other boxes. I'm starting to think it's some kind of a bug. I've tried re-fetching my source tree and rebuilt my jails to see if that fixed it, but no luck there either.


----------

