[nycbug-talk] fave BSD tips/tricks?
Yarema
yds at CoolRat.org
Thu Sep 3 16:51:55 EDT 2009
Dru Lavigne wrote:
>
> I'm finishing up an article for BSD mag on BSD tips and tricks. Anyone
> have a favourite tip or trick they'd like to see in this article?
Too late for the article, I know.. But one of my favorite "tricks" for
configuring network interfaces on FreeBSD is to rename the interfaces.
Something like this (taken from my home server):
ifconfig_sk0_name="wan0"
ifconfig_re0_name="lan0"
ifconfig_wan0="DHCP polling"
ifconfig_lan0="polling"
ipv4_addrs_lan0="192.168.1.1-2/24"
dhcpd_ifaces="lan0"
... &c. &c.
The upside is that I no longer have to worry that pf.conf will break
because I no longer need to use the
ext_if = "sk0"
int_if = "re0"
convention. I don't even define the (ex|in)t_if macros. Instead I just
refer to the interfaces by their new names in all the rules. And if
appropriate I can copy pf.conf from one machine to another and I know
it'll work even if the drivers are different.
This leaves only one place where the driver name is referenced, the
rename variable. No more search & replace across multiple files if I
swap interface cards or motherboards and the like.
Before I started using this trick I'd invariably forget to change it
somewhere and then I'd be wondering why dhcpd or somesuch is no longer
working with my new hardware. :)
Here's another example from one of my carped firewall boxen:
cloned_interfaces="carp0 carp1 carp2"
ifconfig_re0_name="wan0"
ifconfig_re1_name="lan0"
ifconfig_re2_name="lan1"
ifconfig_vr0_name="sync0"
ifconfig_wan0="polling"
ifconfig_lan0="polling"
ifconfig_lan1="polling"
ifconfig_sync0="polling"
pfsync_enable="YES" # Expose pf state to other hosts for syncing
pfsync_syncdev="sync0" # Interface for pfsync to work through
Makes the output of `ifconfig -a` much more sensible too..
--
Yarema
More information about the talk
mailing list