How to specify timezones with DHCP

One thing that can be useful for locations where you have lots of travellers, is to have your DHCP server specify the timezone that people should be using. Some examples might be large conferences, or a busy office building of a multinational company.

While cellphones generally have GPS and cellular networks to tell them where they are, and therefore from there they can guess the correct timezone, laptops usually don't have this luxury.

Fortunately, there are two DHCP options that you can use to tell clients what timezone they should be expecting. These are specified in [RFC4833].

As usual, not many DHCP clients automatically know what to do with these options.

POSIX Timezone specifier

The first option (100) specifies a POSIX Timezone specifier (as documented in POSIX "Base Definitions", section 8 "Environment Variables", under TZ).

The format of this is <name><offset><dst name><dst offset>,<dstrule>

The dstrule is interesting, it specifies the rule for when daylight savings starts and ends.

dstdate[/dsttime],stddate[/stdtime]

dstdate is the date (and optional time) that the change from standard timezone to dst timezone occurs. dsttime if not specified defaults to 02:00:00

stddate is the date (and optional time) that the change from dst timezone to standard timezone occurs. stdtime if not specified defaults to 02:00:00

Some examples:

Some hints:

Timezone Name

The second option (101) specifies a Timezone Name. e.g. "Europe/London" or "Pacific/Auckland".

How to specify this in common DHCP configs:

Using dnsmasq

# Option 100 - POSIX TZ Code
dhcp-option=100,"NZST-12NZDT,M9.5.0/2,M4.1.0/3"
# Option 101 - TCode
dhcp-option=101,"Pacific/Auckland"

Using Junos Apply groups

set groups default-dhcp-attributes routing-instances <*> access address-assignment pool <*> family inet dhcp-attributes option 100 string NZST-12NZDT,M9.5.0/2,M4.1.0/3
set groups default-dhcp-attributes routing-instances <*> access address-assignment pool <*> family inet dhcp-attributes option 101 string Pacific/Auckland

Using ISC DHCP server

option PCode code 100 = text;
option TCode code 101 = text;
option PCode "NZST-12NZDT,M9.5.0/2,M4.1.0/3";
option TCode "Pacific/Auckland";
index