Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 May 2009 15:54:25 -0700
From:      Chris Cowart <ccowart@rescomp.berkeley.edu>
To:        Giulio Ferro <auryn@zirakzigil.org>
Cc:        freebsd-net@freebsd.org
Subject:   Re: Configure networking outside rc.conf
Message-ID:  <20090505225425.GA49013@hal.rescomp.berkeley.edu>
In-Reply-To: <4A00BE6C.5030800@zirakzigil.org>
References:  <4A00BE6C.5030800@zirakzigil.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--PEIAKu/WMn1b1Hv9
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Giulio Ferro wrote:
> I was wondering if there was a way to cleanly configure networking
> without using rc.conf but only ifconfig and other utilities
>=20
> This is what I mean: let's suppose that I have a complex network
> configuration to launch on my machine, for example:
> - many physical nics (with different speed, mtu, duplex...)
> - many aliases on them
> - many vlans
> - many carped interfaces
> - ng_fec
> - ...
>=20
> What I ask is: can I, set up networking in a way that is equivalent to
> creating the configuration in /etc/rc.conf and then using
> "/etc/rc.d/netif restart" ?
>=20
> I know how to set up the example configuration above, what I
> don't know is if I can do that cleanly, that is, cleaning the state of
> all interfaces, truncating vlans, etc., and then creating them again
> with ifconfig, ngctl, etc.

Assuming the NICs are displayed by ifconfig -a or inserted into
cloned_interfaces in /etc/rc.conf, you can create the following scripts:

/etc/start_if.vlan100
/etc/stop_if.vlan100

Where start_if.vlan100 is sourced by the netif start and stop_if.vlan100
is sourced by the netif stop.

For example:

| ccowart dev-aux etc $ cat /etc/start_if.vlan81
| ifconfig vlan81 vlan 81 vlandev em0
| ifconfig vlan81 inet 10.81.1.1/16

I don't know that two files per interface is any cleaner than a really
long /etc/rc.conf (I usually prefer the latter, but I generally am not
dealing with more than 20-40 lines at most).

--=20
Chris Cowart
Network Technical Lead
Network & Infrastructure Services, RSSP-IT
UC Berkeley

--PEIAKu/WMn1b1Hv9
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (FreeBSD)

iQIcBAEBAwAGBQJKAMOgAAoJEIGh6j3cHUNPygQQAK2uqpQnSulGtFFi0O95J/eT
qkV2yF1k6RLucmx2+bmYQWh7D95eAW5NUMP4klAzLh+X8+tYAKCStwY1+qB1PCeo
1AkOqvDpjHz+CEjEQlKKZ6ukamM1BCtcc3Alg3D1TSFQO4KS1jXEdnR+/rg769bc
DjY7p6W2t/bagUrenxfCRGew2JvMh0X4G/oPpHuSjYC2DkNceJsGq0lEI0+/bc4t
rWrXUKSdJsx3naJxUWZcfNN5sgUNd4AQHSQR6NTM4iqkUaTzNx4bt+PrzMz5m2I9
3X53Am1V+cAY5cdPbld4/f4wge8lFrVctjv6feyWDMNbI0RPjX3JjCwVNxpjt86z
FsuWPTdfqvtIcwzC/zHxfdJID3+rky+6CbSOhABqcSAWSsb2+u7wTCRmY9lkHe8m
nB6s3M1+pJJ3au0OzKXG5JxzRBpIbgPDLXkpTzEPPKTcSOghx1ZuwHeJNcFY/aSB
cEcq/2iADEF2Bhwarja2FWsV9m36f5cw5NHdqWWSd7sqNZ29wx6wa48m1yKQRuy5
Esm5Sq66YBfq3nNUYmc8DKnWdOPiv3BZzsN+FiOh2haEnfL4g4BiCQ4sxHjjhckO
yFHTxrReW1R+zW0KgRlkXdBiJYmuLFJknSaq5K9VXWWmZ1spy+V1S5iZyhLXhXgS
Pf85NH1WLyrOAf/HisXT
=kMQW
-----END PGP SIGNATURE-----

--PEIAKu/WMn1b1Hv9--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090505225425.GA49013>