Skip to main content

VLAN, Link aggregation and VLAN Trunk Configuration in GNS3

In this GNS 3 config example I'm going to show different commands to connect PCs from different networks through routers and switches.

I've already created the network diagram as shown below in the figure. 

If you don't know how to add devices in GNS3, read my previous article HERE

I've added 3 PCs and gave hostnames as YCH1, YCH2, and YCH3. Also two switches YCSW1 and YCSW2. One router YCR1. You can see the IP addresses and ethernet links between all the devices as well as a trunk between switches through f1/2.

I'm going to discuss following questions/topics:
  1. How to assign IP addresses with default gateways?
  2. How to create VLANs (VLAN 10 and VLAN 20) on both switches?
  3. How to assign the switch ports to the VLANs?
  4. How to configure Link Aggregation for the two links between YCSW1 and YCSW2?
  5. How to create VLAN trunk for the aggregated link between SW1 and SW2?
  6. How to assign IP addresses to the router interfaces?

Always save your work after creating any link or connection:

Save configuration for switch and routers: SW#write memory [or use 'wr' in short]
Save configuration for PC: PC#save

Assigning IP addresses

We use the following complete command to assign IP address to a PC

ip [ip address] [subnet mask] [gateway address]

You can test if it got assigned or not by show ip command

Let's assign IP addresses to our PCs.

Assigning IP address for YCH1

Assigning IP address for YCH2

Assigning IP address for YCH3

Creating VLAN

To show current configuration use following command:

YCSW1#show running-config

To configure Switch use following command:

YCSW1#configure terminal (or config t in short)

Let's Create 2 VLANs on YCSW1:

To create VLAN on switch use following commands:

YCSW1(config)#vlan 10
YCSW1(config)#vlan 20


To display VLAN status use following command:

YCSW1#show vlan-switch

Let's Create 2 VLANs on YCSW2: 


Assigning the switch ports to the VLANs on YCSW1

To add interface f1/1 to VLAN 10 use following command:

YCSW1(config)interface fastethernet 1/1 [or int f1/1 in short]
YCSW1(config-if)switchport access vlan 10

To add interface f1/2 to VLAN 20 use following command:

YCSW1(config)interface fastethernet 1/2
YCSW1(config-if)switchport access vlan 20


Assigning the switch ports to the VLANs on YCSW2

To add interface f1/1 to VLAN 10 use following command:

YCSW2(config)interface fastethernet 1/1
YCSW2(config-if)switchport access vlan 10

To add interface f1/2 to VLAN 20 use following command:

YCSW2(config)interface fastethernet 1/2
YCSW2(config-if)switchport access vlan 20


Link Aggregation Configuration on YCSW1

To display VLAN status use following command:

YCSW1#show vlan-switch

To display STP status use following command:

YCSW1#show spanning-tree vlan 1

To disable STP use following command:

YCSW1(conf)#no spanning-tree vlan 1

To create a logical port for link aggregation use following command:

YCSW1(conf)#interface port-channel 1

To add two physical links (via their interfaces) to the logical link use following command:

YCSW1(conf)#interface fastethernet 1/10
YCSW1(conf-if)#channel-group 1 mode on
YCSW1(conf)#interface fastethernet 1/11
YCSW1(conf-if)#channel-group 1 mode on

Link Aggregation Configuration on YCSW2

To display VLAN status use following command:

YCSW2#show vlan-switch

To display STP status use following command:

YCSW2#show spanning-tree vlan 1
To disable STP use following command:

YCSW2(conf)#no spanning-tree vlan 1
To create a logical port for link aggregation use following command:

YCSW2(conf)#interface port-channel 1

To add two physical links (via their interfaces) to the logical link use following command:

YCSW2(conf)#interface fastethernet 1/10
YCSW2(conf-if)#channel-group 1 mode on
YCSW2(conf)#interface fastethernet 1/11
YCSW2(conf-if)#channel-group 1 mode on

VLAN trunk Configuration on YCSW1

To create f1/1 as a trunk port for VLAN 10 and 20 use following commands:

YCSW1(config)interface fastethernet 1/1
YCSW1(config-if)switchport mode trunk
YCSW1(config-if)switchport trunk allowed vlan add 10
YCSW1(config-if)switchport trunk allowed vlan add 20


VLAN trunk Configuration on YCSW2

To create f1/1 as a trunk port for VLAN 10 and 20 use following commands:

YCSW2(config)interface fastethernet 1/1
YCSW2(config-if)switchport mode trunk
YCSW2(config-if)switchport trunk allowed vlan add 10
YCSW2(config-if)switchport trunk allowed vlan add 20

Assigning IP addresses to YCR1 interfaces

To configure IP address for YCR1 use following command:

YCR1(conf)#interface fastethernet 0/0
YCR1(conf-if)#ip [ip address] [subnet mask]
YCR1(conf-if)#no shutdown

Always use no shutdown command to keep it in running state

To check router interface configuration use following command:

YCR1#show ip interface brief


Let me know what do you think about the article in comment section. Thank you!


Comments

Quick Search Wikipedia

Search results

Send me your feedback

Name

Email *

Message *