Understanding LANS and VLANS

Answered Question
Dec 16th, 2010

Hi,

I have a Cisco switch (WS-C2950-24) and a third party router (but it does support VLANS, and I hope it will do!). I also have the ICND 2 book which I am using as a guide.

I am trying to understand how to configure VLANS and what is written sort of makes sense. So as an example...

FA 0/1 - 4 are in VLAN 2 and have devices attached in the 192.168.40.x /24 range ( the switch management address is also in this range )

FA 0/5 - 8 are in VLAN 3 and have devices attached in the 192.168.10.x /24 range

FA 0/9 - 24 are in VLAN1 and are currently not used

These basics seem okay to me but I now want to configure the two to talk to each other via the router (router on a stick?) And more importantly, access the internet via the router/ADSL Modem. And here's where I start to struggle...

Which port would the router physically plug into?

What IP address might the router be? Would it sit on either of the VLANS and have an IP address in that range (how then does the other VLAN talk to it?)?

What routing would i need to set (on the router and all the other devices)?

Thanks.

Tony

I have this problem too.
0 votes
Correct Answer by jlajuarez about 3 years 3 months ago

Hi,

If i understand your situation correctly, you need to have a port on the switch free from a vlan configuration. This port will serve as your trunk or the "stick" going to your router.

Answers to your questions:

1. The router should physically plug into the port where you have configured the trunk.

2. The addressing scheme for the router / router interface should be different from all your other vlans. Besides, your router doesn't need to have an ip address if you are routing local vlans. This is true if you will be configuring sub-interfaces on a particular interface on your router (i'll show this later)

3. You do not need to have a routing protocol to have all vlans communicate.

4.  In order to connect to the internet, your router must have static routing enabled on your router. But i'll show you how to configure the trunk first.

Since you have already configured the VLANs on the switch, we can skip right to creating the trunk to allow your vlans to "talk" to each other.

Assuming that we have Cisco devices (router and switches) in this case. But since it's not a Cisco router, i'll just add a simple explanation on every line of code so you will understand the concept.

Now, FA0/24 is not part of any VLAN on your switch, right?. Ok.. so plug your router interface (for example FA1/0) in this port. Now you have a physical connection for a trunk that you will be configuring later on.

So the physical connection of your switch to the router is now SWITCH FA0/24 <-----> ROUTER FA1/0

First you configure sub interfaces on FA1/0 on your Router to tag your VLANS and use the 802.1q configuration for VLAN tagging. Here is an example configuration base on your network addressing scheme.

Using the Cisco IOS configuration on the Cisco router:

Router>Enable

Router#Config Terminal

Router(config)# Interface Fa1/0.2 ----------->this will create the sub interface FA1/0.2. This is your VLAN 2

Router(config-subif)#encapsulation dot1q 2 -------->this will encapsulate the subinterface and will tag it as a vlan interface

Router(config-subif)#ip address 192.168.40.1 255.255.255.0 ----> the ip address 192.168.40.1 will serve as your gateway for all hosts connected on vlan 2 later on when the configuration is done.

Router(config)# Interface Fa1/0.3 ----------->this will create the sub interface FA1/0.3. This is your VLAN 3

Router(config-subif)#encapsulation dot1q 3 -------->this will encapsulate the subinterface and will tag it as a vlan interface

Router(config-subif)#ip address 192.168.10.1 255.255.255.0 ----> the ip address 192.168.10.1 will serve as your gateway for all hosts connected on vlan 2 later on when the configuration is done.

Router(config-subif)# exit

Router(config)#interface fa1/0 ----> to configure the FA1/0 interface

Router)config)#no shutdown -----> to "up" the port FA1/0

Second is to configure the trunk..

Now let's proceed to the switch..

Switch>Enable

Switch#configure terminal ----> to go to the global configuration mode

Switch(config) interface fa0/24 ------> to go to the configuration mode of the interface FA0/24. remember that the FA0/24 of the switch port is where we plugged the router.

Switch(config-if)#switchport mode trunk ------> this will configure the port as the trunk of all your vlans on the switch

Switch(config-if)#switchport trunk allowed vlan all -----> this configuration will allow ALL vlans to use the trunk (FA0/24). This will basically allow all vlans to "talk"

Switch(config-if)#exit

Switch(config)#exit

