passing values to client
Carl Karsten
carl at personnelware.com
Sun Jan 11 17:38:46 UTC 2009
Carl Karsten wrote:
> glad I asked - "site local" was just the right phase to google.
>
> I seem to have it all setup, but I am not seeing the values come over.
Now I do:
$ sudo dhcpdump -i eth0
TIME: 2009-01-11 09:34:23.006
IP: 192.168.1.7 (0:90:27:8e:5f:af) > 192.168.1.253 (0:8:74:ff:13:3)
OP: 2 (BOOTPREPLY)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 0
XID: c117a92e
SECS: 0
FLAGS: 0
CIADDR: 0.0.0.0
YIADDR: 192.168.1.253
SIADDR: 192.168.1.7
GIADDR: 0.0.0.0
CHADDR: 00:08:74:ff:13:03:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: pxelinux.0.
OPTION: 53 ( 1) DHCP message type 5 (DHCPACK)
OPTION: 54 ( 4) Server identifier 192.168.1.7
OPTION: 51 ( 4) IP address leasetime 43200 (12h)
OPTION: 224 ( 3) ??? 737368 ssh
OPTION: 225 ( 13) ??? 69544247776b6248 iTBGwkbH
7a4b44666b zKDfk
OPTION: 1 ( 4) Subnet mask 255.255.255.0
OPTION: 28 ( 4) Broadcast address 192.168.1.255
OPTION: 2 ( 4) Time offset 6 (6s)
OPTION: 3 ( 4) Routers 192.168.1.1
OPTION: 15 ( 17) Domainname personnelware.com
OPTION: 6 ( 4) DNS server 192.168.1.7
OPTION: 12 ( 6) Host name dell30
Now I just need to figure out how to get at them from a dhclient-exit-hooks.d/
script.
Carl K
>
> Now wondering what the best way to debug this is. I have used
> wireshark, but hoping there is something easier.
>
> Simon Hobson wrote:
>> Carl Karsten wrote:
>>> Currently the clonezilla CD will bring up sshd and set a password if
>>> you enter 2 boot parameters.
>>>
>>> I am trying to figure out how to add some code that will get those 2
>>> parameters from the dhcp client. So what is the normal way for an
>>> app to get parameters that were received by dhcpcd or dhclient?
>>
>> I don't know the details as I've never done anything special in the
>> client, but there are three steps involved.
>>
>> First, you will need to configure the server to supply the parameters
>> - in this case, you'll probably have to define "site local" options.
>
> # /etc/dhcp3/dhcpd.conf
> authoritative;
>
> # log using syslogd
> log-facility local7;
>
> option cz-ocs_daemonon code 224 = string;
> option cz-usercrypted code 225 = string;
>
> subnet 192.168.1.0 netmask 255.255.255.0 {
> range 192.168.1.10 192.168.1.254 ;
> filename "pxelinux.0" ;
> option cz-ocs_daemonon "ssh";
> option cz-usercrypted "iTBGwkbHzKDfk";
> }
>
>
>
>>
>> Then you'll need to configure the client to ask for them. This is in
>> the client config file where (IIRC) you can specify a custom option
>> list to be requested.
>
> # /etc/dhcp3/dhclient.conf
>
> option cz-ocs_daemonon code 224 = string;
> option cz-usercrypted code 225 = string;
>
> request cz-ocs_daemonon, cz-usercrypted, (existing options: subnet-mask,
> broadcast-address...)
>
>>
>>
>> Lastly, I assume the client will store what it receives somewhere
>> before calling the client script. If you look at the client, there is
>> a script which does all the processing - so you will probably want to
>> modify that to stash the values where they are easily accessible to
>> your application.
>>
>> In Debian the files are in /etc/dhcp3, and I see that there are two
>> directories dhclient-[enter|exit]-hooks.d which contain scripts that
>> are run by the client on a state change.
>>
>>
>
>
> Sun Jan 11 07:54:54 PST 2009: entering dhclient-exit-hooks.d, dumping
> variables.
> reason='REBOOT'
> cz-ocs_daemonon=''
> cz-usercrypted=''
> interface='eth0'
> medium=''
> alias_ip_address=''
> new_ip_address='192.168.1.253'
> new_subnet_mask='255.255.255.0'
> new_domain_name='personnelware.com'
> new_domain_search=''
> new_domain_name_servers='192.168.1.7'
> new_routers='192.168.1.1'
> new_static_routes=''
> old_ip_address=''
> old_subnet_mask=''
> old_domain_name=''
> old_domain_search=''
> old_domain_name_servers=''
> old_routers=''
> old_static_routes=''
> --------------------------
>
>
>
> _______________________________________________
> dhcp-users mailing list
> dhcp-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/dhcp-users
>
>
More information about the dhcp-users
mailing list