|
DHCP & NetBios
DHCP
Background
DHCP stands for Dynamic Host Configuration Protocol and provides a solution
that automatically assigns IP addresses to computers on a network. When
a client is configured to receive an IP address automatically, It will
send out a broadcast to the DHCP server requesting an address. The NT
server will then issue a "lease" and assign it to that client.
The time period that a lease will last can be specified on the server.
Some of the benefits of DHCP include the following:
Prevents
users from making up their own IP addresses.
Prevents incorrect gateway or subnet masks from being entered.
Decreases amount of time spent configuring computers especially in environments
where computers get moved around all the time (I think that is everywhere,
isn't it?).
Handy in situations where you have a large sales staff that work remotely.
On that one day they bring their laptops and they can just plug them
into the network and they are all set.
How Does This Crazy Thing Work?
It all happens in 4 steps.
1) The client sends a broadcast that says "Hey, I need an IP address
over here". Since it is not configured for TCP/IP yet it uses a
source address of 0.0.0.0 and a destination address of 255.255.255.255.
The broadcast contains the computer's name and the MAC address so the
DHCP server knows where to reply. This is called the IP lease request.
2) The DHCP
server/s send an offer. This broadcast contains the IP address, client's
hardware address, subnet mask, duration of lease and the IP address
of the responding DHCP server. This process is called a IP lease offer.
3) The client
takes a look at the first offer that it receives and sends a message
to all DHCP servers to let them know that it has chosen an offer. This
is known as the IP lease selection.
4) The DHCP
server then sends an ack to the client, all other DHCP servers withdraw
their offers and cry in the corner and the clients now have an IP address.
If an unsuccessful ack is received then the client sends out another
lease request. Easy eh? For all of you registry nuts, the client stores
its IP info in HKEY_LOCAL_MACHINE\SYSTEM\CurrentConrolSet\
Services\adapter\Parameters\Tcpip.
Lease
Renewal
DHCP clients will attempt to renew their leases when 50% of the lease
has expired. The client will send a DHCPREQUEST message to the server
that assigned the lease. Assuming the DHCP server isn't on fire or anything
it will send out a DHCPACK with the new lease. If the server is unavailable,
then the client can continue functioning as it has 50% remaining still.
The client will continue as normal until the lease reaches 87.5% used
at which time it broadcast to all DHCP servers and attempt to get a
new lease. If the client receives a DHCPNACK message or the lease expires
then the client must start all over again and will get a different IP
address. If the lease expires and the client is unable to get a new
one then the user will be whining to their IS dept. about it because
they will not be able to communicate over the network.
IPConfig
Below are the ipconfig switches that can be used at a command prompt.
ipconfig
/all will display all of your IP settings.
ipconfig /renew forces the DHCP server, if available to renew a lease
ipconfig /release forces the release of a lease.
Setting Up A DHCP Server
We have discussed how DHCP works for the clients, so now we should look
at what happens on the rest of the network. First question to ask yourself
is how many subnets will the DHCP server serve. If it is more than 1
then you have to make sure that all routers are configured as DHCP relay
agents or else only the local subnet will get leases. Next the "scope"
needs to be defined. If there multiple DHCP servers then each one will
need to have a unique scope of IP addresses since DHCP servers do not
share information about leases with each other. According to Microsoft,
each DHCP server should be configured with 75% of the scope reserved
for the local subnet and the remaining 25% for remote subnets. This
provides redundancy in case a client can't obtain a lease from the local
server, then it can get one from a remote server. Also, keep in mind
that a DHCP server cannot also be a DHCP client, meaning that the DHCP
server must have static entries for its IP settings. Below are the basic
steps to set up a DHCP server:
1) The DHCP
server service must be installed.
2) A scope
must be defined. Note that each DHCP server must have unique scopes
defined or else duplicate IP addresses may be assigned. There are 3
scope options:
Global - This option is used when all DHCP clients will use the same
IP setting, such as the same subnet mask.
Scope - These options are only available to clients that are using an
address specified by the scope.
Client - Used for clients that use reserved addresses.
3) The server may be configured to always assign a particular address
to a client.
4) "Map
out" any static IP addresses on the network in the "exclusion
range" fields.
The DHCP server database is backed up every hour (default) and can be
restored when needed. It can also be compacted in order to keep it running
efficiently. NT 4.0 does this automatically, whereas it must be done
manually with earlier versions of NT.
DHCP Relay
Agent
This service is used when routers separate clients from a DHCP server.
An NT server on the same subnet as the clients can be configured so
that it automatically sends all DHCP messages directly to the DHCP server.
Included in the message to the server is the address of the originating
client so that the DHCP server can respond directly back to the client.
This service is basically a middle-man.
NETBIOS
Background
Get ready, because it is time to take it to the next level. When talking
about Netbios, we typically refer to the concept of a Netbios Name which
is the name assigned to your computer. Netbios allows applications to
talk to each other using protocols such as TCP/IP that support Netbios.
Netbios is also a session/transport layer protocol that is typically
seen in other forms such as Netbeui and NetBT. These are the main functions
that Netbios serves:
Starting
and stopping sessions.
Name registration
Session layer data transfer (reliable)
Datagram data transfer (unreliable)
Protocol driver and network adapter management functions.
NetBIOS Naming
A Netbios name is either a unique name or a group name, the difference
being that a unique name is is used for communication with a specific
process on a computer, whereas a group name is for communication with
multiple clients. Netbios name resolution resolves a computer's Netbios
name to an IP address. Microsoft offers several different ways to resolve
Netbios names and each will be disscussed below.
LOCAL BROADCAST - If the destination host is local, then first the
Netbios name cache is checked and a broadcast is not sent. If it is
not found here, then a name query broadcast is sent out that includes
the destination Netbios name. Each computer that receives the broadcast
checks to see if it belongs to the name requested. The computer that
owns the name then uses ARP to determine the MAC address of the source
host. Once obtained a name query response is sent. NOTE: Some routers
do not support the fowarding of these broadcasts as they use UDP ports
137 and 138.
NETBIOS NAME SERVER - When using a Netbios name server, the cache
is checked first and if the name is not found the destination host's
name is sent to the name server. After the name server resolves the
name to an IP address, it is returned to the source host. When the source
host receives the information it uses ARP to resolve the IP address
of the destination host to its MAC address.
LMHOSTS FILE - More on this later...
HOSTS FILE - More on this later...
DNS - More on this later...
NBStat Commands
1) nbstat -n Lists all registered Netbios names.
2) nbstat -c Shows the Netbios cache.
3) nbstat -R Reloads the Netbios name cache from the lmhosts file.
Write by
Jason Sprague.
|