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

Author:
phil
Created:
Sunday, April 24th, 2016
Last Updated:
Thursday, January 26th, 2017

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. 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 Prefix Prefix Length Route Type Next Hop Router IP Address Route Owner Metric Administrative Distance Outgoing Interface
0.0.0.0 0 Default 192.168.1.1 Default 1 1 VLAN 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

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.

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!