# Ifconfig and jails



## fuhdan (Sep 13, 2012)

Hi
I have a base system with 3 Jails configured. 
The main system has the ip 192.168.40.20
Jail1 has 192.168.40.21
Jail2 has 192.168.40.22
Jail3 has 192.168.40.40

All systems are connected to a windows domain with samba36

If I check now the DNS entries, the main system has all IP Addresses registered on the DNS. How can I prevent the main system to register the alias IP Addresses?

/etc/rc.conf

```
hostname="main.domain.com"
ifconfig_em0="inet 192.168.40.20  netmask 255.255.255.0"
ifconfig_em0_alias0="inet 192.168.40.21  netmask 255.255.255.0"      # Interface jail1
ifconfig_em0_alias1="inet 192.168.40.22  netmask 255.255.255.0"      # Interface jail2
ifconfig_em0_alias1="inet 192.168.40.40  netmask 255.255.255.0"      # Interface jail3

# main jail config
jail_enable="YES"
jail_set_hostname_allow="NO"
jail_list="jail1 jail2 jail3"

# jail1 config
jail_jail1_hostname="jail1.domain.com"
jail_jail1_ip="192.168.40.21"
jail_jail1_rootdir="/usr/jails/jail1"
jail_jail1_devfs_enable="YES"

# jail2 config
jail_jail2_hostname="jail2.domain.com"
jail_jail2_ip="192.168.40.22"
jail_jail2_rootdir="/usr/jails/jail2"
jail_jail2_devfs_enable="YES"

# jail3 config
jail_jail3_hostname="jail3.domain.com"
jail_jail3_ip="192.168.40.40"
jail_jail3_rootdir="/usr/jails/jail3"
jail_jail3_devfs_enable="YES"
```


```
nslookup main.domain.com
Server:		192.168.40.10
Address:	192.168.40.10#53

Name:	main.domain.com
Address: 192.168.40.40
Name:	main.domain.com
Address: 192.168.40.21
Name:	main.domain.com
Address: 192.168.40.22
Name:	main.domain.com
Address: 192.168.40.20
```


----------



## SirDice (Sep 13, 2012)

Remove the ifconfig_em0_alias* entries, they are not needed if you have jail_*_ip.



> How can I prevent the main system to register the alias IP Addresses?


Configure your DNS server, the entries aren't "magically" added.


----------



## fuhdan (Sep 13, 2012)

> Remove the ifconfig_em0_alias* entries, they are not needed if you have jail_*_ip.



Then the jails don't have an IP:

```
JID  IP Address      Hostname                      Path
     1  192.168.40.40   jail1.danielf.ch          /usr/jails/jail1
     2  192.168.40.21   jail2.danielf.ch          /usr/jails/jail2
     3  192.168.40.22   jail3.danielf.ch          /usr/jails/jail3
```

But on the jail:

```
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
	ether 00:0c:29:8b:4c:b0
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
	options=3<RXCSUM,TXCSUM>
```

Even if I add ifconfig_em0="inet 192.168.40.21  netmask 255.255.255.0" to the rc.conf on the jail


----------



## SirDice (Sep 13, 2012)

You may need to add jail_*_interface="em0" to bind it to the correct interface.


----------

