Sie sind auf Seite 1von 4

Experiment No.

1. In Cisco Packet Tracer, create the network topology as shown below:

2. Create 2 VLANs on the switch: VLAN 10 and VLAN 20. You can give them custom
names.

Switch#config ter
Switch(config)#vlan 10
Switch(config-vlan)#name SALES
Switch(config-vlan)#vlan 20
Switch(config-vlan)#name IT

3. Add interfaces into the VLANs. Remember each VLAN is viewed as separate broadcast
domain.

Just before you configure, have in mind that switch ports could be either access or trunk. An
access port is assigned to a single VLAN . These ports are configured for switch ports that
connect to devices with a normal network card, for example a host in a network. A trunk port on
the other hand is a port that can be connected to another switch. This port can carry traffic of
multiple VLANs.
So in our case, we’ll configure switch interfaces fa0/1 through fa 0/4 as access ports to connect
to our PCs. Here, int fa0/1 and int fa0/2 are assigned to VLAN 10 while int fa0/3 and int fa0/4
are assigned to VLAN 20.
Switch Interface fa0/5 will be configured as trunk port, as it will be used to carry traffic between
the two VLANs.

Switch>en
Switch#
Switch#config term

Switch(config)#int fa0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10

Switch(config-if)#int fa0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10

Switch(config-if)#int fa0/3
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20

Switch(config-if)#int fa0/4
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20

Its worth noting that we could have configured all the above interfaces as access ports using int
range command as:

Switch(config-if)#int range fa0/1-4


Switch(config-if-range)#switchport mode access

In the above commands, we have specified an interface range and then proceeded to configure all
the ports specified as access ports.

int fa0/5 is configured as trunk and will be used to for inter-VLAN communication

Switch#
Switch(config)#int fa 0/5
Switch(config-if)#switchport mode trunk

The next thing is to:

3. Assign static IP addresses to the three hosts in the separate VLANs. Each computer is on a
separate logical network. So remember to make the network IDs different.

For PC1: IP add 192.168.1.10 Subnet mask 255.255.255.0 Default gateway 192.168.1.1

PC2: IP address 192.168.1.20 Subnet mask 255.255.255.0 Default gateway 192.168.1.1


PC3: IP address 192.168.2.10 Subnet mask 255.255.255.0 Default gateway 192.168.2.1

PC4: IP address 192.168.2.20 Subnet mask 255.255.255.0 Default gateway 192.168.2.1

At this point let’s try to test connectivity within VLANs and between VLANs

To test communication between hosts in the same VLAN:

Ping PC2 from PC1 both in VLAN 10. Ping test should be successful.

To test connectivity between hosts in different VLANs:

Ping PC3 in VLAN 20 from PC1 in VLAN 10. Ping here will definitely fail. Why? Because
inter-VLAN routing is not yet enabled. Hope you can see how we’ve used VLANs to place the
hosts into two logical networks which can be viewed as separate broadcast domains.

Now, in order to allow the hosts in the two VLANs to communicate, we need to do something
extra.We’ll configure the router to permit inter-VLAN communication.Let’s do that:

3.Configure inter-VLAN routing on the router

We’ll configure the router so that it will enable communication between the two vlans via a
single physical interface. How is this made possible? We’ll divide the single physical interface
on the router into logical interfaces(sub interfaces). Each sub interface will serve as a default
gateway for one of the VLANs. This scenario is called router on a stick (R.O.A.S) and will
allow the VLANs to communicate through the single physical interface.

Its worth to note that we can’t assign an IP address to the router’s physical interface that we
subdivide into logical sub interfaces.We’ll instead assign IP addresses to the sub interfaces.

So let’s do router configurations:

Router>
Router>en
Router#config term

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#int fa0/0
Router(config-if)#no shutdown

Router(config-if)#int fa0/0.10
Router(config-subif)#encapsulation dot1q 10
Router(config-subif)#ip add 192.168.1.1 255.255.255.0
Router(config-subif)#

Router(config-subif)#int fa0/0.20
Router(config-subif)#encapsulation dot1q 20
Router(config-subif)#ip add 192.168.2.1 255.255.255.0
As you can notice from above, the routers physical interface fa0/0 was subdivided into two sub-
interfaces(interface fa0/0.10 and interface fa0/0.20) , which are then configured as trunk
interfaces and given IP addresses.

4. Test inter-VLAN connectivity.

Here we’ll test connectivity between computers in different VLAN s . Don’t forget that its the
router that enables inter-VLAN routing.

Ping PC3 in VLAN 20 from PC1 in VLAN 10. If everything is well configured then ping should
be successful.

Subnet mask
An IP address is divided into two parts: network and host parts. For example, an IP class A address consists of 8 bits
identifying the network and 24 bits identifying the host. This is because the default subnet mask for a class A IP
address is 8 bits long. (or, written in dotted decimal notation, 255.0.0.0). What does it mean? Well, like an IP address,
a subnet mask also consists of 32 bits. Computers use it to determine the network part and the host part of an
address. The 1s in the subnet mask represent a network part, the 0s a host part.

Computers works only with bits. The math used to determine a network range is binary AND.

Let’s say that we have the IP address of 10.0.0.1 with the default subnet mask of 8 bits (255.0.0.0).
First, we need to convert the IP address to binary:

IP address: 10.0.0.1 = 00001010.00000000.00000000.00000001


Subnet mask 255.0.0.0 = 11111111.00000000.00000000.0000000

An example will help you understand the subnetting concept. Let’s say that we need to subnet a class C
address 192.168.0.0/24. We need two subnets with 50 hosts per subnet. Here is our calculation:

1. Since we need only two subnets, we need 2 subnet bits. In our case, this means that we will take one bit from the
1

host part. Here is the calculation:

First, we have a class C address 192.168.0.0 with the subnet mask of 24. Let’s convert them to binary:

192.168.0.0 = 11000000.10101000.00000000.00000000
255.255.255.0 = 11111111.11111111.11111111.00000000

We need to take a single zero from the host part of the subnet mask. Here is our new subnet mask:

255.255.255.128 = 11111111.11111111.11111111.10000000

Remember, the ones in the subnet mask represent the network.

2. We need 50 hosts per subnet. Since we took one bit from the host part, we are left with seven bits for the hosts. Is
it enough for 50 hosts? The formula to calculate the number of hosts is 2 – 2, with y representing the number of host
y

bits. Since 2 – 2 is 126, we have more than enough bits for our hosts.
7

3. Our network will look like this:

192.168.0.0/25 – the first subnet has the subnet number of 192.168.0.0. The range of IP addresses in this subnet
is 192.168.0.0 – 192.168.0.127.

192.168.0.128/25 – the second subnet has the subnet number of 192.168.0.128. The range of IP addresses in this
subnet is 192.168.0.128 – 192.168.0.255.

Das könnte Ihnen auch gefallen