startup network configuration choice

jhell jhell at DataIX.net
Wed Aug 18 02:12:20 UTC 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/15/2010 08:42, Julian H. Stacey wrote:
> Personally I have this in /etc/rc.conf, 
> 	host="mylap"     ; domain="company.com"
> 	host="mylap"     ; domain="no.net"
> 	host="mylap"     ; domain="home.net"
> 	hostname="$host.$domain"
> 	case $hostname in       #{
> 	        "mylap.home.net")  #{
> 			ifconfig_fxp0="inet 192.168.10.11"
> 			# whatever other things too
> 			;;
> 		"mylap.company.com") 
> 			ifconfig_fxp0="inet 10......
> 			;;
> 			ifco........
> 		"mylap.no.net") 
> 			;;
> 		 esac


This is not a bad configuration but lacks the ability to be booted into
the right environment via a single keystroke or boot into its default.

I was playing around with this idea a while back but do not really have
a need for such a thing at this time as DHCP in most cases that I need
it surfices for a client machine, and servers don't normally move unless
the daemons carry them away. PS: do not let the daemons drink 'Red Bull'.

The files that I was modifying to do just this was /etc/network.subr,
/boot/beastie.4th and ultimately /etc/rc.conf.

/etc/network.subr:
	* This needed the ability to parse kenv(1) for a variable I will call
``network_profile''

network_profile:
	* Initialized to an integer 0, 1, 2, 3. left unset defaulting to 0.

/boot/beastie.4th:
	* Should be modified to contain entries that allow you to set the
network_profile to the values stated above and then boot normally.

/etc/rc.conf:
	* Would contain something similiar to what you have above but to just
look at the value of network_profile and throw your ifconfig and
whatever lines in its respective case statements.


You might be able to set a kenv(1) variable through grub or other
utilities from ports but still some modification would be needed to the
beastie boot menu to allow you to change them dynamically.


Another thought that had come to mind while doing the above was to
create a script in /etc/rc.d that when run with keyword BEFORE NETWORK
would wait for the user to press 1, 2, 3, 4 if network_profiles="YES"
and then source its respective variables from /etc/netprofile.1 .2 .3 .4
and continue on its way through the rest of the configuration after a
predetermined hard coded timeout.

There is a ton of ways that you can go about doing this but the final
approach is up to you as one does not exist in the base system at this time.



Good luck & Regards,

jhell,v

- -- 

 jhell,v
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.16 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMazoiAAoJEJBXh4mJ2FR+fK8IAKAO6NmMTrwmqse9mfCNw53o
NU84VScWVbat97HwSP+7nfPuS9NV/VNI0jjasvNmW4nxXAUF10+Vc/ej683Juwrg
Ds7t6ZaZaGxfYRHB8DFaLHnM38kwQDY+aZB2hU94/jX+OgV6KQainOQ+xjzEUxjj
9CCNHvsUP2XCKAyNhcUq9pMb8bB9QKsd10qAeaWRK2N+RPhXi4Z8IREmIB/i1A4/
nOIcuNmLwJ6qmjzIZBWEN7/WpE9AQy5IB9yu+Qqo10MyVqJWkZRqww9THOaiEv3L
qRFTdQlkpQom0txV+6nA6c75rhd0P1aSlKC0X9U82aue8rQy+RfYESGHLgAoGNQ=
=DFae
-----END PGP SIGNATURE-----


More information about the freebsd-net mailing list