Hope this helps you in understanding vlan. Good luck. Feel free to reply if there are any more issues. I'll do all i can to help out.

Don't forget to give ratings!!

Regards...

  • 1
  • 2
  • 3
  • 4
  • 5
Average Rating: 5 (3 ratings)
Correct Answer
jlajuarez Thu, 12/16/2010 - 18:44

Hi,

If i understand your situation correctly, you need to have a port on the switch free from a vlan configuration. This port will serve as your trunk or the "stick" going to your router.

Answers to your questions:

1. The router should physically plug into the port where you have configured the trunk.

2. The addressing scheme for the router / router interface should be different from all your other vlans. Besides, your router doesn't need to have an ip address if you are routing local vlans. This is true if you will be configuring sub-interfaces on a particular interface on your router (i'll show this later)

3. You do not need to have a routing protocol to have all vlans communicate.

4.  In order to connect to the internet, your router must have static routing enabled on your router. But i'll show you how to configure the trunk first.

Since you have already configured the VLANs on the switch, we can skip right to creating the trunk to allow your vlans to "talk" to each other.

Assuming that we have Cisco devices (router and switches) in this case. But since it's not a Cisco router, i'll just add a simple explanation on every line of code so you will understand the concept.

Now, FA0/24 is not part of any VLAN on your switch, right?. Ok.. so plug your router interface (for example FA1/0) in this port. Now you have a physical connection for a trunk that you will be configuring later on.

So the physical connection of your switch to the router is now SWITCH FA0/24 <-----> ROUTER FA1/0

First you configure sub interfaces on FA1/0 on your Router to tag your VLANS and use the 802.1q configuration for VLAN tagging. Here is an example configuration base on your network addressing scheme.

Using the Cisco IOS configuration on the Cisco router:

Router>Enable

Router#Config Terminal

Router(config)# Interface Fa1/0.2 ----------->this will create the sub interface FA1/0.2. This is your VLAN 2

Router(config-subif)#encapsulation dot1q 2 -------->this will encapsulate the subinterface and will tag it as a vlan interface

Router(config-subif)#ip address 192.168.40.1 255.255.255.0 ----> the ip address 192.168.40.1 will serve as your gateway for all hosts connected on vlan 2 later on when the configuration is done.

Router(config)# Interface Fa1/0.3 ----------->this will create the sub interface FA1/0.3. This is your VLAN 3

Router(config-subif)#encapsulation dot1q 3 -------->this will encapsulate the subinterface and will tag it as a vlan interface

Router(config-subif)#ip address 192.168.10.1 255.255.255.0 ----> the ip address 192.168.10.1 will serve as your gateway for all hosts connected on vlan 2 later on when the configuration is done.

Router(config-subif)# exit

Router(config)#interface fa1/0 ----> to configure the FA1/0 interface

Router)config)#no shutdown -----> to "up" the port FA1/0

Second is to configure the trunk..

Now let's proceed to the switch..

Switch>Enable

Switch#configure terminal ----> to go to the global configuration mode

Switch(config) interface fa0/24 ------> to go to the configuration mode of the interface FA0/24. remember that the FA0/24 of the switch port is where we plugged the router.

Switch(config-if)#switchport mode trunk ------> this will configure the port as the trunk of all your vlans on the switch

Switch(config-if)#switchport trunk allowed vlan all -----> this configuration will allow ALL vlans to use the trunk (FA0/24). This will basically allow all vlans to "talk"

Switch(config-if)#exit

Switch(config)#exit

Hope this helps you in understanding vlan. Good luck. Feel free to reply if there are any more issues. I'll do all i can to help out.

Don't forget to give ratings!!

Regards...

tony-payne Fri, 12/17/2010 - 15:07

Thanks for the answer, very useful. I do remember this when I did my CCNA now you've described it. The problem is that I did it a couple of years ago and this is the first time I've picked up a piece of Cisco kit since! I could probably do with going over the whole of the coursework again.

ciscostudent561 Sun, 01/02/2011 - 07:07

incredible doc there bro, its very insightful and answered my own questions about vlans!!

Actions

Login or Register to take actions

This Discussion

Posted December 16, 2010 at 2:18 PM
Stats:
Replies:3 Avg. Rating:5
Views:1657 Votes:0
Shares:0
Tags: No tags.

Discussions Leaderboard