I’ve been working on my home lab and finally have a few virtual machines running which will require Internet access (e.g Windows Server Update Services). My Cisco SG300 switch is setup for layer 3 mode and I have two VLANs currently configured on it with more to come as my lab environment grows.
An important configuration is to setup the default route for IP traffic on the SG300. If this is not setup packets will not be able to route out to their destination, in this case the Internet.
Command Line Configuration
Configuring the default route from the command line is very simple, first let us look at the existing routes on my switch.
SG300-20#show ip route Maximum Parallel Paths: 1 (1 after reset) IP Forwarding: enabled Codes: > - best, C - connected, S - static C 172.16.1.0/24 is directly connected, vlan 100 C 192.168.1.0/24 is directly connected, vlan 1 SG300-20#
As you can see there are two routes currently known, both of which are directly connected. There is no default route so if I try to connect to the Internet from a virtual machine in VLAN 100 it will fail as per the screenshot below.
Now let us configure the default route and test Internet access again. To configure the static route we first need to enter config mode and then leverage the IP route command.
SG300-20#configure terminal SG300-20(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.1
Now that we have configured the route let us check our routing table again.
SG300-20#show ip route Maximum Parallel Paths: 1 (1 after reset) IP Forwarding: enabled Codes: > - best, C - connected, S - static S 0.0.0.0/0 [1/1] via 192.168.1.1, 16:37:43, vlan 1 C 172.16.1.0/24 is directly connected, vlan 100 C 192.168.1.0/24 is directly connected, vlan 1 SG300-20#
Finally we will test Internet connectivity from the virtual machine to confirm the switch is correctly forwarding packets to the next router.