Organize Your DHCP

There's nothing more frustrating than IP address changes on your local network when you have ports forwarded.  Fortunately, if you have a Linux-based router, you can set up 'HOSTS' in your DHCP server and even though the computer or network device may be 'dynamic' the DHCP server will always assign the same IP address to them.

The setting can be found in Webmin->Servers->DHCP Server->Add a new host

After you've set your first host, it's a relatively simple matter to copy the text ( red below - from ISC DHCPd version 3.0 - your settings might differ slightly ) and use it as a template.  Just change the host name, hardware (mac) address, and fixed (ip) address.

When you make changes to your DHCP in WebMin, always make sure you view the config file and copy the changes to your template.

# DO NOT EDIT THIS FILE!  IT IS AUTOGENERATED!
# edit the files in /sa2/templates/etc/dhcpd.conf
# to modify this file, then call /sa/bin/template
ddns-update-style ad-hoc;
default-lease-time 604800;
max-lease-time 604800;

option domain-name "magnia.loc";

subnet 192.168.1.0 netmask 255.255.255.0 {
	authoritative;
	allow client-updates;
	ignore unknown-clients;
	ddns-updates on;
	range 192.168.1.100 192.168.1.149;
	option routers 192.168.1.1;
	option subnet-mask 255.255.255.0;
	option broadcast-address 192.168.1.255;
	option domain-name-servers 192.168.1.1 , 192.168.1.1;
	option netbios-name-servers 192.168.1.1 , 192.168.1.1;


	# comment
	host MOTOROLALR {
		allow client-updates;
		ignore unknown-clients;
		ddns-updates on;
		hardware ethernet 01:A2:B3:C4:5D:E0;
		fixed-address 192.168.1.2;
		}


	}

# END AUTOGENERATED TEMPLATE

You must your changes to /sa2/templates/etc/dhcpd.conf/10base or they will eventually be over-written!

ddns-update-style ad-hoc;
default-lease-time 604800;
max-lease-time 604800;

option domain-name "[% network.domain %]";

[% FOREACH network.interfaces -%]
[% IF network.interfaces.$key.enabled -%]
[% IF network.interfaces.$key.dhcpd_enabled -%]
subnet [% network.interfaces.$key.network %] netmask [% network.interfaces.$key.netmask %]
{
	# These parameters might be overridden in an integration (groupware)
	# setup, but probably not; most likely dhcpd will just be disabled
	authoritative;
	allow client-updates;
	ignore unknown-clients;
	ddns-updates on;
	range [% network.interfaces.$key.dhcpd_start_range %] [% network.interfaces.$key.dhcpd_end_range %];
	[% IF network.interfaces.$key.nat_enabled -%]
	option routers [% network.interfaces.$key.ipaddr %];
	[% ELSE -%]
	option routers [% network.interfaces.$key.gateway ||
			network.interfaces.$key.ipaddr %];
	[% END -%]
	option subnet-mask [% network.interfaces.$key.netmask %];
	option broadcast-address [% network.interfaces.$key.bcast %];
	[%- IF network.interfaces.$key.dns1 %]
		[%- IF network.interfaces.$key.dns2 %]
	option domain-name-servers [% network.interfaces.$key.dns1 %],[% network.interfaces.$key.dns2 %];
		[%- ELSE %]
	option domain-name-servers [% network.interfaces.$key.dns1 %];
		[%- END %]
	[%- ELSE %]
	option domain-name-servers [% network.interfaces.$key.ipaddr %];
	[%- END %]
	[%- IF network.interfaces.$key.wins1 %]
		[%- IF network.interfaces.$key.wins2 %]
	option netbios-name-servers [% network.interfaces.$key.wins1 %],[% network.interfaces.$key.wins2 %];
		[%- ELSE %]
	option netbios-name-servers [% network.interfaces.$key.wins1 %];
		[%- END %]
	[%- ELSE %]
	option netbios-name-servers [% network.interfaces.$key.ipaddr %];
	[%- END %]


	# comment
	host MOTOROLALR {
		allow client-updates;
		ignore unknown-clients;
		ddns-updates on;
		hardware ethernet 01:A2:B3:C4:5D:E0;
		fixed-address 192.168.1.2;
		}


[% END -%]
[% END -%]
[% END -%]

Note:


		allow client-updates;
		ignore unknown-clients;
		ddns-updates on;

These options may be unavailable if you have an older version of DHCP server.

Top