cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2221
Views
20
Helpful
13
Replies

DHCP to IP Phones - how??

rajju
Level 1
Level 1

Hello:

How does an ip phone actually get an ip address from it's dhcp pool in the router? We have 2 pools - one for data and one for voice. The ip phone is connected to a port on the switch which is further connected to the router. Question is: How does the pc and the ip phone each gets it's ip from the right pool? Thanks.

13 Replies 13

Chris Deren
Hall of Fame
Hall of Fame

DHCP is obtained via broadcasting, so the phone simply bradcasts request out to it's braodcast domain and since the dhcp pool is specified for that network it is reposnding. Assume you have router with following subinterfaces:

int fa 0/0.10

description voice

ip address 10.1.1.1 255.255.255.0

encapsulation dot1q 10

int fa0/0.20

description data

ip address 10.1.2.1 255.255.255.0

encapsulation dot1q 20

and following DHCP pools

ip dhcp pool voice

network 10.1.1.1

ip dhcp pool data

network 10.1.2.1

by confiuring: switchport voice vlan 10 on the switchport where phone is connected the phone belongs to vlan 10 which corresponds to network 10.1.1.1 (router provided, you could do it on the switch if you had layer 3 switch). Then the phone broadcasts dhcp request on the 10.1.1.1 network and gets a response from the voice dhcp pool. Similarly for the data.

HTH,

Chris

Chris:

Thank you for that great explanation. I understand that but I wanted to get a more technical understanding of:

1. when the pc and the phone boot up and they send a dhcp request (to the port on the switch), which is configured with #switchport access vlan 10 and switchport voice vlan 20, the switch will in turn send the request over to the router where the 2 dhcp pools are configured, correct?

2. Now once the router receives this request, what is in the request packet that tells the router to give an ip address from the voice pool to the ip phone and from the data pool to the pc?

Thank you much.

Best regards.

Niraj,

This link should help you.

http://www.cisco.com/en/US/tech/tk648/tk361/technologies_tech_note09186a0080114aee.shtml

HTH, please rate all useful posts!

Chris

Chris:

This still does not explain how this actually works!! When the switch port receives a dhcp request from the phone and the pc, it forwards it to the router where the 2 dhcp pools are configured. All the switch port has is switchport voice vlan 20 and switchport access vlan 10. What does it exactly tell the router that "Hey give an ip address from pool data to the pc and an ip address from pool voice to the phone". Is there some kind of message in the request packet that tells the router from which pool to give out ip's and then give that ip's all the way back to the ip phone and the pc?

Thanks for your help.

Best regards.

This is determined by the IP address of the router's L3 interface. You apply the an "ip helper-adress" command to the router stating where the DHCP server is. The router forwards this original broadcast to the DHCP server via unicast and the DHCP server determines the pool based off the DHCP Relay Agent field in the request from the router. This DHCP Relay Agent field is populated by the router when the "ip helper-address" is added to the interface and DHCP requests are received to that interface. This is essentially the source ip of the L3 interface. From there the DHCP server selects the DHCP scope that matches the net from the Relay Agent field.

Please rate any helpful posts

Thanks

Fred

This is mostly correct. The only difference i would state is that the original question was not using "ip helper-address"

The process is the same but without the relay.

The DHCP server (in this case the router) knows what pool to assign out of based on the IP address of the source network.

Steve

Regards,
Steve
Please rate all helpful posts.

To finalize: set up 2 vlans on router (one for voice, another for data), and assign 2 different ip networks for these 2 vlans. DHCP requests from phones will enter router from voice vlan interface, router will get ip address of this interface, and will assign ip address from DHCP pool that is in the range of voice vlan network. Requests from pc will enter router from data vlan, router will get ip address of this interface, and will select the corresponding pool.

Guys:

