Ow Mun Heng wrote:
> 
> Yes, while those are perfectly valid solutions and I do utilise such a
> solution for me when I switch from Home to Work/Work to Home. (which
> does not cover yet DHCP)
> 
> I'm hoping that there is a better way via a deny script for mac addrs.

Do you reboot when you go from work to home?  If so, have two grub
kernel entries.  Label one entry Home and the other Work.  Have the Home
kernel entry have an extra kernel command line option like so:

title=Gentoo Linux (Home)
root (hd0,0)
kernel /boot/kernel-2.6.15-gentoo-r1 root=/dev/sda1 NO-DHCP
                                  extra boot option ^^^^^^^

Now just modify your /etc/init.d/ script for DHCP to look for NO-DHCP in
/proc/cmdline.  Now you can use grep:


grep NO-DHCP /proc/cmdline
FOUND=$?
if [ $FOUND -eq 0 ]; then
    # NO-DHCP was found in boot cmdline, don't start DHCP
else
    # NO-DHCP was NOT found in boot cmdline, start DHCP
fi


I have never had a need to run a DHCP server so there is probably a way
to do it with DHCP.  However, this is Linux and Linux was made for
tinkering, so use whatever you like best.  : )

Jim
-- 
gentoo-user@gentoo.org mailing list

Reply via email to