Default Route on a switch - question

Unanswered Question
Jun 18th, 2007


I'm having trouble understanding some basics on a switch. If I have multiple vlan's and each one of those vlan's has a default gateway, then which gateway do I use to put into the switch command "ip default-gateway" for example:

vlan 1:

vlan 2:

vlan 3:



I have this problem too.
0 votes
  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 0 (0 ratings)
Edison Ortiz Mon, 06/18/2007 - 07:42

Each VLAN's default gateway should point to the switch. The switch should have a default gateway to another device that will transport the data outside your office.

If you don't have another device and all traffic must remain local, then you don't need the ip default gateway command.

Richard Burts Mon, 06/18/2007 - 07:48


I believe that your question reflects a bit of confusion. Each VLAN has its own default gateway and this is used by the end stations in the VLAN and they need to use the default gateway of the VLAN when they want to access addresses that are outside of the subnet of the VLAN. The default gateway configured on the switch is not to be used by the end stations on any VLAN but is for the switch itself. The management interface on the switch is essentially another IP host and it needs its own default gateway to be able to access addresses in remote subnets. So you would configure a default gateway on the switch that is the layer 3 interface address in the vlan that matches the management interface of the switch.



glen.grant Mon, 06/18/2007 - 08:42

Think Ric said it best but I will add that seeing it looks like you have ip routing turned on for that switch you would not even use the default gateway command but would instead use a default static route pointing it to the next hop , the default gateway is for when you turn ip routing off on the box .

Richard Burts Mon, 06/18/2007 - 08:52

I obviously interpreted the question in terms of layer 2 switches and answered the question in that context. I believe that my answer is quite correct for layer 2 switches which need the default gateway. Glen has picked up on something that I did not which is that with multiple VLAN interfaces which have IP addresses that it would be a layer 3 switch. Layer 3 switches implement routing logic and do not really need default-gateway configuration.

Good catch Glen. :)




This Discussion