VLAN & DHCP server

Simon Hobson dhcp1 at thehobsons.co.uk
Thu Dec 13 19:02:13 UTC 2007


Alan Hagge wrote:

Firstly, what you proceed to describe has NOTHING TO DO WITH VLANs

I repeat, this is NOTHING TO DO WITH VLANs

It will be exactly the same with two 'ordinary' lan segments. For the 
purposes of considering VLANs, simply think in terms of having 
multiple conventional networks which have (for convenience) been 
rolled up into one. Where a device is attached to a tagged port, then 
think in terms of the device having multiple nics connected to the 
multiple switches (ie one nic & switch port per VLAN). From the OS 
side, instead of having multiple real nics labelled (for example, in 
Linux) eth0, eth1, eth2, etc, you have multiple virtual nics labelled 
(again in Linux) eth0.0, eth0.100, eth0.101, etc.

There are some cases where this isn't quite accurate, but in terms of 
getting your head around what is going it, it should help.

And yes, it took me a little while to get 'comfortable' with this as well !


>All true; however the problem that I've run into is when I want to
>assign fixed addresses to one VLAN interface on a host, while allowing
>others to be pulled from a pool.  I attempted to send this to the list
>on a prior occasion, but apparently it never appeared:
>
>-----
>Our network consists of two VLANs, both served by a single DHCP server
>(with direct connections to both VLANs).  Some of our client machines
>are in one VLAN, some in both.  Some need fixed addresses in one or the
>other VLAN, a few need them in both.  Most need only pooled addresses in
>both.  I need to use DDNS to set hostnames for each IP address. How can
>I set this up?
>
>Here's what I've tried.  In one VLAN (the "primary" LAN), the
>ddns-hostname is set to
>
>   subnet 192.168.1.0 netmask 255.255.255.0 {
>     ddns-hostname = host-decl-name;
>     ...
>   }
>
>while in the other VLAN (the "secondary"), I append to the
>host-decl-name to get the name to send to DNS:
>
>   subnet 192.168.2.0 netmask 255.255.255.0 {
>     ddns-hostname = concat(host-decl-name,"-vlan2");
>     ...
>   }
>
>dhcpd won't let me have more than one "host" section with the same
>hostname, so I've tried various options:
>
>    host myhost        { hardware ethernet 00:01:02:03:04:05; }
>
>works, assigns IP addresses (from pools in both subnets) and updates DNS
>with correct hostnames and IP addresses.
>
>   host myhost        { hardware ethernet 00:01:02:03:04:05;
>fixed-address 192.168.1.10; }
>
>doesn't work.  VLAN1 is assigned correctly (myhost->192.168.1.10), VLAN2
>is assigned an IP address from a pool but not given the specified
>hostname in DNS.  Syslog has "dhcpd: data: host_decl_name: not
>available", indicating that it's not using this host line for the
>MAC-address-to-hostname mapping.

Actually it's working fine ! The fixed address is not in the clients 
subnet, therefore the host statement is not applicable. Since the 
host declaration is not applicable, the host-decl-name is not 
available (it isn't defined).

>   host myhost        { hardware ethernet 00:01:02:03:04:05;
>fixed-address 192.168.2.10; }
>
>doesn't work.  Same as above, but with the VLANs reversed.

Ditto, the server is working as you tell it, it's just that you 
aren't telling it what you want it to do !

>   host myhost        { hardware ethernet 00:01:02:03:04:05;
>fixed-address 192.168.1.10, 192.168.2.10; }
>
>works, assigns IP addresses (to specified fixed addresses) and updates
>DNS with correct hostnames and IP addresses.

Correct

>
>Is there something I'm missing?  Is there some other syntax to use to
>have a single host, with one MAC address, able to be assigned to a
>pooled address in one VLAN and a fixed address in another VLAN?


Simply define two host statements ! Eg :

host myhost-v1 {
   hardware ethernet 00:01:02:03:04:05;
   fixed-address 192.168.1.10;
}
host myhost-v2 {
   hardware ethernet 00:01:02:03:04:05;
}

Declaration myhost-v1 will match if the client is in the 
192.168.1.0/24 subnet (note subnet, NOT VLAN), while host myhost-v2 
will match if the client is anywhere else. Note that the host names 
must be unique, so you cannot have :

host myhost {
   hardware ethernet 00:01:02:03:04:05;
   fixed-address 192.168.1.10;
}
host myhost {
   hardware ethernet 00:01:02:03:04:05;
}


Also, you need to make sure, as I think you've already realised, that 
the hosts will need different DDNS names if you are going to have the 
DDNS working properly.



More information about the dhcp-users mailing list