what is the work of dhcp

2

1

hi all I am little bit confused about dynamic and static IP concept.What is dhcp and What actually DHCP does.Please provide me some idea about IP,Port and DHCP.

Subhransu Mishra

Posted 2010-09-23T10:08:13.937

Reputation: 259

Answers

4

Here's an explanation in laymen's terms (i hope you get the concepts):

Computers need IP-addresses to distinguish each other and communicate with each other. These addresses can be configured manually on each PC (which is a annoying task on big networks) or automatically assigned.

The latter is accomplished by utilizing a so called DHCP server (see Andrey's wikipedia link). In laymen's terms: Each PC that needs to have a number assigned shouts "into" the network: "HELLO, HERE I AM. GIVE ME AN ADDRESS!" (google for: broadcast). The DHCP-server notices this and sends the shouting PC a IP address that it can assign to itself.

Ports don't have anything to do with DHCP. Imagine being a PC that wants to talk to another PC (a server). You have a IP that you can use to connect (assigned manually or via DHCP). What if you want to talk to two different services/programs on that server? You need to have different endpoints (= ports) on which each service can listen. You need multiple addresses!

Imagine ports as some kind of endpoint/IP multiplexer for IPs. Each PC can have multiple applications listening of different ports.

When you connect to a server you need to pick a port you want to connect to (i.e. for web servers it's usually port 80, 25 for sending email, etc.).

Andrew S. Tanenbaum wrote a nice book called "Computer Networks" that explains all this in detail and in a nice understandeable way. But be warned: These are quite big topics! So the book is big, too. But IMHO it's worth it.

lajuette

Posted 2010-09-23T10:08:13.937

Reputation: 4 364

1

Translating this to real world examples, lets asume that we are computers.

Growing up, you might have had a static adress - the one of you parents house. If you were a computer in a network, this would have been called "internet protocoll adress" or "IP adress".

Going to a college you might move to a dormitory. If you arive there, you get a room asigned by one of the resposible people. So your (local) adress is dynamically configured and might even change every year. If you stay longer at the school, it might even be your responsibility to asign rooms one day. If you were a computer, the whole process would go by the "Dynamic Host Configuration Protocol". The job of asigning the rooms (or local IP adresses) would be done by a "DHCP" program (=server =deamon in this case). Besides, there might be some adresses (rooms in the dormitory) asigned in a static way (long time residents, location of the kitchen....). Usually your roomnumber will be submited to some kind of information desk / mail service. In computer terms this would be a (local) Domain Name Service (DNS). If someone wants to know your room number, this would be the person to ask.

Once they know your (IP) adress, you need to know, how to communicate. You could talk, write letters, whisper, slide notes below the door.... That is basically the "application" and the way of communicating with each other would be the "socket" in computer terms.

There might be some small errors logically in this translation to real world situations. But you might get the picture....

Besides that, Andrew Tanenbaums Computer Networks (Amazon link) goes from introductory chapters to very detailed information - if you got a few spare weeks to learn networks, start with this one...

MaoPU

Posted 2010-09-23T10:08:13.937

Reputation: 383

0

A DHCP server listens for requests on port 67. It will listen on one or more of the hosts addresses and the broadcast address 255.255.255.255. The client will listen on port 68, using the broacast address if it doesn't have a IP address leased, or the broadcast address.

The DHCP server will be configured with a number of parameters which can be sent the client. It will also have a number of addresses which can be given out to clients. The addresses may be fixed addreses, a range of dynamics (variable) addresses or a mix of the two. Fixed addresses will be allocated based on identification (often the mac address) provided by the client. Clients will be given a lease on the address for a period of time. Both the server and client will track active leases.

If the client does not have a lease it will issue a Discover request on the broadcast address. One or more servers will then Offer to provide service. The client will Request an address, and usually a number of options from a server (the last one used if it has a lease). This server will usually provide an address, the requested options, and possibly some additional options. If the server has no addresses, it will provide an appropriate refusal. If the client accepts the addresses, it will send an Inform message asking for local options.

When the lease is expiring the client will request a renewal direectly from the server. It can also Release its address by sending an appropriate message.

The options can include server addresses, protocol options, and names. Most importantly nameserver and router addresses allow the client to access the Internet.

Full details are provided by RFC2131. This is a fairly easy read.

BillThor

Posted 2010-09-23T10:08:13.937

Reputation: 9 384