cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1406
Views
5
Helpful
3
Replies

Dynamically assign IP address from different subnet to PCs which are connected to same switch.

nilaypatel31294
Level 1
Level 1

How can I assign IP addresses as shown in attachment using DHCP?

1 Accepted Solution

Accepted Solutions

Julio E. Moisa
VIP Alumni
VIP Alumni

Hi

You should create the gateway for each subnet  and dhcp scopes on the router. Also a router on a stick must be applied to this scheme.  Please let me share the configuration.

ROUTER 

Asumming you are using 2 differents vlans, for example 2 and 3

*Create sub interface where the vlan identifier will be applied through encapsulation dot1q, it will help us to enable the routing inter_vlan. 

interface FastEthernet0/0
no ip address
no shutdown
!
interface FastEthernet0/0.2
encapsulation dot1Q 2
ip address 10.5.2.1 255.255.255.0
!
interface FastEthernet0/0.3
encapsulation dot1Q 3
ip address 10.5.3.1 255.255.255.0

*Create the DHCP scopes. 

ip dhcp excluded-address 10.5.2.1    <---- excluding the IP associated to the gateway of vlan 2
ip dhcp excluded-address 10.5.3.1    <---- excluding the IP associated to the gateway of vlan 3


ip dhcp pool DHCP-VLAN2
network 10.5.2.0 255.255.255.0
default-router 10.5.2.1
dns-server 8.8.8.8 4.2.2.2
!
ip dhcp pool DHCP-VLAN3
network 10.5.3.0 255.255.255.0
default-router 10.5.3.1
dns-server 8.8.8.8 4.2.2.2

SWITCH

You must configure the interface facing to the router as trunk. Example:

interface g1/1/1
description Point-to-Point_with_Router
switchport trunk encapsulation dot1q
switchport mode trunk
no shutdown

Also remember to create the vlans on both switches. And the trunk interfaces between both switches.

conf t

vlan 2
name VLAN-X

vlan 3
name VLAN-Y

Please rate the comment if it is useful

:-)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

View solution in original post

3 Replies 3

Julio E. Moisa
VIP Alumni
VIP Alumni

Hi

You should create the gateway for each subnet  and dhcp scopes on the router. Also a router on a stick must be applied to this scheme.  Please let me share the configuration.

ROUTER 

Asumming you are using 2 differents vlans, for example 2 and 3

*Create sub interface where the vlan identifier will be applied through encapsulation dot1q, it will help us to enable the routing inter_vlan. 

interface FastEthernet0/0
no ip address
no shutdown
!
interface FastEthernet0/0.2
encapsulation dot1Q 2
ip address 10.5.2.1 255.255.255.0
!
interface FastEthernet0/0.3
encapsulation dot1Q 3
ip address 10.5.3.1 255.255.255.0

*Create the DHCP scopes. 

ip dhcp excluded-address 10.5.2.1    <---- excluding the IP associated to the gateway of vlan 2
ip dhcp excluded-address 10.5.3.1    <---- excluding the IP associated to the gateway of vlan 3


ip dhcp pool DHCP-VLAN2
network 10.5.2.0 255.255.255.0
default-router 10.5.2.1
dns-server 8.8.8.8 4.2.2.2
!
ip dhcp pool DHCP-VLAN3
network 10.5.3.0 255.255.255.0
default-router 10.5.3.1
dns-server 8.8.8.8 4.2.2.2

SWITCH

You must configure the interface facing to the router as trunk. Example:

interface g1/1/1
description Point-to-Point_with_Router
switchport trunk encapsulation dot1q
switchport mode trunk
no shutdown

Also remember to create the vlans on both switches. And the trunk interfaces between both switches.

conf t

vlan 2
name VLAN-X

vlan 3
name VLAN-Y

Please rate the comment if it is useful

:-)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<

nilaypatel31294
Level 1
Level 1

Thank you so much for your quick replay and sorry for my late response. That was really helpfull.

Hi

It was a pleasure my friend.

Have a great day!

:-)




>> Marcar como útil o contestado, si la respuesta resolvió la duda, esto ayuda a futuras consultas de otros miembros de la comunidad. <<