Showing results for 
Search instead for 
Did you mean: 

Connecting a Layer 3 2960x Catalyst Switch ( With different VLANs) to a Router - Using Trunk or Using no Switchport


Hi Team,


           I have  a query regarding connectivity to a router with a layer 3 switch. I want to  configure a L3 switch( Catalyst 2960x switch) with different Vlans with ip routing enabled. Also i want to that switch with a Cisco 2911 Router. My query is what command i need to give to connect to router, whether no switch port  or i can use trunk command with allowing vlans. if i give trunk command . what i need to configure on router to make the ping happen?


         Also should i give ip route or default gateway command so that all the vlans ip address can ping to a router which is gateway to the network.


         Thank you 


4 Replies 4

Reza Sharifi
Hall of Fame Master Hall of Fame Master
Hall of Fame Master


I don't think the 2960x supports routed port.  So, if all your SVIs are configured on the 2960x, you just need a vlan with an SVI configured as access mode connected to the router.  On the router, you only need an IP address. Also, make sure your 2960x supports inter-vlan routing as these switches are natively layer-2 only.


In connecting the switch to a router there is a question to address and that is which device do you want to do the inter vlan routing. It sounds like you have decided that you want your 2960 to do inter vlan routing. I agree with Reza that you need to check and verify that your switch does support that.


You can configure ip default-gateway on the switch. But whether it gets used or not depends on whether ip routing is enabled. If ip routing is enabled then the configured default-gateway is ignored. If ip routing is enabled then you need to configure a default route ip route <next-hop>


If you are doing inter vlan routing on the switch and then routing to the router you will need to configure on the router static routes for the subnets used in inter vlan routing.







we are going to take a look at routing between VLANs. When we want communication between different VLANs we’ll need a device that can do routing. We could use an external router but it’s also possible to use a multilayer switch (aka layer 3 switches).
SW1 has two VLANs so we have two different subnets. If we want communication between these VLANs we’ll have to use a device that can do routing. In this example we’ll use a router for the job. R1 will need access to both VLANs so we’ll create a 802.1Q trunk between SW1 and R1. Here’s how to configure this:
SW1(config)#interface fa0/3
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk allowed vlan 10,20
This is how we configure SW1. Make interface fa0/3 a trunk port and for security measures I made sure that only VLAN 10 and 20 are allowed.
R1(config)#interface fa0/0.10
R1(config-subif)#encapsulation dot1Q 10
R1(config-subif)#ip address
R1(config)#interface fa0/0.20
R1(config-subif)#encapsulation dot1Q 20
R1(config-subif)#ip address
Create two sub-interfaces on the router and tell it to which VLAN they belong. Don’t forget to add an IP address for each VLAN.
R1#show ip route

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers