# Jails on lagg



## nitin (Sep 23, 2019)

Greetings!

I have FreeBSD12 ZFS server running with two NICs onboard (em0 and igb0) and an additional Intel PCIe dual port ethernet card (igb1 and igb2). igb0 is the WAN and igb1 is LAN with a few Jails running off a cloned interface on igb1. The Jails are on a different subnet to that of the LAN interface igb1.

Now, I was wondering if I could create two separate lagg interfaces as in lagg0 (igb1+em0) and lagg1(igb0+igb2) and the Jails running off lagg1. As this is the first time I am configuring a lagg interface, I am a bit diffident... Will the following rc.conf work fine:

```
ifconfig_igb1="up"
ifconfig_em0="up" 
cloned_interfaces="lagg0"
ifconfig_lagg0="laggproto failover laggport igb1 laggport em0 <WAN IP>/24" 
ifconfig_igb0="up" 
ifconfig_igb2="up"
cloned_interfaces="lagg1"
ifconfig_lagg1="laggproto failover laggport igb0 laggport igb2 <LAN IP>/24" 
cloned_interfaces="lo1"
ifconfig_lo1="inet <JAIL SUBNET IP1>/32"
ifconfig_lo1_alias0="inet <JAIL SUBNET IP2>/32" #jail1
ifconfig_lo1_alias1="inet <JAIL SUBNET IP2>/32" #jail2
```
I tried lagg0 first but it didn't seem to work. After running:
service netif restart and service routing restart
I couldn't ping the WAN IP and ifconfig didn't show up the WAN IP on either em0 or igb1. I would presume lagg0 should show up but it wasn't... do I need to restart the server? I guess I have to... for if_lagg_load="YES" in loader.conf to take effect.

Also, will the jails run fine on lagg1 as per my config above if I restart.

Kindly help. Thanks in advance.

- Nitin


----------



## SirDice (Sep 23, 2019)

This doesn't work:

```
cloned_interfaces="lagg0"
cloned_interfaces="lagg1"
cloned_interfaces="lo1"
```
You need to realize things in rc.conf are variables, not commands.
Consider this:

```
#!/bin/sh

test="foo"
test="bar"

echo $test
```
What will this script output?


To correct this you need to use this:

```
cloned_interfaces="lagg0 lagg1 lo1"
```


----------



## nitin (Sep 23, 2019)

SirDice said:


> You need to realize things in rc.conf are variables, not commands.
> 
> To correct this you need to use this:
> 
> ...



Thank you SirDice.. as usual you are a star! To be honest, I didn't know that but I am glad I learnt something today. Everything is working perfectly now


----------

