From owner-freebsd-questions Sat Oct 10 17:57:32 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id RAA23247 for freebsd-questions-outgoing; Sat, 10 Oct 1998 17:57:32 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from ns1.guate.net (ns1.guate.net [200.12.63.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id RAA23242 for ; Sat, 10 Oct 1998 17:57:29 -0700 (PDT) (envelope-from obonilla@guate.net) Received: from ns.guate.net (ns.guate.net [200.12.63.25]) by ns1.guate.net (8.9.1/8.9.1) with ESMTP id SAA24523; Sat, 10 Oct 1998 18:57:25 -0600 Received: from guate.net (pm3b-s22.guate.net [200.12.62.184]) by ns.guate.net (8.9.1/8.9.1) with ESMTP id SAA20203; Sat, 10 Oct 1998 18:57:14 -0600 (MDT) Message-ID: <36200184.E84181D3@guate.net> Date: Sat, 10 Oct 1998 18:53:24 -0600 From: Oscar Bonilla X-Mailer: Mozilla 4.5b1 [en] (X11; I; FreeBSD 2.2.6-RELEASE i386) X-Accept-Language: en MIME-Version: 1.0 To: bernt@usa.net CC: freebsd-questions@FreeBSD.ORG Subject: setting up dhcp Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG first of all you have to install the client from the pkgs what i have is : isc-dhcp-1.0.0 the client is installed in /usr/local/sbin/dhclient that's the command you'll have to run... but not yet!! first you have to create some files in /etc edit /etc/dhclient.conf and fill it whith something like this: ----------------------------------------- interface "XXXX" { request subnet-mask, routers, domain-name, domain-name-servers, host-name; require subnet-mask, domain-name-servers, routers; script "/etc/dhclient-script"; } ------------------------------------------ where XXXX is the name of your network interface (ed0 for example) the request line is what you ask to the dhcp server to give you. the require line says the minimum you will accept, and the script line tells dhclient which script to call when configuring this interface. next you have to create /etc/dhclient-script and fill it whith something like this: ---------------------------- #!/bin/sh case $reason in 'PREINIT') ifconfig $interface netmask 255.255.255.255 up echo "dhcp preinit" >/dev/console ;; 'BOUND') ifconfig $interface delete ifconfig $interface $new_ip_address netmask $new_subnet_mask up route add default $new_routers echo "domain $new_domain_name" >/etc/resolv.conf echo $new_domain_name_servers | sed 's/ /\ /g' | awk '{print "nameserver " $1}' >>/etc/resolv.conf echo "dhcp bound" >/dev/console ;; 'REBIND') ifconfig $interface delete ifconfig $interface $new_ip_address netmask $new_subnet_mask up route add default $new_routers echo "domain $new_domain_name" >/etc/resolv.conf echo $new_domain_name_servers | sed 's/ /\ /g' | awk '{print "nameserver " $1}' >>/etc/resolv.conf echo "dhcp rebound" >/dev/console ;; 'REBOOT') ifconfig $interface delete ifconfig $interface $new_ip_address netmask $new_subnet_mask up route add default $new_routers echo "domain $new_domain_name" >/etc/resolv.conf echo $new_domain_name_servers | sed 's/ /\ /g' | awk '{print "nameserver " $1}' >>/etc/resolv.conf echo "dhcp reboot" >/dev/console ;; *) echo $reason: unhandled >/dev/console ;; esac ---------------------------------------------------- note that i only handle a bunch of responses. if you want to handle'em all read the man page for dhclient now you should be able to just run /usr/local/sbin/dhclient and watch the console for messages concerning the dhcp protocol one last thing. the dhclient puts the net interface in promiscuos mode to get the responses (since it doesn't have an ip address at this stage) so you have to enable the bpf in the kernel for dhclient to work regards, -oscar To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message