Cisco IOS: Trunking VLANs and subinterfaces.

So the usual way of connecting one network device to another is the physical approach – you plug both ends in, and that’s it. One service works over one physical cable, easy and uncomplicated. I love 1:1 relationships, life is simple.

Sometimes though, you end up having to connect several connections with only one physical cable – how does that work? We call it trunking, and this requires a little bit of configuration.

Let’s start with a sample scenario and work from there.

A router with two interfaces is required to provide an uplink to three separate services.

So we have:
1. FastEthernet0/0 as the uplink to the Internet, and
2. FastEthernet1/0 as the link to the three services.

There are three ports waiting to be connected on a patch panel, one for each service.

Here’s what we need:

  • Subinterfaces: Subinterfaces are required to be configured on the original physical interface.

    In our example, FastEthernet1/0 will have FastEthernet1/0.100, FastEthernet1/0.200 and FastEthernet1/0.300.

  • VLANs: VLANs are required to be allocated on your network, and configured on the subinterfaces – ISL or 802.1q, both work fine.

    Note: try to use the same number for the VLAN and subinterface – different numbers work fine, but I like to keep things simple.

    Therefore, we have FastEthernet1/0.100 using VLAN 100 on 802.1q, and the same for VLANs 200/300.

  • Switch trunk: We need a switch if there are multiple physical handoffs.

    There are three separate physical handoffs for three services, so we need a switch to connect to the handoffs. It doesn’t make sense for us to have one physical cable coming out of the router, then magically split itself into three connections.

    Every handoff requires a physical connection, so we need one port (configured as trunk) to handle the incoming router connection, and another three ports (configured as access) going to the various services.

Now that we have the concepts explained, let’s have a look at the actual configuration.

Router sample config


interface FastEthernet1/0.100
description Service A configured 29Aug2012 by K
encapsulation dot1Q 100
ip address 192.168.25.2 255.255.255.252
!
interface FastEthernet1/0.200
description Service B configured 29Aug2012 by K
encapsulation dot1Q 200
ip address 10.0.0.1 255.255.255.252
!
interface FastEthernet1/0.300
description Service C configured 29Aug2012 by K
encapsulation dot1Q 300
ip address 192.168.29.6 255.255.255.252
end

Switch sample config


interface FastEthernet0/1
description dot1q trunk from routerA configured 29Aug2012 by K
switchport trunk encapsulation dot1q
switchport trunk allowed vlan 1,100,200,300
switchport mode trunk
speed 100
!
interface FastEthernet0/2
description Handoff for service A configured 29Aug2012 by K
switchport access vlan 100
switchport mode access
!
interface FastEthernet0/3
description Handoff for service B configured 29Aug2012 by K
switchport access vlan 200
switchport mode access
!
interface FastEthernet0/4
description Handoff for service C configured 29Aug2012 by K
switchport access vlan 300
switchport mode access
!

Fairly simple, not rocket science by any stretch of imagination. Hope this helps, and feel free to comment.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.