DHCP Setup

From StarOS Community Wiki
Revision as of 22:51, 25 November 2006 by Tog (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

To setup DHCP, goto System -> Services -> ISC DHCP Server -> Modify Configuration File

General Setup

There are a few variables that need to be set in all DHCP setups. Not doing so could result in the user having limited, sporatic, or no connectivity due to DNS, or other problems. I'll cover the options set by default in Star-OS, and what they do/mean.

option domain-name "mydomain.com";

This option just sets the "Domain Suffix" in windows to whatever you put here. In linux/BSD it sets the "domain" variable in /etc/resolv.conf to this. Most applications will suffix this to an invalid url. Ie, if you goto www with that, it'll try www.mydomain.com.

domain-name-servers 192.168.1.254, 192.168.1.253;

This tells the DHCP server what DNS servers to assign users. You can put more in there, but from my experience more than 3 is pushing it. Windows 95/98 seems to have issues with anything past the first one, and I've had mixed results with >3 servers. Linux/BSD are fine with more. To add more, just put a comma after the last ip and make sure the semi-colon is last. Ie, if you wanted to add a few more servers it would look like:

domain-name-servers 192.168.1.254, 192.168.1.253, 192.168.200.49, 192.168.2.34;


ddns-update-style none;

I can't really think of a good way to describe this, other than it's used for dynamically updating DNS entries when the client gets a new ip address. Most people won't need/want to change this.

default-lease-time 600;
max-lease-time 7200;

In seconds, what the default lease time and maximum lease time is for a computer to have an IP Address. After this time, the computer releases the IP it's been assigned and requests a new one from the DHCP server. It's pretty safe to set this pretty high, say in the 12-24 hour range. I'd avoid setting it too high as some DHCP implementations (Old Windows for example) have a nasty tendancy to break if set too high. Also, most of the time the IP won't change through the lease renewal process, so there's no real impact on connectivity.

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

The comments pretty well describe this. If you want to have more than one DHCP server, that can be covered in a different section. But for now, leave that as it is.

Dynamic DHCP

This is probably the most common setup you'll encounter. By default, there are a few examples in Star-OS for you to use.

What you need do is go into the configuration file, and delete everything after the following text:

# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.

After that, you need to put this in there:

# Subnet with a range of dynamic IPs (150 IPs assigned)
subnet 192.168.123.0 netmask 255.255.255.0 {
 range 192.168.123.50 192.168.123.200;
 option routers 192.168.123.1;
}

Make sure to change the 192.168.123 number to whatever you've assigned on the interface you wish to give out ip addresses. Also note that this will only hand out IP addresses from .50 to .200. Most of the time the server will start from the top of the range, and hand out 200 first, and then work it's way down to 50.

I'd suggest leaving this as-is. The first and last 50 IP addresses tend to be used by various devices for various reasons, with .1 and .254 being the most common.

Static DHCP Assignments

This section will cover basic static DHCP assignments using the ISC DHCP built-in to StarOS

# To assign static DHCP assignments, use this syntax
host static_customer1 {
  # Your customer's MAC address
  hardware ethernet 00:4F:4E:0D:12:FF;
  # IP address to assign - not part of dynamic IP group above
  fixed-address 192.168.123.201;
}

The host directive needs to be unique and can be anything you want. The hardware ethernet is the MAC address of the computer's network card. And fixed-address is the IP you wish to assign them.

Note that in the example the IP is .201, which is after the last IP in the dynamic example above. It's easier to keep track of IPs that way, and it ensures that there isn't going to be any IP conflict. You can have as many of these as you want, as long as none all of the host directives and IPs are unique.