In #FreeBSD you can modularize your config with separate files in /etc/rc.conf.d/ except... for networking? The ifconfig / dhclient settings don't work unless they're in the regular /etc/rc.conf
I need to file a bug about this I guess
In #FreeBSD you can modularize your config with separate files in /etc/rc.conf.d/ except... for networking? The ifconfig / dhclient settings don't work unless they're in the regular /etc/rc.conf
I need to file a bug about this I guess
Dan Langille
in reply to feld • • •Dan Langille
in reply to Dan Langille • • •Yes, I am.
Stuff like this:
ifconfig_vlan32="inet 10.32.32.1 netmask 255.255.255.0 vlan 32 vlandev igc3 description sodden"
feld
in reply to Dan Langille • • •@dvl I put these two lines in /etc/rc.conf.d/network
background_dhclient="YES"
ifconfig_DEFAULT="SYNCDHCP"
They don't get applied on startup of the jail. Not unless I put them in /etc/rc.conf.
Yes, ifconfig_DEFAULT is legit. I learned that recently. I don't know what release it was added, but it saves you from having to customize the interface name for every jail :) (or VM)
Dan Langille
in reply to feld • • •Have you tried this file:
/etc/rc.conf.d/dhclient
I'm guessing based on this:
[23:41 gw01 dvl /etc] % sudo grep -r background * | grep dhclient
grep: motd: No such file or directory
defaults/rc.conf:background_dhclient="NO" # Start dhcp client in the background.
defaults/rc.conf:#background_dhclient_em0="YES" # Start dhcp client on em0 in the background.
rc.d/dhclient: background_dhclient=$(get_if_var $ifn background_dhclient_IF $background_dhclient)
rc.d/dhclient: if checkyesno background_dhclient; then
feld
in reply to Dan Langille • • •@dvl yep, just tried it
# cat /etc/rc.conf.d/dhclient
ifconfig_e0b_DEFAULT="SYNCDHCP"
background_dhclient="YES"
restarted jail, no networking came up.
feld
in reply to feld • • •feld
in reply to feld • • •feld
in reply to feld • • •bottom of /etc/rc.d/netif:
# Load the old "network" config file also for compatibility.
# This is needed for mfsBSD at least.
load_rc_config network
load_rc_config $name
the "legacy" network config is deprecated, you're supposed to put your ifconfig settings in /etc/rc.conf.d/netif. This works. But not with dhclient. Because /etc/rc.d/dhclient only has:
load_rc_config $name
load_rc_config network
it's missing:
load_rc_config netif
this is key.
So in conclusion, there is a change that needs to be made upstream. I'll submit the patch.
You can put dhclient-specific config settings into /etc/rc.d/dhclient if you want, but you can't put any of the ifconfig_* settings in there. You can, however, put all of your network settings right now into /etc/rc.conf.d/network
That's what's going on. Confusion about boundaries, which files are loaded for what purpose, and where these settings should really go.
Today: /etc/rc.conf.d/network is fine for all ifconfig and dhclient related settings
Future: /etc/rc.conf.d/netif is where they really should be
Dan Langille
in reply to feld • • •Is this relevant?
[23:42 gw01 dvl /etc] % grep jail rc.d/dhclient
# KEYWORD: nojailvnet nostart
Also, try adding +x to the top of that script. see what you get in the console.
feld
in reply to Dan Langille • • •@dvl yeah I've been doing full -x debug of all of /etc/rc to see what's going on :)
getting closer
Dan Langille
in reply to Dan Langille • • •feld
in reply to Dan Langille • • •@dvl reviews.freebsd.org/D52175
This explains the situation and has a fix included so dhclient will read /etc/rc.conf.d/netif as one would expect
⚙ D52175 rc.d/dhclient: load values from netif
reviews.freebsd.orgfeld
in reply to feld • • •feld
in reply to feld • • •@dvl ahhhh! ok yes yes it DOES work, but only for the real interface names:
ifconfig_ix0="SYNCDHCP" would work
ifconfig_DEFAULT="SYNCDHCP" does not
super confusing.