# Howto configure an ip_alias into a vnet-jail



## Gavilaan (Sep 11, 2020)

Hi,
i have a host running with 2 ip addresses on one interface and multiple jails. For this i use the cloned lo1 interface and the jails are accessed with pf/rdr rules. Everything is fine. But one software refused to bind to a loopback interface. so i started testing with vnet and this will work for the software. But now i have another problem: The ip-address from the aliased interface is attached directly to one jail via

```
/etc/jail.conf
test {
    host.hostname = "${name}";
    ip4.addr  = "lo1|127.0.1.1/32";
    ip4.addr += "em0|x.x.x.x/29";
}
```

How do i add the same funktionality to my vnet-jail?

```
/etc/jail.conf
test2 {
    host.hostname = "${name}";

    $id     = "30";
    $ipaddr = "10.0.0.${id}";
    $mask   = "255.255.255.0";
    $gw     = "10.0.0.1";
    vnet;
    vnet.interface = "epair${id}b";

    exec.prestart   = "ifconfig epair${id} create up";
    exec.prestart  += "ifconfig epair${id}a up descr vnet-${name}";
    exec.prestart  += "ifconfig bridge0 addm epair${id}a up";

    exec.start      = "/sbin/ifconfig lo0 127.0.0.1 up";
    exec.start     += "/sbin/ifconfig epair${id}b ${ipaddr} netmask ${mask} up";
    exec.start     += "/sbin/route add default ${gw}";
    exec.start     += "/bin/sh /etc/rc";

    exec.prestop    = "ifconfig epair${id}b -vnet ${name}";

    exec.poststop   = "ifconfig bridge0 deletem epair${id}a";
    exec.poststop  += "ifconfig epair${id}a destroy";

    persist;
}
```

I've searched a lot, tried a lot but nothing works.
Thanks
Gav


----------

