Assigning default gateway on jail startup.

Cd228

Dabbler
Joined
Sep 14, 2018
Messages
21
Hey.

I am trying to setup a default gateway in my jail.
I can do this by simply typing
Code:
route change default xx.xx.xx.xx


On reboot it resets, so I tried adding then following line in the /etc/rc.conf file:
Code:
defaultrouter="xx.xx.xx.xx"


When I reboot the jail, it is still the old ip-address.
If I use the following code after booting:
Code:
/etc/rc.d/routing restart

it updates to the new IP-address. However, after restarting it resets back to the old ip-address

How can I make it happen each time I boot the jail?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
1596141365574.png
 

Apollo

Wizard
Joined
Jun 13, 2013
Messages
1,458
Normally, any changes done to the jail need to be done when the jail is off.

In your case you can use the CLI with the following command executed outside the jail:

iocage set defaultrouter="xx.xx.xx.xx" your_jail
 

Cd228

Dabbler
Joined
Sep 14, 2018
Messages
21
Normally, any changes done to the jail need to be done when the jail is off.

In your case you can use the CLI with the following command executed outside the jail:

iocage set defaultrouter="xx.xx.xx.xx" your_jail

When I use this outside the jail it states:
Property: defaulter router has been updated to xx.xx.xx.xx
But when I start the jail, it stil has the standard gateway.
 

Cd228

Dabbler
Joined
Sep 14, 2018
Messages
21
Shouldn't the content of the /etc/rc.conf run on startup? Or have I misunderstood something?
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
How are you addressing the jail in the first place?
 

Cd228

Dabbler
Joined
Sep 14, 2018
Messages
21
in my case it is a plex jail.
In the above example I wrote:
iocage set defaultrouter="xx.xx.xx.xx" plex
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Please screenshot the Basic Properties tab of the jail.
 

Samuel Tai

Never underestimate your own stupidity
Moderator
Joined
Apr 24, 2020
Messages
5,399
Set a net mask.
 

Cd228

Dabbler
Joined
Sep 14, 2018
Messages
21
I cannot get this to work either. I set the netmask to 24.
I have tried all ipv4 interfaces, and non assigns the correct default router
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
DHCP is set active ???
 

Cd228

Dabbler
Joined
Sep 14, 2018
Messages
21
I have also tried with it manually configured.
I would prefer if I could use DHCP.

Is there a way to simply run the rc file on boot? When I restart the routing using the command:
Code:
/etc/rc.d/routing restart


it updates with the correct default gateway. But why doesn't it do this on boot?
 
Top