Vlan Interface or Router Interface as gateway

Unanswered Question
Jan 16th, 2008

I have a question regarding what the default gateway of a host should be.

A switch has IP's for 2 vlans including the management vlan.

This switch also has a default gateway statement pointing to the router interface. This is a switch at one location.

However, at a diff location

All the hosts at my office belong to vlan 1. However, the default gateway

for the pc's is the router interface connected to the LAN.

Ive done some research and im finding that the default gateway of a host or server should be the

vlan interface ip that it belongs too...Which should it be?

How is my office working with the gateway of a router and not the vlan ip it belongs too?

I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Loading.
s.arunkumar Wed, 01/16/2008 - 19:39

The default gateway is given as IP on a layer3 device.Now the switch may be a layer3 switch.Hence giving gateway so is correct for that vlan,as ur intervlan communication also happens at the that point.

On your remote site there is only one vlan.,and maybe the layer 3 device there would be a router.

arun :)

nygenxny123 Wed, 01/16/2008 - 20:03

so if my switch is only a layer 2..it gets the router interface, and if it is a layer 3 capable it gets the vlan ip as the gateway?

-on my site with only only one vlan, it is a cat 2950..would i be able to configure

an ip for a vlan on that switch?

is there an easy way to tell if a switch is a layer 3 and or layer 3?

Richard Burts Wed, 01/16/2008 - 20:52

Richard

First let me try to articulate a fundamental principle: the default gateway for a PC should be an address that satisfies both of these 2 conditions:

- it must be an IP address within the subnet of the host (determined based on the address and the subnet mask of the host) and on a device capable of layer 3 forwarding. (the layer 3 rquirement)

- it must be an IP address on an interface that is within the VLAN (the broadcast domain) of the port/interface of the PC. (the layer 2 requirement)

So if the PC is connected to a layer 2 switch the default gateway would be the router interface or the interface of a layer 3 switch that is upstream of the layer 2 switch. If the PC is connected to a layer 3 switch the default gateway would be the layer 3 interface of the layer 3 switch for that VLAN or could be a router interface (if the router interface is within the subnet and VLAN).

If the switch on your site is a 2950 (considering that the 2950 is a layer 2 switch) you can configure an IP address on a VLAN interface for management of the switch. But the address on the switch can not be the default gateway for the PCs.

I am not sure that there is an easy way to tell if the switch is layer 2 or layer 3. I will suggest a couple of things to check to determine which it is.

- If the switch has multiple VLAN interfaces and if more than 1 of the VLAN interfaces are up/up then it is a layer 3 switch (a layer 2 switch can have only a single active VLAN interface).

- If the switch has "ip routing" in its configuration then it is a layer 3 switch.

HTH

Rick

Actions

This Discussion