using variable

Pierre LEONARD pier.leonard at free.fr
Tue Mar 21 09:52:53 UTC 2006


hello i'm a french trainee and i work about a dhcp server.
I would like to use variable in order to assign fixed ip via dhcp 
according to the value of this variable.
For the moment i use the simple following syntax : /*v**ariable = 
"value";*/ or */variable = ("value"); /*to set a value in the variable. 
Dhcp server is nice and runs whithout any problem but if I want to use 
the value of the variable the server cannot give an ip to the client!

My second problem is the fact that i would like check 2 conditions 
before assigning value but if i use the following syntax I have an error:

/Mar 21 10:45:12 localhost dhcpd: /etc/dhcp3/dhcpd.conf line 23: illegal 
expression relating different types
Mar 21 10:45:12 localhost dhcpd: if (binary-to-ascii (10, 16, "", 
substring( option agent.circuit-id, 2, 2))= "10
Mar 21 10:45:12 localhost dhcpd: Configuration file errors encountered 
-- exiting/


my syntax:
*
/if (binary-to-ascii (10, 16, "", substring( option agent.circuit-id, 2, 
2))= "10" and binary-to-ascii(16, 8, ":", substring( option 
agent.remote-id, 2, 6)) = "<switch mac address>") {
        test = "ok";
}

class "port21" {
     match if binary-to-ascii (10, 8, "/", suffix (option 
agent.circuit-id, 2)) = "0/20" and test="ok";
}

shared-network 1 {
                subnet 192.168.0.0 netmask 255.255.255.0 {
                authoritative;
                }

                pool {
                        allow members of "port21";
                        range 192.168.0.21;
                }
}

/*thanks for your help


More information about the dhcp-users mailing list