We create one default gateway for each subnet (VLAN).
The key idea is this:
We don't create several default gateways for one network. We create one default gateway for each subnet (VLAN).
Let's understand why.
Example 1: One VLAN
Suppose your office has only one VLAN.
VLAN 10
Network: 192.168.10.0/24
PC1 192.168.10.10
PC2 192.168.10.20
Gateway: 192.168.10.1
Here, one default gateway is enough because all devices are in the same subnet.
Example 2: Three VLANs
Now the company grows.
VLAN 10 - Employees
192.168.10.0/24
VLAN 20 - Servers
192.168.20.0/24
VLAN 30 - CCTV
192.168.30.0/24
These are three different IP networks.
Each network needs a router interface (or SVI) inside that subnet.
VLAN 10 → Gateway 192.168.10.1
VLAN 20 → Gateway 192.168.20.1
VLAN 30 → Gateway 192.168.30.1
That's why you have three default gateways.
Why can't all VLANs use one gateway?
Suppose every PC uses:
192.168.10.1
as its gateway.
A PC in VLAN 20 has:
IP Address
192.168.20.10
Gateway
192.168.10.1
This won't work because:
- The PC is on 192.168.20.0/24
- The gateway is on 192.168.10.0/24
The PC cannot directly reach a gateway that is in a different subnet.
Real Enterprise Example
Layer 3 Switch
VLAN 10
Gateway 192.168.10.1
VLAN 20
Gateway 192.168.20.1
VLAN 30
Gateway 192.168.30.1
VLAN 40
Gateway 192.168.40.1
Each gateway is simply an interface on the same Layer 3 switch.
Think of it like an apartment building
Imagine:
Floor 1 = VLAN 10
Floor 2 = VLAN 20
Floor 3 = VLAN 30
Each floor has its own elevator entrance.
- Floor 1 entrance = Gateway for VLAN 10
- Floor 2 entrance = Gateway for VLAN 20
- Floor 3 entrance = Gateway for VLAN 30
There isn't one entrance that every floor can directly use.
Connection to HSRP
With HSRP, each VLAN usually has its own virtual gateway.
Example:
VLAN 10 → Virtual IP 192.168.10.1
VLAN 20 → Virtual IP 192.168.20.1
VLAN 30 → Virtual IP 192.168.30.1
The PCs still have only one configured default gateway each:
- A PC in VLAN 10 uses 192.168.10.1.
- A server in VLAN 20 uses 192.168.20.1.
- A camera in VLAN 30 uses 192.168.30.1.
They do not use all of the gateways.
The most important point
A common misconception is:
"If there are 10 default gateways in the network, every PC uses all 10."
That's not true.
- Each device has exactly one default gateway configured.
- The network has many default gateways because it has many different VLANs/subnets.
- Each gateway serves only the devices in its own subnet.
Comments
Post a Comment