Configure networking outside rc.conf

Chris Cowart ccowart at rescomp.berkeley.edu
Tue May 5 22:54:25 UTC 2009


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
> 
> 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
> - ...
> 
> 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" ?
> 
> 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).

-- 
Chris Cowart
Network Technical Lead
Network & Infrastructure Services, RSSP-IT
UC Berkeley
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-net/attachments/20090505/0daa0376/attachment.pgp


More information about the freebsd-net mailing list