Automatic VLAN Assignment (AVA) - Problem with option routers

Simon Hobson dhcp1 at
Thu May 15 11:13:10 UTC 2008

Tarik Gasmi wrote:
>i tried it with two different host-declaration for the same client
>(fixed-address in both subnets), still same effect. router option only
>sent correctly when put in host-declaration "iptel1922-2" ...

Now all becomes clear because this is NOT what you originally posted 
and is a well known and common configuration error ! This is why it's 
important to post the WHOLE config file, not just the bits you 
**think** are important.

># Default VLAN is 1921
># Voip VLAN is 1922
>subnet netmask {
>	option domain-name "msk.privat";
>  	option routers;
>	default-lease-time 900;
>	max-lease-time 900;
>	if substring (option vendor-class-identifier, 0, 11) = 
>"OptiIpPhone" {
>                 option vendor-encapsulated-options
>                 01:07:53:69:65:6D:65:6E:73:   #Siemens
>                 02:04:00:00:07:82:    #VLAN ID 1922 for the Voice VLAN
>                 03:1b:73:64:6c:70:3a:2f:...;   # DLS Server Information
>         }
>	host iptel1921-2 {
>		hardware ethernet 00:01:e3:20:0b:22;
>		fixed-address;
>	}


This host statement is inside a subnet declaration - that is what is 
causing the problem. See more below.

>	#pool {
>	#	range;
>	#}
>subnet netmask {
>	option domain-name "msk-tel.privat";
>  	option routers;
>	default-lease-time 86400;
>	max-lease-time 172800;
>	host iptel1922-2 {
>		hardware ethernet 00:01:e3:20:0b:22;
>		fixed-address;
>		#option routers;   # when uncommented here
>						 # it works !!
>	}

The simple and short explanation is "HOST STATEMENTS ARE GLOBAL". If 
you look back through the archives for that phrase then you'll find 
it's come up 'a few times' in the past. I don't know what version you 
are running, but the latest version now spits out a warning during 
startup when host statements are declared inside a subnet as they 
usually are not what the user wants.

The fuller explanation is that host statements are always global in 
scope, so the one I highlighted WILL be 'valid' wherever the host is 
located on the network. However, they CAN inherit properties from 
where they are defined.

So what is happening is that when your phone connects to the network, the server still picks up the host declaration 
in the subnet. Thus it picks up the routers option from 
that subnet declaration.

It probably also works the other way round as well, but just due to 
the order things happen to be processed in, when the client connects 
to the it just happens to get the right option. It could 
just as easily have been the other way around, with the phone getting 
the wrong routers option on it's initial contact with the DHCP server.

Ie, the host will match both declarations, and pick up both routers 
options, but the server just happens to pick the one you are seeing 
as wrong - probably the last one processed.

The fix is very simple, take the host declarations out of the subnet 
declarations and it will 'just work'.

More information about the dhcp-users mailing list