cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
42773
Views
12
Helpful
13
Replies

Dhcp not working

Ahmed Malik
Level 1
Level 1

hi,

   I have a made a topology in pkt tracer. i have made use of a router and switches. i placed dhcp in vlan 2 and my clients are in various vlans ranging from 3-7. Now i have made sub-interfaces on my router to implement router-on-a-stick technique and have assigned ip addresses to all the sub-interrfaces. The issue is that when i try to assign ip to my clients in any vlan thy dont get ip from the dhcp server. Provided that i set the gateway in dhcp the same as the ip on that sub-interface. Please help me out here. i know i am making a silly mistake somewhere so i am attaching the pkt tracer file along.Also the switches are also assigned ip addresses from 192.168.1.2 - 1.8. The Fa0/0 interface on the router is also assigned an ip address its 192.168.1.1.

2 Accepted Solutions

Accepted Solutions

Henrikp92
Level 1
Level 1

You got 2 problems here. The first problem i saw was that on your router, you got a subinterface fa0/0.2 for vlan 2 which your DHCP server are at.

But you haven't configure the subinterface IP address correct yet.

Try and replace following:

interface FastEthernet0/0.2

encapsulation dot1Q 2

ip address 192.168.2.1 255.255.255.0

with

encapsulation dot1Q 2

ip address 192.168.1.1 255.255.255.0

ip helper-address 192.168.1.8

As you can see vlan2 got the IP 192.168.2.1 as default gateway and your DHCP-server trying to access 192.168.1.1.

Second problem is your dhcp-pool

The DHCP pool you trying to give out is 192.168.1.0.

First of all you can't put a start address with the netID, Second try and put the start IP address for the right vlan.

For an example to give vlan 3 (Block 1) DHCP address you have to make a pool with the start address like: 192.168.3.1

vlan4 (Block 2): 192.168.4.1

etc....

I hope this help you!

View solution in original post

Hello Ahmed,

My bad about the ip-helper on that interface, abit tired here now. No you're right you don't need ip-helper on that interface.

But still your DHCP server got a default gateway to 192.168.1.1 for vlan2.

But when you check the conf on your router at FastEthernet0/0.2 you got a IP address 192.168.2.1.

As you can see in your conf you got the IP 192.168.1.1 on FastEthernet0/0 but that's the wrong interface... you need that IP address on the subinterface Fa0/0.2 instead.

I just tested your pkt file.

This is the steps i did:

Router0

2800_Rtr(config)#int fa0/0

2800_Rtr(config-if)#no ip address

2800_Rtr(config-if)#int fa0/0.2

2800_Rtr(config-subif)#ip address 192.168.1.1 255.255.255.0

And yea, i know that packet tracer can change those settings sometimes. But if you set the DHCP pool again for vlan3 with a start address 192.168.3.2 (because default gateway is 192.168.3.1) and move the ip address on the router fa0/0 to fa0/0.2 it should work just fine. (I tried it myself, and it worked.)

Your conf on router:

interface FastEthernet0/0

description Link For Telnet To Switches

ip address 192.168.1.1 255.255.255.0

ip helper-address 192.168.1.8

duplex auto

speed auto

!

interface FastEthernet0/0.2

encapsulation dot1Q 2

ip address 192.168.2.1 255.255.255.0

!

Mine:

interface FastEthernet0/0

description Link For Telnet To Switches

no ip address

ip helper-address 192.168.1.8

duplex auto

speed auto

!

interface FastEthernet0/0.2

encapsulation dot1Q 2

ip address 192.168.1.1 255.255.255.0

!

Method 2: You can change the default gateway on the dhcp server to 192.168.2.2 but then you have to change the ip-helper address on all subinterfaces (except vlan1 and 2). So i would stick to move the fa0/0 address to fa0/0.2 instead.

I hope this works better for you.

View solution in original post

13 Replies 13

Sergey Fer
Level 1
Level 1

As I can see, you did not put command ip helper-address anywhere except interface f0/0.3 (VLAN 3). This command is neccessary on all sub-ifs where your clients are situated. And also check if you can ping DHCP server from router. May be something wrong with your switching topology.

Hey,

      I can ping my server from my router the issue is with clients not getting ips from dhcp. do i have to put it on all sub-interfaces first and then check if the clients are getting IPs? i only assisgned it to fa0/0.3 to see if its working or not.

Ok i did put the ip helper-address 192.168.1.8 on all the sub-interfaces and still not working.

Regards,

Ali

Message was edited by: Ahmed Malik

Hi there,

I could not see ur file since im on a Mac.

Look, you have to make a separate dhcp pool for every vlan that u need to be served by dhcp, network range depends on each VLAN.

then you have to issue the ip helper-address on all the interfaces/subif except for the one with the dhcp server on it.

when a client sends a dhcp request, the router takes it from the segment and sends it to the dhcp server, RTR requests an IP address from the pool with the appropriate range with regards to the subif's ip address, one which router received the packet from.

plz Rate if it helped.

Soroush.

Hope it Helps!

Soroush.

Hello Soroush,

                     Yeah i did make a seperate dhcp pool for each vlan and also i used the ip helper-address on each sub-interface and still no luck.

Regards,

Ali

Hi,

can you repost the newest PT file.

Regards.

Alain