You are all correct in explaining this stuff...No doubt about that...I too understand all this...but this is explaining from a "top/outer" layer... what no one seems to understand is what I am actually asking :-(

And no disrespect for any one here !!

When the phone and pc power on initially, they both will request an ip address which the switch then forwards it to the router which then assigns an ip address from the correct pool to each of them.

Everything good so far, correct?

But what exactly does the phone send to the switch (which is configured with the switchport voice vlan 20 cmd.) that the switch knows it is a phone requesting an ip address, let me forward this request to the router and let the router to allocate an ip address from the voice pool.

And same way for the pc.

Is there a type code value or something similiar in the dhcp request packet that differentiates an ip phone and a pc which the switch correctly identifies and which the router identifies to allow it to allocate an ip address from the correct pool?

Sorry, if this is dragging on too long - not trying to eat any one's brain over here, but simply trying to understand the "inner" process on how a phone and pc both get an ip address from it's correct dhcp scope, that's all.

Hopefully, some one gets what I am talking about here.

Thank you all once again.

Best regards.

The key is CDP. The phone and the switch use CDP, at layer 2, to negotiate VLANs. Thus all packets sourced from the phone are marked with a "Voice" VLAN tag and the PC packets are untagged. This of course even includes the broadcast DHCP packets. The switch sees the phone almost like a trunk with the voice vlan tagged and the pc vlan native. Actually in older switch codes the Dot1q trunk command was used. The newer IOS uses Switchport access vlan and Switchport voice vlan. That was the quick not to in depth summary of the setup.

Of course after L2 is all sorted out the upper layer things we spoke about come into play.

Please rate any helpful posts

Thanks

Fred

Excellent Fred....now we are talking !!! :-)

Thank you.

So any dhcp packets from the phone get tagged with the voice vlan id and is then sent to the router.

Would you have a link on cco regarding a more in-depth explanation on this? I was not able to find any nor 'google' for it. Nor can I use a sniffer to look at the packet headers - I am trying to grasp the basics; from a routing/switching point of view; more at a theoretical level att.

When the phone uses CDP, what does it send to the switch to tell it "hey,Mr. Switch, I am a phone, tag my packets with the voice vlan id." And once the switch does that, all it does it forward the packets to the router via the trunk intf, correct?

Does it add any more info. to the packet headers to tell the router " hey, Mr. Router, the packets that I have tagged (color) with vlan 20, can you please allocate an ip from your dhcp pool 20?"

The dhcp packet from the pc since it is untagged, will get taken care by the native vlan 10, correct?

Thanks...Now that you understand what I am exactly talking about, I would appreciate your further help on this.

BTW: Are there any books/url's out there that explain this basic stuff?? I would love to buy them.

Thank you very much.

Best regards.

No unfortunately I know this from first hand experience and I can't recall an exact document. In a lab go ahead and disable CDP on a switchport and you will notice that the phone starts using the access vlan.

As it pertains to the packet, only trunk connections (or Cisco Voice Vlans which are almost essentially trunks) tag the packet with a vlan when leaving a switch. As far as the router part, if the router is participating in trunking then yes it will see a vlan tag. If it's just an access port connected to the switch it relys on the switch to get the correct packets to it as they will not be tagged leaving the access port and even if it was the router thinks of it as one segment.

There are a couple of ways to do the DHCP past the L2 part of this. These were explained above but I will rehash them. Again this is a quick summary.

1. Router running DHCP and trunking on it's port. The switch and router would participate in trunking. DHCP packets would be seen by the router directly since he is directly connected via a L2 trunk. He would give out the DHCP according to the L3 interface that had the L2 Vlan assigned to it.

2. Router with DHCP and L3 switch as Default Gateway. The L3 switch would need to have an IP Helper address and would use DHCP relay to get IP phones and pc's to the DHCP server. I discussed this earlier.

3. Router with an integrated etherswitch. This device would have VLAN interfaces created in the IOS. The VLAN interface is the L3 default router. The DHCP server would server the pool based on the VLAN interface it was received in.

And tell you the truth there probably is a couple of more ways. But to sum it up the vlan doesn't directly correspond to getting to the correct DHCP scope as much as getting to the correct L3 interface that then either relays or is directly connected to the DHCP server on the router.

Any packets coming in untagged participate in the native vlan.

Please rate any helpful posts

Thanks

Fred

May I drop in and ask if my modest understanding of this is at least along the proper track? When a switchport has a designated Voice VLAN the CDP function in the switch detects any phones plugged into the switch and makes certain that the DHCP request goes to the right place. From time to time the DHCP leases on my data VLAN reflect a telephone MAC address but if I check I'll find the phone has re-addressed on the proper VLAN shortly after getting an address on the data VLAN.

Mark,

This might be related to a phone firmware issue. Do you know is it a certain type of phone or is it various. If you could post the phone type and firmware that would help. Also make sure you have Portfast enabled even though technically both vlans should go into forwarding state around the same time. Enabling portfast, which is done on almost every switchport with a phone, is going to have the vlans go directly into forwarding.

Please rate any helpful posts

Thanks

Fred