cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5517
Views
19
Helpful
3
Replies

Multiple vlans same subnet, one gateway

sebas1234
Level 1
Level 1

Hi, I have two vlans, but all the hosts connected to those vlans have the same subnet because it was previously assigned using DHCP, so my question is... can the two vlans have the same gateway?.. Or there is a way to use DHCP to assign  IP addresses with different networks depending on the VLAN?

Screenshot 2022-02-20 134401.png

3 Replies 3

Hello,

 

the short answer is: no. each Vlan needs its own subnet. What exactly are you trying to accomplish ?

Hello


@sebas1234 wrote:

can the two vlans have the same gateway?..


No they cannot however a vlan can have multiple gateways.

 

 


@sebas1234 wrote:

Or there is a way to use DHCP to assign  IP addresses with different networks depending on the VLAN?


yes there is: 
example -  rtr with multiple sub-interfaces

interface GigabitEthernet0/1
no shut
interface GigabitEthernet0/1.10
description vlan 10
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0

interface GigabitEthernet0/1.20
description vlan 20
encapsulation dot1Q 20
ip address 192.168.20.1 255.255.255.0

ip dhcp pool LAN
network 192.168.10.0 255.255.255.0
network 192.168.20.0 255.255.255.0 secondary
override default-router 192.168.20.1
default-router 192.168.10.1
dns-server 8.8.8.8 8.8.4.4
domain-name test.com
lease 0 8

 

 


Please rate and mark as an accepted solution if you have found any of the information provided useful.
This then could assist others on these forums to find a valuable answer and broadens the community’s global network.

Kind Regards
Paul

Alex Pfeil
Level 7
Level 7

Looking at the diagram, you would just make the two VLANs different subnets. The 20 VLAN could be 192.168.2.0/24 and the 30 VLAN could be 192.168.3.0/24. If you are stuck using the same subnet for both, I would look into VRFs. I have not configured DHCP on a VRF so I am not sure if that is a valid design. However, I would fix the design above to what I have recommended in the first place. The subnets could be in the RFC1918 address space so you are not limited to 192.168 subnets.

Review Cisco Networking products for a $25 gift card