VLAN lar switch üzerinde yapılan mantıksal gruplamalardır,her vlan ayrı bir broadcast domain dir.
Default olarak bir switch üzerindeki bütün portlar VLAN 1 dedir.VLAN 1 silinemez,değiştirilemez ve yeniden adlandırılamaz.
VLAN'lar Static ve Dinamik olmak üzere ikiye ayrılırlar.
Static vlan aşamasında vlan oluşturur ve portlarıda vlan'a atarız.
VLAN oluşturmak için router ımıza bağlı olan switch imizde aşagıdaki komutları gireriz;
Kod:
Configure Terminal moddayken;
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#name pazarlama
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#name muhasebe
Switch(config-vlan)#exit
Yukardaki komutlarla VLAN larımızı oluşturduk ve isimlerini atamış olduk.
Vlan ımızın oluştugunu enable mod'dayken show vlan komutunu yazarak görebiliriz.
Switch(config)#exit
%SYS-5-CONFIG_I: Configured from console by console
Kod:
Switch#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Fa0/23, Fa0/24
Gig1/1, Gig1/2
10 pazarlama active
20 muhasebe active
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
--More—
Daha sonra oluşturduğumuz VLAN ları switch in portlarına atarız.
Kod:
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface fastethernet 0/3
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface fastethernet 0/4
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#exit
Tekrar
show vlan dediğimizde switch e bağlı olan
3. ve 4. portların vlan lara atandıgını görücegiz. Kod:
Switch#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/5, Fa0/6
Fa0/7, Fa0/8, Fa0/9, Fa0/10
Fa0/11, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gig1/1, Gig1/2
10 pazarlama active Fa0/3, Fa0/4
20 muhasebe active
Daha sonra da VLAN 20 ye bağlı oldugu port u atarız.
Switch(config)#interface fastEthernet 0/5
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Kod:
Switch#sh vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/6, Fa0/7
Fa0/8, Fa0/9, Fa0/10, Fa0/11
Fa0/12, Fa0/13, Fa0/14, Fa0/15
Fa0/16, Fa0/17, Fa0/18, Fa0/19
Fa0/20, Fa0/21, Fa0/22, Fa0/23
Fa0/24, Gig1/1, Gig1/2
10 pazarlama active Fa0/3, Fa0/4
20 muhasebe active Fa0/5
1002 fddi-default active
1003 token-ring-default active
1004 fddinet-default active
1005 trnet-default active
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
1002 enet 101002 1500 - - - - - 0 0
1003 enet 101003 1500 - - - - - 0 0
1004 enet 101004 1500 - - - - - 0 0
1005 enet 101005 1500 - - - - - 0 0
Switch#
Router 'ımıza direk bağlı olan switch'imizde vlan'ları oluşturmuş olduk böylece.
İkinci switch'imizi de
client switch yapıcaz,bu arada switch ler 3 modda çalışırlar,eger herganbi bir müdahalede bulunmazsanız her switch default ta
server switch'tir.
Biz bu konfigurasyonumuzda ilk switch imize dokunmadık ve server olarak bıraktık.
Şimdiki switch'imizi
client switch olarak ayarlıyacagız.
Client switchler vlan bilgisini alırlar ancak server switchler gibi vlan bilgisini dağıtmazlar.
Switchlerimizin durumlarını öğrenmek için enable moddayken
show vtp status komutunu kullanırız.
Kod:
Switch#sh vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 64
Number of existing VLANs : 5
VTP Operating Mode : Server
VTP Domain Name :
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x7D 0x5A 0xA6 0x0E 0x9A 0x72 0xA0 0x3A
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
Local updater ID is 0.0.0.0 (no valid interface found)
Switch#
Yukardaki switchimiz de gördügünüz gibi şu anda switch server modda biz bunu client moda alıcaz.
Enable modda
vlan database yazıdıktan sonra
vtp client komutu yeterli olucaktır.
veya config mod'da
vtp mode client yazılabilinir.
( yanlızca birini yazmak yeterlidir
)
Kod:
Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.
Switch(vlan)#vtp client
Setting device to VTP CLIENT mode.
Exit deyip şimdi bir
show vtp status diyelim,
Kod:
Switch#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 64
Number of existing VLANs : 5
VTP Operating Mode : Client
VTP Domain Name :
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x7D 0x5A 0xA6 0x0E 0x9A 0x72 0xA0 0x3A
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
Switch#
Görmüş oldugunuz gibi switch'imizi
client moda aldık ve buda artık bu switch imizin
vlan bilgilerini server switchimizden alıcagı anlamını taşımaktadır.
Switch imizi domain içine almamız içinse aşagıdaki komutları kullanırız;
SwitchCiscoTR.com#vlan database
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.
Kod:
switchciscotr.com(vlan)#vtp domain ciscotr.com
Changing VTP domain name from NULL to ciscotr.com
switchciscotr.com(vlan)#exit
Tekrardan
show vtp status komutunu girdigimizde client olan switch imizin domain içine alınmış oldugunu görmekteyiz.
Kod:
switchciscotr.com#sh vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 64
Number of existing VLANs : 5
VTP Operating Mode : Client
VTP Domain Name : ciscotr.com
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x53 0xEB 0xCC 0xA4 0xA5 0xEB 0x18 0xC5
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
switchciscotr.com#
Bu iki switchimizin birbirine bağlı olan portlarına
switchport mode trunk komutunu girmemiz gerekir.
Router Konfigurasyonu ve DHCP
Şimdide router ımıza bağlı olan switchimizin bağlı oldugu porta
switchport mode trunk komutunu gireriz.
Kod:
Continue with configuration dialog? [yes/no]: NO
Press RETURN to get started!
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname ciscotr.com
ciscotr.com(config)#
Enter configuration commands, one per line. End with CNTL/Z.
ciscotr.com(config)#interface fastethernet 0/1
ciscotr.com(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to upciscotr.com(config-if)#exit
Daha sonra router ımızda sub interface leri oluştururuz.Bunun için önce router ımızın f
astethernet 0/0 ına no shutdown deriz.
Daha sonrada sub interfacelerimizi oluştururuz;
Kod:
ciscotr.com#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
ciscotr.com(config)#interface fastethernet 0/0
ciscotr.com(config-if)#no shutdown
ciscotr.com(config-if)#exit
ciscotr.com(config)#interface fastethernet 0/0.1
%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to upciscotr.com(config-subif)#encapsulation dot1q 10
ciscotr.com(config-subif)#ip address 192.168.10.1 255.255.255.0
ciscotr.com(config-subif)#exit
ciscotr.com(config)#interface fastethernet 0/0.2
%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to upciscotr.com(config-subif)#encapsulation dot1q 20
ciscotr.com(config-subif)#ip address 192.168.20.1 255.255.255.0
ciscotr.com(config-subif)#exit
ciscotr.com(config)#interface fastethernet 0/0.3
%LINK-5-CHANGED: Interface FastEthernet0/0.3, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.3, changed state to upciscotr.com(config-subif)#encapsulation dot1q 30
ciscotr.com(config-subif)#ip address 192.168.30.1 255.255.255.0
ciscotr.com(config-subif)#exit
ciscotr.com(config)#
Oluşturduğumuz
sub interface leri hemen
show run komutuyla inceleyebiliriz.
Kod:
ciscotr.com#show running-config
Building configuration...
Current configuration : 1016 bytes
!
version 12.2
no service password-encryption
!
hostname ciscotr.com
!
!
!
!
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/0.1
encapsulation dot1Q 10
ip address 192.168.10.1 255.255.255.0
!
interface FastEthernet0/0.2
encapsulation dot1Q 20
ip address 192.168.20.1 255.255.255.0
!
interface FastEthernet0/0.3
encapsulation dot1Q 30
ip address 192.168.30.1 255.255.255.0
!
interface FastEthernet0/1
--More—
Şimdi bundan sonra son aşamaya yani dhcp kullanarak otomatik IP dağıtımına geldi sıra sırasıyla router ınıza şu komutları girerseniz;
Kod:
ciscotr.com#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
ciscotr.com(config)#ip dhcp pool ciscotrvlan10
ciscotr.com(dhcp-config)#network 192.168.10.0 255.255.255.0
ciscotr.com(dhcp-config)#default-router 192.168.10.1
ciscotr.com(dhcp-config)#dns-server 4.2.2.2
ciscotr.com(dhcp-config)#ip dhcp pool ciscotrvlan20
ciscotr.com(dhcp-config)#network 192.168.20.0 255.255.255.0
ciscotr.com(dhcp-config)#default-router 192.168.20.1
ciscotr.com(dhcp-config)#dns-server 4.2.2.2
ciscotr.com(dhcp-config)#ip dhcp pool ciscotrvlan30
ciscotr.com(dhcp-config)#network 192.168.30.0 255.255.255.0
ciscotr.com(dhcp-config)#default-router 192.168.30.1
ciscotr.com(dhcp-config)#dns-server 4.2.2.2
ciscotr.com(dhcp-config)#exit
Bundan sonra otomatik ıp dağıtımı işlemi tamamdır.DHCP ıp leri otomatik olarak dağıtır.
Gördüğünüz gibi tek tek elle ıp girmektense dhcp bizim için ıp leri vlan larımıza dağıttı ve aşagıda ki örnektede ping lerimiz vlan lar arasında başarılı olmuştur.VLAN 10 dan VLAN 30 a başarılı bir ping atışı aşagıdadır.
Kod:
Packet Tracer PC Command Line 1.0
PC>ping 192.168.30.2
Pinging 192.168.30.2 with 32 bytes of data:
Request timed out.
Reply from 192.168.30.2: bytes=32 time=240ms TTL=127
Reply from 192.168.30.2: bytes=32 time=183ms TTL=127
Reply from 192.168.30.2: bytes=32 time=195ms TTL=127
Ping statistics for 192.168.30.2:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 183ms, Maximum = 240ms, Average = 206ms
Kod:
PC>ping 192.168.30.2
Pinging 192.168.30.2 with 32 bytes of data:
Reply from 192.168.30.2: bytes=32 time=222ms TTL=127
Reply from 192.168.30.2: bytes=32 time=202ms TTL=127
Reply from 192.168.30.2: bytes=32 time=192ms TTL=127
Reply from 192.168.30.2: bytes=32 time=225ms TTL=127
Ping statistics for 192.168.30.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 192ms, Maximum = 225ms, Average = 210ms
PC>
Aşagıdada
VLAN 30 dan
VLAN 20 ye atılan pingler başarılı olmuştur.
Kod:
PC>ping 192.168.20.2
Pinging 192.168.20.2 with 32 bytes of data:
Reply from 192.168.20.2: bytes=32 time=224ms TTL=127
Reply from 192.168.20.2: bytes=32 time=218ms TTL=127
Reply from 192.168.20.2: bytes=32 time=171ms TTL=127
Reply from 192.168.20.2: bytes=32 time=209ms TTL=127
Ping statistics for 192.168.20.2:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 171ms, Maximum = 224ms, Average = 205ms
PC>