[ previous ] [ next ] [ threads ]
 
 From:  Michael Sierchio <kudzu at tenebras dot com>
 To:  Anders Hagman <anders dot hagman at netplex dot se>
 Cc:  m0n0wall at lists dot m0n0 dot ch
 Subject:  Re: [m0n0wall] Alias address and DHCP
 Date:  Thu, 11 Aug 2011 10:05:06 -0700
Hej, Anders -

You might need to make some changes to this.  It goes in /etc/rc.d or
/usr/local/etc/rc.d (more properly).

in /etc/rc.conf you'll need to set dhclient-alias_enable="YES", and
the other variables too

dhclient-alias_if
dhclient-alias_addr
dhclient-alias_mask

- M

#!/bin/sh
#


# PROVIDE: dhclient-alias
# KEYWORD: nojail nostart
# REQUIRE: dhclient

. /etc/rc.subr
. /etc/network.subr

name="dhclient-alias"
start_cmd="dhclient-alias_start"
stop_cmd="dhclient-alias_stop"

dhclient-alias_start()
{
        ifconfig $dhclient-alias_if inet $dhclient-alias_addr netmask
$dhclient-alias_mask alias
}

dhclient-alias_stop()
{
        ifconfig $dhclient-alias_if inet $dhclient-alias_addr -alias
}


load_rc_config $name

dhclient-alias_if=${dhclient-alias_if:-eth0}
dhclient-alias_addr=${dhclient-alias_if:-192.168.0.123}
dhclient-alias_mask=${dhclient-alias_if:-255.255.255.255}

run_rc_command "$1"