Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
Webcast-Catalyst9k
New Member

Switch default gateway question

How does it work when you have multiple vlans configured on a switch, but only one "ip default-gateway " command? Which VLAN does this provide a default-gateway service to? (I think it's mabey the the management vlan)

Is there a way to put a "ip default-gateway " command in each vlan? Is is even necessary?

Any help is appreciated!

Thanks,

Chris

8 REPLIES
Cisco Employee

Re: Switch default gateway question

Hi Chris,

"ip default-gateway" command is basically used when switches are not doing any routing and working as pure layer 2 switch so that when they initiate traffic for some subnet outside their management subnet they can send traffic on default gateway.

You can have only one default-gateway configured on your switch.

When your switch has multiple vlan interfaces which means it is a layer 3 switch and doing routing and when your switch is configured to route with IP, it does not need to have a default gateway set.

HTH

Ankur

*Pls rate all helpfull post

Re: Switch default gateway question

Hi,

I think that you are talking about a layer 2 switch, and in this case "ip default-gateway " command is used for managing the switch and it is not used to route VLAN traffic.

HTH, please do rate all helpful replies,

Mohammed Mahmoud.

New Member

Re: Switch default gateway question

Yes, it is on a layer 2. So hypothetically, this command is not needed as long as the management vlan/subnet is the same accross your network, right?

Cisco Employee

Re: Switch default gateway question

Hi Chris,

You got it!!

Regards,

Ankur

Hall of Fame Super Gold

Re: Switch default gateway question

Ankur

I think that you were a bit too quick in responding and did not think this through well. Mohammed makes a good point aboutn the use of default-gateway. If a layer 2 switch does not configure ip default-gateway then it will be able to communicate with other devices within the same management VLAN/subnet but will not be able to communicate with anything outside of that subnet.

HTH

Rick

Cisco Employee

Re: Switch default gateway question

Hi Rick,

You are absolutely right and I believe I told the original poster about the use on my first post

" ("ip default-gateway" command is basically used when switches are not doing any routing and working as pure layer 2 switch so that when they initiate traffic for some subnet outside their management subnet they can send traffic on default gateway. ) "

But when the original poster again asked that if everything is in same subnet including the switch management vlan then he do not need the default gateway.

I responded "YES YOU GOT IT" . So I believe from original poster's second reply he understood when he need default gateway and when he don't.

Regards,

Ankur

Re: Switch default gateway question

Hi,

Think of it as if the default gateway configured on a PC. It is used in order for the switch management to be reachable across other routed networks, if you are trying to reach your switch from a PC not on the same LAN.

HTH, please do rate all helpful replies,

Mohammed Mahmoud.

New Member

Re: Switch default gateway question

I got it now. Thank you all for your help!

170
Views
10
Helpful
8
Replies
CreatePlease to create content