How To Set Default Gateway Layer 3 (L3) on Cisco SG300 Switch

Author:
phil
Created:
Sunday, April 24th, 2016
Last Updated:
Friday, March 02nd, 2018

Disclaimer: Accessing the information on this page means you agree to the Sites Terms of Service


If you've run across this page, chances are you're looking for a way to set the default gateway on a Cisco SG300 family switch. When the switch is in layer 2 (L2) mode, it's a piece of cake. Administration -> Interface and there it is, right in front of you. (Basically...)

When the switch is set to Layer 3 (L3) however, the entire Administrative Interface option disappears completely and moves down to the IP Configuration section. That's because L3 deals with IPs, L2 deals with MACs, each port / vlan can have it's own IP yadda yadda and technically, you don't need a default gateway on a L3 device, but when you do... Point is, there is no clear Las Vegas lights flashing, in your face, obvious sign for where to add a Default Gateway. If you're a networking guru used to Ciscos catalyst switches, it's probably a no-brainer, but for the small business piddly folks like me, I was clueless. I won't go into detail as to why I needed a default gateway because 99% of people who have these switches, probably won't ever need to set a default gateway, but just in case you do, it's quite simple: "Set it in the IP Configuration -> IPv4 Routes section".

I searched for an answer to this question, but never found it. I ended up stumbling across it on my own and decided to share my findings.

How to set the default gateway through the web interface

1) Click IP Configuration
2) Click IPv4 Routes
3) Click the Add button

Inside the dialog popup for adding a new route, add the following settings:

Destination IP Prefix:

0.0.0.0

Prefix length:

0

Route Type:

Remote

Next Hop Router IP Address: (Your default gateway IP address. For example:)

192.168.1.1

Metric: (This is defaulted to 1, leave it)

1

And that's it!

When you look at the IPv4 Static Routing Table:

Destination IP PrefixPrefix LengthRoute TypeNext Hop Router IP AddressRoute OwnerMetricAdministrative DistanceOutgoing Interface
0.0.0.00Default192.168.1.1Default11VLAN 1

Notice the Route Type is set to "Default". This represents the default route to the default gateway.

Interestingly, if you use Telnet or SSH instead of the web interface, there is a command to specifically set the "default-gateway". When you use this command, it simply sets up the route as shown above.

Pretty simple once you know where and how to set it!

Post Comment

Comments

To says that Cisco people especially those who redacted the user manual are just dumb stupid people is an understatement.
Thank you so much for this.

I would advise any small business manager who is not into network administration to stay at large from Cisco switches. As said by Phil, Cisco does not want you to purchase their hardware and make sure you will regret your purchase as I regret mine every single day. The thing is a nuclear power plant to run and there is virtually no user manual as there is not a single page in the 327 pages administration manual that the average person can understand.
Again, my advice is stay at large from Cisco switches unless you are a network administration specialist.

Hi,

Just came across your site while searching for set gateway cisco sg300 in router mode. I knew where it was in L2 mode, but could not find it in L3. But now, with help from your site, I know! Thanks, this saves me a reset to L2 and can now experiment further with L3 mode!

Glad it worked for you too Renzo :-)

I find it odd that the CLI has the ability to set the default gateway, but by setting it to L3 mode, there's no "clear" way to set it from the admin interface. I guess that's where you have to know networking (which I'm not a guru of) to really understand the reasoning behind it.

Thanks still useful in 2023!

Thanks for this, I set the IP address to static. (Which is also a pain!) Then I could no longer access the switch from our main office!!!

L3 issues not defaulting to the main gateway I Guess...

Saved me A LOT of TIME, & frustration of having to go to the remote site every time I want to manage the switch!

This was very helpful as the Layer 3 capabilities of the router were causing issues to say the least.

8)

Thanks, I was exactly needed this info, I really appreciate!

Thanks for the post, I had a similar issue with SG350, and was able to set Gateway by going through the setup wizard (having already manually set everything else first).

I still wanted to know how to do it manually, so thanks for your informative post.

Thanks, that worked!

Thanks for sharing, i spent the best part of a day searching the internet for an answer. Great article and to the point. Cheers

Thank you so much for taking the trouble to publish this information.

Best regards,

Richard