Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. And see here for current known issues.

New Member

Switch port mode to connect a router

I am just wondering which mode to set the switchport that is connected to a router.

I assume the cable connecting the router is plugged into a port in trunk mode (for all the defined VLANS)? Then I make SVIs with gateways  for the VLANs pointing to routing-interfaces in the router?

So in this way, if a neighboring switch does not know how to route a packet to a unknown IP-address, the packet is sent over the trunk to the other switch. Here the appropriate VLAN SVI is sending the packet to the appropriate router interface. Is this correct or nearly correct?

1 ACCEPTED SOLUTION

Accepted Solutions
Cisco Employee

Re: Switch port mode to connect a router

Hi Atle,

You can connect either a trunk port or an access port to a router. If you choose to use an access port, the router will form an adjacency only over the VLAN defined in that access port. If you choose a trunk port, you can use dot1q encapsulation on subinterfaces to form adjacencies over multiple VLANs. If you using a trunk you would do this type of configuration:

On the switch:

interface gi1/0/1

switchport mode trunk

switchport trunk encapsulation dot1q

switchport trunk allowed vlan a-c

On the router

interface gi0/0.a

encapsulation dot1q a

ip address x.x.x.x y.y.y.y

!

interface gi0/0.b

encapsulation dot1q b

ip address v.v.v.v y.y.y.y

!

interface gi0/0.c

encapsulation dot1q c

ip address z.z.z.z y.y.y.y

Here is a good tutorial on it:

http://www.howtonetwork.net/public/708.cfm

Cisco documentation on the feature:

http://www.cisco.com/en/US/docs/ios/12_0t/12_0t1/feature/guide/8021Q.html

To answer your question, you can use the router as the default gateway for hosts. In the that case it would not be required to have an SVI on the switch except for MGMT purposes. Traffic from hosts would take the L2 path to the router and then the router would make the next forwarding decision for the packet. If you had two routers you could do a trunk to both routers and run a FHRP between them for redundancy.

HTH

Anthony

2 REPLIES
Cisco Employee

Re: Switch port mode to connect a router

Hi Atle,

You can connect either a trunk port or an access port to a router. If you choose to use an access port, the router will form an adjacency only over the VLAN defined in that access port. If you choose a trunk port, you can use dot1q encapsulation on subinterfaces to form adjacencies over multiple VLANs. If you using a trunk you would do this type of configuration:

On the switch:

interface gi1/0/1

switchport mode trunk

switchport trunk encapsulation dot1q

switchport trunk allowed vlan a-c

On the router

interface gi0/0.a

encapsulation dot1q a

ip address x.x.x.x y.y.y.y

!

interface gi0/0.b

encapsulation dot1q b

ip address v.v.v.v y.y.y.y

!

interface gi0/0.c

encapsulation dot1q c

ip address z.z.z.z y.y.y.y

Here is a good tutorial on it:

http://www.howtonetwork.net/public/708.cfm

Cisco documentation on the feature:

http://www.cisco.com/en/US/docs/ios/12_0t/12_0t1/feature/guide/8021Q.html

To answer your question, you can use the router as the default gateway for hosts. In the that case it would not be required to have an SVI on the switch except for MGMT purposes. Traffic from hosts would take the L2 path to the router and then the router would make the next forwarding decision for the packet. If you had two routers you could do a trunk to both routers and run a FHRP between them for redundancy.

HTH

Anthony

New Member

Re: Switch port mode to connect a router

Thanks a lot! This was very clear.

84201
Views
20
Helpful
2
Replies
CreatePlease to create content