# FreeBSD jail with VLAN - possible?



## donduq (Dec 19, 2012)

I would like to do the following on my FreeBSD 9.1 server:

The host's re0 interface is connected to a managed switch and configured as a trunk port.

The host itself should be in VLAN 10 and get its IP address from a DHCP server.

Then I have a couple of jails. Those should be in VLAN 20 and also get their IPs via DHCP.

Is this possible and if yes then how? 

In the past I have used VIMAGE and the method described on http://druidbsd.sourceforge.net/vimage.shtml.


----------



## Crest (Dec 19, 2012)

You could use ng_bridge and ng_eiface to create the virtual interfaces and run a DHCP client on each interface in the host. The jails could be started with setfib if their routing tables should conflict with the hosts. I can provide the rc script for this setup if you want to try it.


----------



## bbzz (Dec 19, 2012)

Yes, vlan(4)
Along the lines of 

```
ifconfig vlan0 create
ifconfig vlan0 vlan 100 vlandev bge0
```

That's one vlan.


----------



## donduq (Dec 19, 2012)

Crest said:
			
		

> You could use ng_bridge and ng_eiface to create the virtual interfaces and run a DHCP client on each interface in the host. The jails could be started with setfib if their routing tables should conflict with the hosts. I can provide the rc script for this setup if you want to try it.



That's an offer I can't refuse. So please, by all means


----------