Don't forget to rate helpful posts.

couple questions:

are the vlans set up correctly on your switches and trunked on the switch interface the router is plugged into?

can you statically assign an IP on a workstation and ping the sub interface and the dhcp server?

I also noticed in your reply post you assigned the helper addres 192.168.1.8 which in your original post is assigned to one of your switches.  The IP helper address needs to be the address of your DHCP server.

example:  if you dhcp server IP was 192.168.1.100 then your command would be ip helper-address 192.168.1.100

Hi jim,

yes the vlans are setup correctly and trunked too. ok i statically assigned the ip of 192.168.3.2 to a pc in block 1 and now it pings it default-gateway andalso the dhcp server which is in another sub-interface and i changed the ip of the dhcp to 192.168.2.2 and now its in sub-interface 192.168.2.1. Now what?

Henrikp92
Level 1
Level 1

You got 2 problems here. The first problem i saw was that on your router, you got a subinterface fa0/0.2 for vlan 2 which your DHCP server are at.

But you haven't configure the subinterface IP address correct yet.

Try and replace following:

interface FastEthernet0/0.2

encapsulation dot1Q 2

ip address 192.168.2.1 255.255.255.0

with

encapsulation dot1Q 2

ip address 192.168.1.1 255.255.255.0

ip helper-address 192.168.1.8

As you can see vlan2 got the IP 192.168.2.1 as default gateway and your DHCP-server trying to access 192.168.1.1.

Second problem is your dhcp-pool

The DHCP pool you trying to give out is 192.168.1.0.

First of all you can't put a start address with the netID, Second try and put the start IP address for the right vlan.

For an example to give vlan 3 (Block 1) DHCP address you have to make a pool with the start address like: 192.168.3.1

vlan4 (Block 2): 192.168.4.1

etc....

I hope this help you!

Hi Henrikp92,

                   The vlan2 is for dhcp server so why would i put ip-helper address [dhcp address] on that interface? ok the dhcp pool, i was giving it 192.168.3.2 for block 3 start ip address but each time i would open the file in pkt tracer it would reset the ip to a net address.

Ok i changed the ip address of dhcp to 192.168.2.2 for fa0/0.2 as it has ip of 192.168.2.1 but still nothing changed.

Hello Ahmed,

My bad about the ip-helper on that interface, abit tired here now. No you're right you don't need ip-helper on that interface.

But still your DHCP server got a default gateway to 192.168.1.1 for vlan2.

But when you check the conf on your router at FastEthernet0/0.2 you got a IP address 192.168.2.1.

As you can see in your conf you got the IP 192.168.1.1 on FastEthernet0/0 but that's the wrong interface... you need that IP address on the subinterface Fa0/0.2 instead.

I just tested your pkt file.

This is the steps i did:

Router0

2800_Rtr(config)#int fa0/0

2800_Rtr(config-if)#no ip address

2800_Rtr(config-if)#int fa0/0.2

2800_Rtr(config-subif)#ip address 192.168.1.1 255.255.255.0

And yea, i know that packet tracer can change those settings sometimes. But if you set the DHCP pool again for vlan3 with a start address 192.168.3.2 (because default gateway is 192.168.3.1) and move the ip address on the router fa0/0 to fa0/0.2 it should work just fine. (I tried it myself, and it worked.)

Your conf on router:

interface FastEthernet0/0

description Link For Telnet To Switches

ip address 192.168.1.1 255.255.255.0

ip helper-address 192.168.1.8

duplex auto

speed auto

!

interface FastEthernet0/0.2

encapsulation dot1Q 2

ip address 192.168.2.1 255.255.255.0

!

Mine:

interface FastEthernet0/0

description Link For Telnet To Switches

no ip address

ip helper-address 192.168.1.8

duplex auto

speed auto

!

interface FastEthernet0/0.2

encapsulation dot1Q 2

ip address 192.168.1.1 255.255.255.0

!

Method 2: You can change the default gateway on the dhcp server to 192.168.2.2 but then you have to change the ip-helper address on all subinterfaces (except vlan1 and 2). So i would stick to move the fa0/0 address to fa0/0.2 instead.

I hope this works better for you.

Hi Henrikp,

               ok now its working fine and now all my blocks are getting ips from the dhcp. thanks for the help. Now my second question is that once i have achieved this portion and now if i want to connect my 2811 Router to the ISP i have to use nat and to achieve this do i have to put ip on the inside physical interface of the 2800 router or not ?

Regadrs,

Ali

Hi Ahmed,

     Ah glad to hear it worked out for you.

     Yes you have to set an public IP address on your public interface, in your case Fa0/1.

     After that you have to cretate an access list for your NAT. Which should look something like:

     ip access-list standard nat

     permit 192.168.3.0 0.0.0.255 <-- this is for vlan 3

     You have to do the "permit" command with all the vlans you want internet access with.

     After you done with the access-list you have to put the access-list at the fa0/1 (public) interface.

     Which should look something like this:

     ip nat inside source list nat interface FastEthernet0/1 overload.

     Cheers,

     Henke

Hello Henrikp92,

                      Thanks for the reply back. I dont need a routing protocol in this scenario i think because my 2800 rtr will directly connect to the ISP router. right? i will try this and will get back to you asap.

Regards,

Ali

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card