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 *

Popular posts from this blog

Multi-layer Sequence Diagrams Examples

What is System Sequence Diagram? A sequence diagram shows object interactions (communications) set in time sequence. It shows the objects and classes tangled in the state and the order of communications exchanged between the objects required to carry out the functionality of the state. They are typically related with use case understandings in the Logical or Rational View of the system under progress. Sequence diagrams are occasionally called event diagrams or even event scenarios. A sequence diagram displays, as parallel vertical lines which means lifelines, different procedures or objects that live instantaneously, and, as horizontal arrows, the communications exchanged among them, in the same direction in which they happen. This permits the requirement of modest runtime situations in a graphical style. In short… Sequence Diagrams includes: The interaction or the communication that takes place in an association that either understands a use case (generic diagrams) H...

How to Add PCs, Routers, Switches and Create a Network in GNS3?

What is GNS3? In computing language, an emulator is software or hardware that allows one computer (the host) to act like another computer (the guest).  An emulator permits the host to run software or use exterior devices intended for the guest.  Graphical Network Simulator 3 (GNS3) is a network software emulator.  It allows the amalgamation of virtual and actual devices, used to simulate compound networks. It practices Dynamips emulation to simulate the Cisco IOS. GNS3 is used by many large corporations including Walmart, NASA and AT&T. GNS3 is also widespread for training of network skilled certification assessments.  Let's start discussing on how to use GNS3 in Linux OS. You can see in the image that if you've gns3 installed in the virtual OS environment or even on local PC, you can just search for it and open it by clicking on it. When you click on the GNS3, it's gonna pop up new project window. If you've saved project, you c...