cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1221
Views
25
Helpful
9
Replies

DHCP - Doubts

eduangelo
Level 1
Level 1

I am using a router as server dhcp.
And i set three pool in this router with their networks.
This router is connect to the port the switch.
This networks are in the different vlans.

 

My doubts:

 

How is it the router knows which client, that he should assign the ip address?

It is need to set trunk in the port tha connect switch with router ?

At the router , is it need to set subinterfaces ?

4 Accepted Solutions

Accepted Solutions

luis_cordova
VIP Alumni
VIP Alumni

Hi @eduangelo,

 

Effectively, the port of the switch that connects to the router must be in trunk mode.

In the router, you must configure subinterfaces and these must be encapsulated with the 802.1q protocol.
This method is called router-on-a-stick.

With the tag that you assign in the encapsulation, the router will filter to which vlan each DHCP request corresponds.

 

R(config )#interface <int>

R(config-if)#no shutdown 

R(config)#interface <int.> <- I recommend it to be the same n° vlan

R(config-subif)#encapsulation dot1q <> <- n° vlan

R(config-subif)#ip  address  <ip>  <másk>

 

Regards

View solution in original post

balaji.bandi
Hall of Fame
Hall of Fame

adding to other post you need IP helper address for the user to IP address from respected VLAN

 

example : 

 

ip dhcp excluded-address 10.10.10.1
ip dhcp excluded-address 10.10.20.1
ip dhcp excluded-address 10.10.30.1

!

ip dhcp pool vlan10
network 10.10.10.0 255.255.255.0
default-router 10.10.10.1
dns-server x.x.x.x

ip dhcp pool vlan20
network 10.10.20.0 255.255.255.0
default-router 10.10.20.1
dns-server x.x.x.x

ip dhcp pool vlan30
network 10.10.30.0 255.255.255.0
default-router 10.10.10.1
dns-server x.x.x.x

!
!
interface x/x
no ip address
duplex auto
speed auto
!
interface x/x/0.10
encapsulation dot1Q 10
ip address 10.10.10.1 255.255.255.0
!
interface x/x/0.20
encapsulation dot1Q 20
ip address 10.10.20.1 255.255.255.0
!
interface x/x/0.30
encapsulation dot1Q 30
ip address 10.10.30.1 255.255.255.0

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

View solution in original post

Hi @eduangelo,

 

The DHCP pools are configured in the global configuration mode, not in the subinterfaces.

 

Regards

View solution in original post

Joseph W. Doherty
Hall of Fame
Hall of Fame
"How is it the router knows which client, that he should assign the ip address?"

It knows by what interface, with an IP, received the client host's DHCP IP request.

"It is need to set trunk in the port tha connect switch with router ?"

That depends on whether switch is L2 or L3, and whether you want multiple VLANs to share the port/link.

"At the router , is it need to set subinterfaces ?"

Only if the switch port that the router is connected to is a trunk with tagged VLANs on it.

View solution in original post

9 Replies 9

luis_cordova
VIP Alumni
VIP Alumni

Hi @eduangelo,

 

Effectively, the port of the switch that connects to the router must be in trunk mode.

In the router, you must configure subinterfaces and these must be encapsulated with the 802.1q protocol.
This method is called router-on-a-stick.

With the tag that you assign in the encapsulation, the router will filter to which vlan each DHCP request corresponds.

 

R(config )#interface <int>

R(config-if)#no shutdown 

R(config)#interface <int.> <- I recommend it to be the same n° vlan

R(config-subif)#encapsulation dot1q <> <- n° vlan

R(config-subif)#ip  address  <ip>  <másk>

 

Regards

But do i can set pool in the subinterfaces ?
There is some different in define pool in the subinterfaces or not ?

Hi @eduangelo,

 

The DHCP pools are configured in the global configuration mode, not in the subinterfaces.

 

Regards

Hi, @luis_cordova

I think that i did understand.
What i have to do, It is at the clients execute command ip address dhcp.
This shape the clients can make request to the servers.

Hi @eduangelo,

 

Yes, they should be able to get IP from the server with that command.

 

Regards

Hi, @luis_cordova

When i configure a dhcp server, i am obliged to the to set domain-name ?
This command is opcional in the configuration the dhcp server ?

Do i can to set two subnetworks for dns-server in the configuration dhcp  ? 

Hi @eduangel,

 

That command is not mandatory.

Now, you must remember that the parameters configured in the DHCP pool are the parameters that you want the devices connected to that network to acquire.

Therefore, if you do not assign a DNS server for your devices, they will not be able to resolve the names of the pages on the internet.

 

Regards

balaji.bandi
Hall of Fame
Hall of Fame

adding to other post you need IP helper address for the user to IP address from respected VLAN

 

example : 

 

ip dhcp excluded-address 10.10.10.1
ip dhcp excluded-address 10.10.20.1
ip dhcp excluded-address 10.10.30.1

!

ip dhcp pool vlan10
network 10.10.10.0 255.255.255.0
default-router 10.10.10.1
dns-server x.x.x.x

ip dhcp pool vlan20
network 10.10.20.0 255.255.255.0
default-router 10.10.20.1
dns-server x.x.x.x

ip dhcp pool vlan30
network 10.10.30.0 255.255.255.0
default-router 10.10.10.1
dns-server x.x.x.x

!
!
interface x/x
no ip address
duplex auto
speed auto
!
interface x/x/0.10
encapsulation dot1Q 10
ip address 10.10.10.1 255.255.255.0
!
interface x/x/0.20
encapsulation dot1Q 20
ip address 10.10.20.1 255.255.255.0
!
interface x/x/0.30
encapsulation dot1Q 30
ip address 10.10.30.1 255.255.255.0

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Joseph W. Doherty
Hall of Fame
Hall of Fame
"How is it the router knows which client, that he should assign the ip address?"

It knows by what interface, with an IP, received the client host's DHCP IP request.

"It is need to set trunk in the port tha connect switch with router ?"

That depends on whether switch is L2 or L3, and whether you want multiple VLANs to share the port/link.

"At the router , is it need to set subinterfaces ?"

Only if the switch port that the router is connected to is a trunk with tagged VLANs on it.
Review Cisco Networking for a $25 gift card