# Extra Network Card in a Jail ?



## BeNe (Feb 15, 2011)

Hello together,

We try to build a FreeBSD Server with jails. Our server has 2 network cards (one for the internal link and the second is an external link to the DMZ). So we want to use the external NIC (em1) directly in a jail with a public IP. The em0 for the Internal link is for the host itself.

So how does it work? Should I add the em1 on the host via rc.conf and route it to the jail ? :\ Or can I add the em1 directly in a jail (best solution in my eyes, no route needed)?

Most of the How-Tos around here describe a virtual NIC in a jail, which makes no sense for us because we have an extra NIC for the jail only (linked to the DMZ).

Thanks for any help 

Kind Regards.


----------



## SirDice (Feb 15, 2011)

You don't need to do anything with em1, just bind the jail to that interface.


----------



## BeNe (Feb 15, 2011)

Cool, thanks for you answer. But which way it goes ? 

If done it now like this:
*HostÂ´s rc.conf*

```
...
...
# JAIL
jail_interface="em1"
...
```

*Jail's rc.conf*

```
defaultrouter="93.XXX.YYY.ZZZ"
ifconfig_em1="inet 93.XXX.YYY.ZZZ netmask 255.255.255.240"
```

But I'm unable to ping my gateway or any other IP. Netmask and defaultrouter are correct.


----------



## SirDice (Feb 15, 2011)

You can't set an IP address or a route inside a regular jail. Jail_interface isn't correct either.

Look in /etc/default/rc.conf and the jail(8) man pages for examples.


----------



## jalla (Feb 15, 2011)

You can give your jail a separate routing table using setfib(1)()

See this thread


----------

