Giving Jails a static IP

I’m trying to understand how I can make jails have a fixed IP, and be able to have them communicate between eachother (my usecase being one jail having an apache server, and providing reverse proxying for services running in other jails).

The problem I’m running into is that the jails (which have both NAT and VNET enabled) can ping and generally interact with one another, but their IPs randomly change.

I’ve tried disabling NAT and just keeping VNET enabled, but then the jails can’t ping eachother.

What’s the best way to fix this?

You need to disable NAT, assign an IP, turn on vnet, and also add your default gateway.

Can you share a screenshot of your jail network settings?

1 Like

Turn off NAT. Set a static IP address in the same subnet /24 on each jail.IPV4 interface to vnet0, probably, common for the jais. Set a default router IP.
This works for me.
You can only edit a jail when it is stopped.

Okay, yeah, I must’ve been doing something wrong last time I tested, now I can actually ping the other jail if I set both up like that.

Let’s say I have jail A and jail B.
-If both have NAT disabled, they can ping eachother, but can’t reach the internet.
-If both have NAT enabled, they can ping eachother and reach the internet, but the IPs change.
-If one has NAT enabled and one has NAT disabled, they can’t ping eachother.

How can I make it so they still have internet access if NAT is disabled?

Here’s the settings for the Apache jail:

And for the other one:

First off, don’t use 13.3 release just yet. There are some breaking changes in 13.3 that won’t work on the current TrueNAS train. Use 13.2

Next, is your default gateway and dns server set in the TrueNAS main network settings? You can find this under Network > Global Configuration

Yeah, I know about the 13.3 bugs - I ran into it and just updated to nightly to fix it.

Here’s the global config (obviously [redacted] is just a placeholder for the actual domain):

Your default gateway here is different than in your jails. Edit your jails and input an IP that is in the same subnet, and edit your jail default gateway to read the same as the screenshot above.

The 172.x.x.x IP is only necessary when using NAT. If you use VNET, your jails are essentially part of your local network, and need to have an IP within that network. They also need to be set to the same gateway as your local network.

1 Like

Okay, NOW I get it. Thank you very much. That explanation was the part I was missing.