Perintah Dasar Switch & Router Cisco
Konfigurasi Password pada Cisco
Virtual LAN (VLAN)
Trunking VLAN
Inter-VLAN - Router on a Stick
Inter-VLAN – Switch Layer 3
DHCP menggunakan Switch
Port Security
Spanning Tree Protocol (STP)
STP Portfast
Etherchannel
VLAN Trunking Protocol (VTP)
Switch pada cisco biasa disebut catalyst. Perbedaan switch dan router yang paling
menonjol adalah switch mempunyai banyak port.
Catalyst 1900 Series
Cisco Catalyst 2690 Series
Cisco Router 2900 series
Ada beberapa perintah dasar cisco yang wajib diketahui.
Router>
Router>enable
Router#
Router#configure terminal
Router(config)#
Ada beberapa hak akses ketika masuk dalam Cisco IOS:
User mode ditandai dengan tanda “>”
Previlige mode ditandai dengan tanda “#”. Untuk masuk dari user mode ke
previlige mode ketikkan perintah enable.
Global configuration mode digunakan untuk mengkonfigurasi perangkat.
Mengganti Hostname
Router(config)#hostname Semarang
Semarang (config)#
Meyimpan Konfigurasi
Konfigurasi agar ketika device direboot konfigurasi tidak hilang.
Router(config)#write
atau
Router(config)#copy run start
Mereset Perangkat Cisco
Untuk mengembalikan konfigurasi ke default.
Router(config)#write erase
Perintah show ip interface brief digunakan untuk melihat informasi interface.
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 [Link] YES manual up up
FastEthernet0/1 [Link] YES manual up up
Loopback0 [Link] YES manual up up
Vlan1 unassigned YES unset administratively down down
R1#
Perintah show running-config digunakan untuk melihat konfigurasi yang sedang
berjalan.
R1#show running-config
Building configuration...
Current configuration : 687 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
spanning-tree mode pvst
!
interface Loopback0
ip address [Link] [Link]
!
interface FastEthernet0/0
ip address [Link] [Link]
ip nat inside
duplex auto
speed auto
!
interface FastEthernet0/1
ip address [Link] [Link]
ip nat outside
duplex auto
speed auto
!
interface Vlan1
no ip address
shutdown
!
ip nat inside source static [Link] [Link]
ip classless
ip route [Link] [Link] [Link]
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
+
end
Keamanan adalah hal yang penting dalam suatu jaringan. Pemberian authentikasi
berupa username dan password dalam device dilakukan agar tidak sembarang
orang dapat masuk ke device.
Mengeset Password Line Console maka ketika melakukan config melalui port
console akan diminta login.
Router>enable
Router#configure terminal
Router(config)#line console 0
Router(config-line)#password 123
Router(config-line)#login
Ketika masuk ke device akan muncul tampilan berikut.
User Access Verification
Password:
Konfigurasi VTY (Virtual Terminal) agar device dapat ditelnet dengan
menggunakan username dan password yang spesifik.
Router(config)#username admin
Router(config)#enable password coba1
Router(config)#enable secret coba2
Ketika di show run.
Router#sh run
Building configuration...
Current configuration : 598 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
enable secret 5 $1$mERr$9SLtlDbYs.aoemVq5cCcc.
enable password coba1
!
username admin
enable secret = password diencripsi.
enable password = password tidak dienciprsi dan dapat dilihat dengan show run.
Jika kita mengeset enable secret dan enable password, maka yang dipakai adalah
enable secret.
Virtual LAN (VLAN) membagi satu broadcast domain menjadi beberapa broadcast
domain, sehingga dalam satu switch bisa saja terdiri dari beberapa network. Host
yang berbeda VLAN tidak akan tersambung sehingga meningkatkan security
jaringan.
VLAN adalah fasilitas yang dimiliki oleh switch manageable, contohnya cisco. Pada
switch unmanageable, port-port nya hanya dapat digunakan untuk koneksi ke
network yang sama (satu network) sehingga tidak mendukung fasilitas VLAN.
[Link]/24 [Link]/24
[Link]/24 [Link]/24
Buatlah topologi seperti pada gambar diatas pada packet tracer. Konfigurasi VLAN
pada switch dengan VLAN10 berikan nama Marketing dan VLAN20 dengan nama
Sales.
Switch>enable
Switch#conf t
Switch(config)#vlan 10
Switch(config-vlan)#name Marketing
Switch(config-vlan)#vlan 20
Switch(config-vlan)#name Sales
Switch(config-vlan)#int f0/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#int f0/2
Switch(config-if)#switchport access vlan 10
Switch(config-if)#int f0/3
Switch(config-if)#switchport access vlan 20
Switch(config-if)#int f0/4
Switch(config-if)#switchport access vlan 20
Untuk pengecekan,ping dari satu PC ke PC lain dan ketikkan perintah show vlan
pada switch. PC tidak bisa ping ke beda VLAN.
PC>ping [Link]
Pinging [Link] with 32 bytes of data:
Reply from [Link]: bytes=32 time=0ms TTL=128
Reply from [Link]: bytes=32 time=0ms TTL=128
Reply from [Link]: bytes=32 time=0ms TTL=128
Reply from [Link]: bytes=32 time=0ms TTL=128
Ping statistics for [Link]:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
PC>ping [Link]
Pinging [Link] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for [Link]:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
PC>
Switch#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- ----------------------------
---
1 default active 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
10 VLAN0010 active Fa0/1, Fa0/2
20 VLAN0020 active Fa0/3, Fa0/4
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
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 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0
1005 trnet 101005 1500 - - - ibm - 0 0
Remote SPAN VLANs
----------------------------------------------------------------------------
--
Primary Secondary Type Ports
------- --------- ----------------- ----------------------------------------
--
Trunking berfungsi melewatkan traffic VLAN dari switch yang berbeda. Antara
switch lantai 1 dan lantai 2 terhubung. PC1, PC2, PC5 dan PC6 masuk dalam VLAN
10 sedang PC3, PC4, PC5 dan PC6 masuk dalam VLAN 20.
[Link]/24 [Link]/24
[Link]/24 [Link]/24
[Link]/24
[Link]/24
[Link]/24 [Link]/24
Konfigurasi VLAN pada seperti dibawah. Membuat vlan 10 dan vlan 20.
switch1(config)#vlan 10
switch1(config-vlan)#vlan 20
switch1(config-vlan)#int f0/1
switch1(config-if)#sw access vlan 10
switch1(config-if)#int f0/2
switch1(config-if)#sw access vlan 10
switch1(config-vlan)#int f0/3
switch1(config-if)#sw access vlan 10
switch1(config-vlan)#int f0/4
switch1(config-if)#sw access vlan 10
Switch0(config)#vlan 10
Switch0(config-vlan)#vlan 20
Switch0(config-vlan)#int f0/1
Switch0(config-if)#sw access vlan 10
Switch0(config-if)#int f0/2
Switch0(config-if)#sw access vlan 10
Switch0(config-vlan)#int f0/3
Switch0(config-if)#sw access vlan 10
Switch0(config-vlan)#int f0/4
Switch0(config-if)#sw access vlan 10
Konfigurasi interface yang saling terhubung antar switch dengan mode trunk.
Lakukan pada kedua switch.
Switch0(config)#int f0/10
Switch0(config-if)#switchport mode trunk
Switch1(config)#int f0/10
Switch1(config-if)#switchport mode trunk
Ping dari satu PC ke PC lain dan ketikkan perintah show vlan.
PC>ping [Link]
Pinging [Link] with 32 bytes of data:
Reply from [Link]: bytes=32 time=17ms TTL=128
Reply from [Link]: bytes=32 time=0ms TTL=128
Reply from [Link]: bytes=32 time=0ms TTL=128
Reply from [Link]: bytes=32 time=0ms TTL=128
Ping statistics for [Link]:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 17ms, Average = 4ms
PC>ping [Link]
Pinging [Link] with 32 bytes of data:
Reply from [Link]: bytes=32 time=11ms TTL=128
Reply from [Link]: bytes=32 time=0ms TTL=128
Reply from [Link]: bytes=32 time=0ms TTL=128
Reply from [Link]: bytes=32 time=1ms TTL=128
Ping statistics for [Link]:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 11ms, Average = 3ms
PC>ping [Link]
Pinging [Link] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for [Link]:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
PC>
PC dapat melakukan ping ke sesame VLAN beda switch namun tidak bisa ke beda
VLAN.
Switch1#sh int trunk
Port Mode Encapsulation Status Native vlan
Fa0/10 on 802.1q trunking 1
Port Vlans allowed on trunk
Fa0/10 1-1005
Port Vlans allowed and active in management domain
Fa0/10 1,10,20
Port Vlans in spanning tree forwarding state and not pruned
Fa0/10 1,10,20
Untuk menghubungkan VLAN yang berbeda, dibutuhkan perangkat layer 3 baik
itu router atau switch layer 3. Cara pertama adalah dengan menggunakan satu
router melalui satu interface. Teknik ini disebut router on a stick. Kekurangan dari
teknik ini adalah akan terjadi collision domain karena hanya menggunakan satu
interface.
Ada 2 trunking protocol yang biasa digunakan:
ISL = cisco proprietary, bekerja pada ethernet, token ring dan FDDI,
menambahi tag sebesar 30byte pada frame dan semua traffic VLAN ditag.
IEEE 802.11Q (dot1q) = open standard, hanya bekerja pada ethernet,
menambahi tag sebesar 4byte pada frame.
Buat topologi seperti diatas dan konfigurasi VLAN10 dan VLAN20 seperti lab
sebelumnya. Tambahkan 1 router. Karena hanya menggunakan 1 interface, maka
harus dibuat sub-interface untuk dijadikan gateway VLAN. Port SW1 yang
terhubung ke router harus diset mode trunk.
Router(config)#interface FastEthernet0/0.10
Router(config-subif)#encapsulation dot1Q 10
Router(config-subif)#ip address [Link] [Link]
Router(config-subif)#interface FastEthernet0/0.20
Router(config-subif)#encapsulation dot1Q 20
Router(config-subif)#ip address [Link] [Link]
Cek interface dengan perintah show ip int brief.
Router#sh ip int br
Interface IP-Address OK? Method Status
Protocol
FastEthernet0/0 unassigned YES unset up up
FastEthernet0/0.10 [Link] YES manual up up
FastEthernet0/0.20 [Link] YES manual up up
FastEthernet0/0.30 [Link] YES manual up up
FastEthernet0/1 unassigned YES unset administratively down down
Vlan1 unassigned YES unset administratively down down
Router#
Sekarang ping antar VLAN yang berbeda.
PC>ping [Link]
Pinging [Link] with 32 bytes of data:
Request timed out.
Reply from [Link]: bytes=32 time=1ms TTL=127
Reply from [Link]: bytes=32 time=0ms TTL=127
Reply from [Link]: bytes=32 time=0ms TTL=127
Ping statistics for [Link]:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
PC>tracert [Link]
Tracing route to [Link] over a maximum of 30 hops:
1 30 ms 0 ms 0 ms [Link]
2 0 ms 0 ms 0 ms [Link]
Trace complete.
Router#sh ip arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet [Link] 4 0000.0C1B.0D20 ARPA
FastEthernet0/0.10
Internet [Link] 3 0060.7092.05A9 ARPA
FastEthernet0/0.20
Internet [Link] 1 0001.C7AE.3D52 ARPA
FastEthernet0/0.30
Router#
Untuk menghubungkan antar VLAN dibutuhkan suatu perangkat layer 3 baik itu
router atau switch layer 3. Kalau sebelum menggunakan router on a stick, kali ini
kita akan menggunakan switch L3 (layer 3). Inilah kerennya cisco, kalo switch
yang lain bekerja pada layer 2, switch cisco dapat bekerja pada layer 3 dan
menjalankan routing. Namun, meski untuk routing yang lebih luas lebih
dianjurkan menggunakan router sesuai fungsinya.
Konfigurasi port ke VLANnya masing-masing.
Switch(config)#interface FastEthernet0/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#switchport mode access
Switch(config-if)#
Switch(config-if)#interface FastEthernet0/2
Switch(config-if)#switchport access vlan 10
Switch(config-if)#switchport mode access
Switch(config-if)#
Switch(config-if)#interface FastEthernet0/3
Switch(config-if)#switchport access vlan 20
Switch(config-if)#switchport mode access
Switch(config-if)#interface FastEthernet0/4
Switch(config-if)#switchport access vlan 20
Switch(config-if)#switchport mode access
Buat interface VLAN dan beri ip address.
Switch(config)#int vlan 10
Switch(config-if)#ip add [Link] [Link]
Switch(config-if)#int vlan 20
Switch(config-if)#ip add [Link] [Link]
Ketiikkan perintah ip routing untuk merouting VLAN.
Switch(config)#ip routing
Sekarang tes ping.
PC>ping [Link]
Pinging [Link] with 32 bytes of data:
Request timed out.
Reply from [Link]: bytes=32 time=0ms TTL=127
Reply from [Link]: bytes=32 time=0ms TTL=127
Reply from [Link]: bytes=32 time=0ms TTL=127
Ping statistics for [Link]:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
PC>
VLANS [Link]
Trunk Encapsulation Trunk Types
26 6 6 2 4 802.1Q ISL
ISL Dest Source Header Size 4 bytes 26 bytes
ISL Type FCS
Header MAC MAC
Trailer Size N/A 4 bytes
Dest Source Standard IEEE Cisco
Untagged Type
MAC MAC
Maximum VLANs 4094 1000
Dest Source
802.1Q 802.1Q Type VLAN Numbers
MAC MAC
6 6 4 2 0 Reserved 1004 fdnet
VLAN Creation 1 default 1005 trnet
Switch(config)# vlan 100 1002 fddi-default 1006-4094 Extended
Switch(config-vlan)# name Engineering 1003 tr 4095 Reserved
Access Port Configuration Terminology
Switch(config-if)# switchport mode access Trunking
Switch(config-if)# switchport nonegotiate Carrying multiple VLANs over the same
Switch(config-if)# switchport access vlan 100 physical connection
Switch(config-if)# switchport voice vlan 150
Native VLAN
Trunk Port Configuration By default, frames in this VLAN are untagged
when sent across a trunk
Switch(config-if)# switchport mode trunk Access VLAN
Switch(config-if)# switchport trunk encapsulation dot1q The VLAN to which an access port is assigned
Switch(config-if)# switchport trunk allowed vlan 10,20-30
Switch(config-if)# switchport trunk native vlan 10 Voice VLAN
If configured, enables minimal trunking to
SVI Configuration support voice traffic in addition to data traffic
on an access port
Switch(config)# interface vlan100
Switch(config-if)# ip address [Link] [Link] Dynamic Trunking Protocol (DTP)
Can be used to automatically establish trunks
VLAN Trunking Protocol (VTP) between capable ports (insecure)
Domain Switched Virtual Interface (SVI)
Common to all switches participating in VTP A virtual interface which provides a routed
gateway into and out of a VLAN
Server Mode
Generates and propagates VTP advertisements to clients; Switch Port Modes
default mode on unconfigured switches
trunk
Client Mode Forms an unconditional trunk
Receives and forwards advertisements from servers; VLANs
dynamic desirable
cannot be manually configured on switches in client mode
Attempts to negotiate a trunk with the far end
Transparent Mode dynamic auto
Forwards advertisements but does not participate in VTP; Forms a trunk only if requested by the far end
VLANs must be configured manually
access
Pruning Will never form a trunk
VLANs not having any access ports on an end switch are
removed from the trunk to reduce flooded traffic Troubleshooting
VTP Configuration show vlan
show interface [status | switchport]
Switch(config)# vtp mode {server | client | transparent}
Switch(config)# vtp domain <name> show interface trunk
Switch(config)# vtp password <passsword>
Switch(config)# vtp version {1 | 2} show vtp status
Switch(config)# vtp pruning show vtp password
by Jeremy Stretch v2.0
Fungsi DHCP adalah memberikan alamat IP secara otomatis kepada host.
Konfigurasi DHCP.
Switch(config)#ip dhcp pool vlan10
Switch(dhcp-config)#network [Link] [Link]
Switch(dhcp-config)#default-router [Link]
Switch(dhcp-config)#dns-server [Link]
Switch(dhcp-config)#ip dhcp pool vlan20
Switch(dhcp-config)#network [Link] [Link]
Switch(dhcp-config)#default-router [Link]
Switch(dhcp-config)#dns-server [Link]
jika ada ip yg tidak ingin digunakan dalam DHCP masukkan perintah ip dhcp
excluded-address.
ip dhcp excluded-address [Link] [Link]
Perintah show ip dhcp binding menampilkan client yang mendapat ip dhcp.
Switch#sh ip dhcp binding
IP address Client-ID/ Lease expiration Type
Hardware address
[Link] 0003.E4A2.9D08 -- Automatic
[Link] 0001.64C9.674C -- Automatic
[Link] 0001.4266.50B0 -- Automatic
[Link] 0002.1638.8C69 -- Automatic
Switch#
DHCP juga dapat diset manual untuk client dengan MAC Address tertentu
ip dhcp pool PC_MANAGER
host [Link]
default router [Link]
client-id 0102.c7f8.0004.22
client-name Komputer_IDN
Port Security ini digunakan agar port interface perangkat cisco tidak dapat
digunakan kecuali untuk PC dengan MAC Address tertentu.
int fa0/1
switchport mode access
switchport port-security
switchport port-security mac-address sticky
switchport port-security violation shutdown
int fa0/2
switchport mode access
switchport port-security
switchport port-security mac-address sticky
switchport port-security violation restrict
Ada 3 violation:
protect = data yg dikirim melalui port tsb dibiarkan tdk terkirim
restrict = seperti protect namun mengirimkan notifikasi dgn snmp
shutdown = port akan dishutdown secara otomatis, utk mengembalikannya
maka harus di no shut dengan console switch atau telnet.
Sticky artinya bahwa MAC address yang pertama kali lewat switch maka itulah
yang digunakan. Jika bukan MAC address tsb yang tersambung ke port yang diset
port-security maka akan diproses tergantung violation yang diset.
show port-security
Switch#show port-security
Secure Port MaxSecureAddr CurrentAddr SecurityViolation Security Action
(Count) (Count) (Count)
--------------------------------------------------------------------
Fa0/1 1 1 1 Shutdown
Fa0/2 1 1 1 Restrict
----------------------------------------------------------------------
Switch#
Spanning Tree Protocol (STP) merupakan protocol yang berfungsi mencegah loop
pada switch ketika switch menggunakan lebih dari 1 link dengan maksud
redundancy. STP secara defaultnya diset aktif pada Cisco Catalyst. STP merupakan
open standard (IEEE 802.1D). STP dapat mencegah:
Broadcast Storm
Multiple Frame Copies
Database Instability
Ada beberapa jenis STP:
Open Standard : STP (802.1D), Rapid STP (802.1W), Multiple Spanning Tree
MST (802.1S)
Cisco Proprietary : PVST (Per Vlan Spanning Tree), PVST+, Rapid PVST.
Ketika Switch0 mengirim packet data dengan destination yang tidak terdapat pada
MAC address tabelnya, maka Switch0 akan membroadcast ke semua port sampai
ke Switch1. Jika pada tabel MAC address Switch1 juga tidak terdapat destination
tadi maka Switch1 akan kembali membroadcast ke Switch0 dan akan seperti itu
sehingga network down.
Ada beberapa cara mengatasi hal tersebut:
Hanya menggunakan 1 link (no redundancy)
Shutdown salah satu interface, melakukan shutdown manual pada salah
satu interface atau secara otomatis menggunakan STP.
STP akan membuat blocking atau shutdown pada salahsatu port untuk mencegah
terjadinya loop. Ketika link utama down maka port yang sebelumnya blocking
akan menjadi forward. Port blocking ditunjukkan dengan warna merah.
Cara kerja STP :
1. Ketika STP aktif, masing-masing switch akan mengirimkan frame khusus satu
sama lain yang disebut Bridge Protocol Data Unit (BPDU).
2. Menentukan Root Bridge
Switch dengan bridge id terendah akan menjadi root bridge. Bridge id = priority
+ MAC address. Dalam satu LAN hanya ada satu switch sebagai root bridge,
switch lain menjadi non-root bridge. Default priority adalah 32768 dan bisa
diubah.
3. Menentukan Root Port
Yang menjadi root port adalah path yang paling dekat dengan root bridge. Untuk
setiap non-root bridge hanya punya 1 root port.
4. Menentukan designated port dan non-designated port
Designated port adalah port yang forward dan non designated port adalah port
yang blocking. Untuk root bridge semua portnya adalah designated port.
Switch dengan priority terendah, salah satu portnya akan menjadi non-
designated port atau port blocking. Jika priority sama maka akan dilihat MAC
address terendah.
STP akan membuat blocking atau shutdown pada salahsatu port untuk mencegah
terjadinya loop. Ketika link utama down maka port yang sebelumnya blocking
akan menjadi forward. Port blocking ditunjukkan dengan warna merah.
STP menggunakan link cost calculation untuk menentukan root port pada non-root
switch.
10 Gbps = Cost 2
1 Gbps = Cost 4
100 Mbps = Cost 19
10 Mbps = Cost 100
Buatlah topologi seperti dibawah.
Switch0#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 000B.BE80.D273
Cost 19
Port 1(FastEthernet0/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address [Link]
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost [Link] Type
---------------- ---- --- --------- -------- -------------------------------
-
Fa0/2 Altn BLK 19 128.2 P2p
Fa0/1 Root FWD 19 128.1 P2p
Switch0#
Switch1#sh spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 32769
Address 000B.BE80.D273
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 000B.BE80.D273
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost [Link] Type
---------------- ---- --- --------- -------- -------------------------------
-
Fa0/1 Desg FWD 19 128.1 P2p
Fa0/2 Desg FWD 19 128.2 P2p
Switch1#
Secara otomatis, Switch0 menjadi root bridge dilihat dari semua portnya yang
fordward (berwarna hijau), agar Switch1 yang menjadi root bridge, ubah priority
pada Switch1.
Switch1(config)#spanning-tree vlan 1 priority 0
Sekarang Switch1 yang menjadi root bridge. Untuk memindahkan blocking port
dari fa0/2 menjadi fa0/1 pada Switch1 jalankan perintah berikut.
Switch1(config)#int f0/1
Switch1(config-if)#speed 10
Cek Hasilnya. Port blocking pindah ke fa0/1.
Switch1(config-if)#do show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 1
Address [Link]
Cost 19
Port 2(FastEthernet0/2)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 000B.BE80.D273
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost [Link] Type
---------------- ---- --- --------- -------- -------------------------------
-
Fa0/1 Altn BLK 100 128.1 P2p
Fa0/2 Root FWD 19 128.2 P2p
Portfast adalah salahsatu fitur STP. Ketika pertama kali mencolokkan kabel ke
switch, perlu waktu agak lama dari proses blocking yang ditandai warna oranye
pada lampu indicator untuk menjadi forwarding yang ditandai dengan warna
kuning.
STP Port States:
Blocking 20 second/no limits
Listening 15 second
Learning 15 second
Forwarding no limits
Disable no limits
Hal ini disebabkan switch melakukan step listening dan learning terlebih dahulu
sebelum forward. Dari proses blocking, listening dan learning kira-kira
dibutuhkan waktu 30 detik. Untuk langsung ke forward tanpa melalui listening
dan learning maka digunakan portfast. Portfast cocok digunakan untuk port yang
mengarah ke end host. Untuk port yang mengarah ke switch, maka tidak
direkomendasikan karena akan mematikan fungsi STP dalam mencegah looping.
Misalkan port 1 sampai 4 yang mau dikonfigurasi stp portfast maka ketikkan
perintah berikut.
int range fa0/1 - 4
spanning-tree portfast
Maka ketika mencolokkan kabel ke switch akan langsung kuning.
Karena adanya fitur STP, akan ada port yang blocking untuk mencegah loop.
Etherchannel digunakan untuk membundle beberapa link seolah-olah menjadi
satu link secara logical, sehingga STP harus dimatikan dan tidak ada port blocking.
Dengan etherchannel maka transfer data lebih cepat dan tidak tergantung hanya
pada 1 link. Etherchannel dapat dikonfigurasi dengan beberapa mekanisme:
Static Persistence, tanpa menggunakan negotiation protocol.
Dengan menggunakan negotiation protocol:
LACP (Link Aggregation Control Protocol) – open standard IEEE
802.1AD.
PAgP (Port Aggregation Protocol) – cisco proprietary.
Buat topologi seperti dibawah.
Konfigurasi LaCP pada switch kiri dan tengah.
Switch(config)#int range fa0/1-3
Switch(config-if-range)#channel-group 1 mode ?
active Enable LACP unconditionally
auto Enable PAgP only if a PAgP device is detected
desirable Enable PAgP unconditionally
on Enable Etherchannel only
passive Enable LACP only if a LACP device is detected
Switch(config-if-range)#channel-group 1 mode active
Switch(config-if-range)#int port-channel 1
Switch(config-if)#switchport mode trunk
Mode yang digunakan dalam LaCP boleh active-active atau active-passive namun
tidak boleh passive-passive.
Switch#sh etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+-------------------------------------------
---
1 Po1(SU) LACP Fa0/1(P) Fa0/2(P) Fa0/3(P)
Switch#
Konfigurasi PAgP pada switch tengah dan kanan.
Switch(config)#int range fa0/4-6
Switch(config-if-range)#channel-group 2 mode desirable
Switch(config-if-range)#int port-channel 2
Switch(config-if)#switchport mode trunk
Pada PAgP dapat menggunakan mode desirable-desirable atau desirable-auto.
Sekarang cek di switch yang tengah.
Switch#sh etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 2
Number of aggregators: 2
Group Port-channel Protocol Ports
------+-------------+-----------+-------------------------------------------
---
1 Po1(SU) LACP Fa0/1(P) Fa0/2(P) Fa0/3(P)
2 Po2(SU) PAgP Fa0/4(P) Fa0/5(P) Fa0/6(P)
Switch#
Konfigurasi etherchannel manual, tanpa LACP atau PAgP pada switch kiri dan
kanan.
Switch(config)#int range fa0/7-9
Switch(config-if-range)#channel-group 3 mode on
Switch(config-if-range)#int port-channel 3
Switch(config-if)#switchport mode trunk
Switch#sh etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 2
Number of aggregators: 2
Group Port-channel Protocol Ports
------+-------------+-----------+-------------------------------------------
---
1 Po1(SU) LACP Fa0/1(P) Fa0/2(P) Fa0/3(P)
3 Po3(SU) - Fa0/7(P) Fa0/8(P) Fa0/9(P)
Switch#
SPANNING TREE · PART 1 [Link]
Spanning Tree Protocols
Legacy STP PVST PVST+ RSTP RPVST+ MST
Algorithm Legacy ST Legacy ST Legacy ST Rapid ST Rapid ST Rapid ST
802.1w, 802.1s,
Defined By 802.1D-1998 Cisco Cisco Cisco
802.1D-2004 802.1Q-2003
Instances 1 Per VLAN Per VLAN 1 Per VLAN Configurable
Trunking N/A ISL 802.1Q, ISL N/A 802.1Q, ISL 802.1Q, ISL
Spanning Tree Instance Comparison
STP PVST+ MST
Root VLAN 1,10 Root VLAN 20,30 Root MSTI 0 Root MSTI 1 Root
A B A B A B
All VLANs VLAN 1 MSTI 0 (1, 10)
x xx xx VLAN 10 x x MSTI 1 (20, 30)
VLAN 20
C C VLAN 30 C
BPDU Format Spanning Tree Specifications Link Costs
Field Bits Bandwidth Cost
802.1s 802.1Q-2003 802.1Q-2005
Protocol ID 16 4 Mbps 250
Version 8 10 Mbps 100
BPDU Type 8 802.1D-1998 802.1D-2004 16 Mbps 62
Flags 8 45 Mbps 39
Root ID 64 802.1Q-1998 802.1w 100 Mbps 19
Root Path Cost 32 155 Mbps 14
ISL PVST PVST+ RPVST+
Bridge ID 64 622 Mbps 6
Port ID 16 IEEE 802.1D-1998 · Deprecated legacy STP standard 1 Gbps 4
Message Age 16 IEEE 802.1w · Introduced RSTP 10 Gbps 2
Max Age 16 20+ Gbps 1
IEEE
IEEE 802.1D-2004 · Replaced legacy STP with RSTP
Hello Time 16 IEEE 802.1s · Introduced MST Port States
Forward Delay 16 IEEE 802.1Q-2003 · Added MST to 802.1Q Legacy ST Rapid ST
Default Timers IEEE 802.1Q-2005 · Most recent 802.1Q revision Disabled
Hello 2s PVST · Per-VLAN implementation of legacy STP Blocking Discarding
Cisco
Forward Delay 15s PVST+ · Added 802.1Q trunking to PVST Listening
Max Age 20s RPVST+ · Per-VLAN implementation of RSTP Learning Learning
Forwarding Forwarding
Spanning Tree Operation
Determine root bridge Port Roles
1
The bridge advertising the lowest bridge ID becomes the root bridge Legacy ST Rapid ST
Select root port Root Root
2
Each bridge selects its primary port facing the root
Designated Designated
Select designated ports
3 Alternate
One designated port is selected per segment
Blocking
Block ports with loops Backup
4
All non-root and non-desginated ports are blocked
by Jeremy Stretch v3.0
SPANNING TREE · PART 2 [Link]
PVST+ and RPVST+ Configuration Bridge ID Format
4 12 48
spanning-tree mode {pvst | rapid-pvst}
Pri Sys ID Ext MAC Address
! Bridge priority
spanning-tree vlan 1-4094 priority 32768 Priority
4-bit bridge priority (configurable from 0 to 61440 in
! Timers, in seconds
spanning-tree vlan 1-4094 hello-time 2
increments of 4096)
spanning-tree vlan 1-4094 forward-time 15 System ID Extension
spanning-tree vlan 1-4094 max-age 20 12-bit value taken from VLAN number (IEEE 802.1t)
MAC Address
! PVST+ Enhancements
spanning-tree backbonefast 48-bit unique identifier
spanning-tree uplinkfast
Path Selection
! Interface attributes 1 Bridge with lowest root ID becomes the root
interface FastEthernet0/1
spanning-tree [vlan 1-4094] port-priority 128 2 Prefer the neighbor with the lowest cost to root
spanning-tree [vlan 1-4094] cost 19
3 Prefer the neighbor with the lowest bridge ID
! Manual link type specification 4 Prefer the lowest sender port ID
spanning-tree link-type {point-to-point | shared}
Optional PVST+ Ehancements
! Enables PortFast if running PVST+, or
! designates an edge port under RPVST+ PortFast
spanning-tree portfast Enables immediate transition into the forwarding state
(designates edge ports under MST)
! Spanning tree protection
spanning-tree guard {loop | root | none} UplinkFast
Enables switches to maintain backup paths to root
! Per-interface toggling BackboneFast
spanning-tree bpduguard enable Enables immediate expiration of the Max Age timer in
spanning-tree bpdufilter enable the event of an indirect link failure
MST Configuration Spanning Tree Protection
Root Guard
spanning-tree mode mst
Prevents a port from becoming the root port
! MST Configuration BPDU Guard
spanning-tree mst configuration Error-disables a port if a BPDU is received
name MyTree
revision 1 Loop Guard
Prevents a blocked port from transitioning to listening
! Map VLANs to instances after the Max Age timer has expired
instance 1 vlan 20, 30 BPDU Filter
instance 2 vlan 40, 50 Blocks BPDUs on an interface (disables STP)
! Bridge priority (per instance) RSTP Link Types
spanning-tree mst 1 priority 32768
Point-to-Point
! Timers, in seconds Connects to exactly one other bridge (full duplex)
spanning-tree mst hello-time 2 Shared
spanning-tree mst forward-time 15
Potentially connects to multiple bridges (half duplex)
spanning-tree mst max-age 20
Edge
! Maximum hops for BPDUs Connects to a single host; designated by PortFast
spanning-tree mst max-hops 20
Troubleshooting
! Interface attributes
interface FastEthernet0/1
show spanning-tree [summary | detail | root]
spanning-tree mst 1 port-priority 128 show spanning-tree [interface | vlan]
spanning-tree mst 1 cost 19
show spanning-tree mst […]
by Jeremy Stretch v3.0
VLAN Trunking Protocol (VTP) adalah protocol yang mengatur VLAN pada
beberapa switch sekaligus dalam VTP domain yang sama. VTP dapat menambah,
mendelete dan merename VLAN sekaligus dalam beberapa switch. VTP
meringankan kerja administrator sehingga tidak perlu mengkonfigurasi VLAN
pada switch satu per satu.
VTP merupakan protocol cisco proprietary. Konfigurasi VLAN disimpan dalam file
database [Link] di flash memory.
Ada 3 VTP mode:
Server (dafault)
Client
Transparent
VTP Server VTP Client VTP
Transparent
Create/Modify/Delete VLAN Yes No Only local
Syncronizes itself Yes Yes No
Forwards advertisements Yes Yes Yes
Dalam VTP ada namanya revision number. Revision number adalah banyaknya
update VTP yang telah diterima suatu switch.
Hal yang penting mengenai revision number adalah ketika switch mode server
atau client dengan VTP domain yang sama dan mempunyai revision number yang
lebih tinggi, ketika diletakkan dalam sebuah jaringan, maka otomatis mengirim
update VLAN databasenya dan mereplace database switch sebelumnya sehingga
membuat network down. Switch mode server akan tetap tereplace datatbasenya
karena mode server pada dasarnya merupakan mode client juga.
Solusinya dengan direset terlebih dahulu.
Konfigurasikan command dibawah pada semua switch.
Switch(config)#interface range fa0/1-2
Switch(config-if-range)#switchport mode trunk
Server
Switch(config)#int vlan 1
Switch(config-if)#ip add [Link] [Link]
Switch(config-if)#no shut
Switch(config-if)#vtp mode server
Switch(config)#vtp domain belajar
Switch(config)#vtp password rahasia
Transparent
Switch(config)#int vlan 1
Switch(config-if)#ip add [Link] [Link]
Switch(config-if)#no shut
Switch(config-if)#vtp mode transparent
Switch(config)#vtp domain belajar
Switch(config)#vtp password rahasia
Client
Switch(config)#int vlan 1
Switch(config-if)#ip add [Link] [Link]
Switch(config-if)#no shut
Switch(config-if)#vtp mode client
Switch(config)#vtp domain belajar
Switch(config)#vtp password rahasia
Server2
Switch(config)#int vlan 1
Switch(config-if)#ip add [Link] [Link]
Switch(config-if)#no shut
Switch(config-if)#vtp mode server
Switch(config)#vtp domain belajar
Switch(config)#vtp password rahasia
Buat VLAN pada masing-masing switch.
Server : VLAN10, VLAN20
Transparent : VLAN30, VLAN40
Client : VLAN50, VLAN60
Server2 : VLAN70, VLAN80
Hasilnya Server ada 4 VLAN.
Switch#show vlan
VLAN Name Status Ports
10 VLAN0010 active
20 VLAN0020 active
70 VLAN0070 active
80 VLAN0080 active
Transparent ada 2 VLAN.
Switch#sh vlan
VLAN Name Status Ports
30 VLAN0030 active
40 VLAN0040 active
Client ada 4 VLAN
Switch#SH VLAN
VLAN Name Status Ports
10 VLAN0010 active
20 VLAN0020 active
70 VLAN0070 active
80 VLAN0080 active
Server2 ada 4 VLAN.
Switch#SH VLAN
VLAN Name Status Ports
10 VLAN0010 active
20 VLAN0020 active
70 VLAN0070 active
80 VLAN0080 active