# LAB STP SPANNING TREE PROTOCOL
# REQUIREMENT
1- BASIC CONFIGURATION
2- ROUTING RIP V2
3- VTP (VLAN TRUNKING PROTOCOL)
SW1 is server; SW2, SW3 is client
Server SW1 has 4 VLAN:
VLAN1: 192.168.10.0/24
VLAN2: 192.168.20.0/24
VLAN3: 192.168.30.0/24
VLAN4: 192.168.40.0/24
SYNCHRONIZATION FOR VLANS
4- SET ROOT BRIDGE
Configuration SW1 is Root bridge of VLAN 1,4
configuration SW2 is Root bridge of VLAN 2
Configuration SW3 is Root bridge of VLAN 3
5- VLAN 1, 4 SET BLOCK PORT FOR F0/2 ON SW4
VLAN 2, 3 SET BLOCK PORT FOR F0/3 ON SW4
6- R1 IS CONFIGURATION AS A DHCP SERVER FOR 4 VLAN
7- R2 IS NETWORK ADDRESS TRANSLATION (NAT) AND PROVIDE DNS SERVICES
#====================================================
# BASIC CONFIGURATION
# [[ROUTER R1]] R1 IS CONFIGURATION AS A DHCP SERVER FOR 4 VLAN
# RESET ROUTER R1
enable
configure terminal
erase startup-config
config-register 0x2102
reload
end
wr
+++++++++++++++++
# SPEED UP
enable
configure terminal
hostname R1
alias exec s show ip interface brief
alias exec sr show running-config
no ip domain-lookup
line console 0
logging synchronous
no exec-timeout
end
wr
+++++++++++++++++++
# CONFIGURATION ENABLE PASSWORD & TELLNET
enable
configure terminal
enable password vnpro
enable secret vnpro
login
line console 0
password vnpro
login
line vty 0 4
password vnpro
login
end
wr
+++++++++++++++++++
# ASSIGN IP ADDRESS
enable
configure terminal
interface fa0/0
ip address 192.168.30.1 255.255.255.0
no shutdown
end
wr
+++++++++++++++++++
# ROUTING RIP V2
enable
configure terminal
router rip
version 2
network 192.168.30.0
no auto-summary
end
wr
+++++++++++++++++++++
# PROVIDE DHCP FOR 4 VLAN
enable
configure terminal
service dhcp
ip dhcp pool VLAN1
network 192.168.10.0 255.255.255.0
default-router 192.168.10.2
dns-server 8.8.8.8
ip dhcp pool VLAN2
network 192.168.20.0 255.255.255.0
default-router 192.168.20.2
dns-server 8.8.8.8
ip dhcp pool VLAN3
network 192.168.30.0 255.255.255.0
default-router 192.168.30.2
dns-server 8.8.8.8
ip dhcp pool VLAN4
network 192.168.40.0 255.255.255.0
default-router 192.168.40.2
dns-server 8.8.8.8
end
wr
#===================================================
# [[ROUTER R2]] R2 IS NETWORK ADDRESS TRANSLATION (NAT) AND PROVIDE DNS SERVICES
# RESET ROUTER R2
enable
configure terminal
erase startup-config
config-register 0x2102
reload
end
wr
+++++++++++++++++++++++++
# SPEED UP
enable
configure terminal
hostname R2
alias exec s show ip interface brief
alias exec sr show running-config
no ip domain-lookup
line console 0
logging synchronous
no exec-timeout
end
wr
+++++++++++++++++++++++++++++++
# CONFIGURATION ENABLE PASSWORD & TELNET
enable
configure terminal
enable password vnpro
enable secret vnpro
line console 0
password vnpro
login
line vty 0 4
password vnpro
login
end
wr
++++++++++++++++++++++++++++
#ASSIGN IP ADDRESS & SUB INTERFACE
enable
configure terminal
interface fa0/0
ip address 192.168.10.2 255.255.255.0
no shutdown
interface fa0/0.1
interface fa0/0.2
encapsulation dot1q 2
ip address 192.168.20.2 255.255.255.0
interface fa0/0.3
encapsulation dot1q 3
ip address 192.168.30.2 255.255.255.0
interface fa0/0.4
encapsulation dot1q 4
ip address 192.168.40.2 255.255.255.0
end
wr
++++++++++++++++++++
# ROUTING RIP V2
enable
configure terminal
router rip
version 2
network 192.168.10.0
network 192.168.20.0
network 192.168.30.0
network 192.168.40.0
no auto-summary
default-infomation originate
end
wr
+++++++++++++++++++++++
# AssIGN IP HELPER-ADDRESS
enable
configure terminal
interface fa0/0
ip helper-address 192.168.30.1
interface fa0/0.1
ip helper-address 192.168.30.1
interface fa0/0.2
ip helper-address 192.168.30.1
interface fa0/0.3
ip helper-address 192.168.30.1
interface fa0/0.4
ip helper-address 192.168.30.1
end
wr
++++++++++++++++++++
# NAT on R2
enable
configure terminal
access-list 1 permit any
ip nat inside sourse list 1 interface fa0/1 overload
interface fa0/1
ip nat outside
interface fa0/0
ip nat inside
interface fa0/0.2
ip nat inside
interface fa0/0.3
ip nat inside
interface fa0/0.4
ip nat inside
ip name-server 8.8.8.8 4.2.2.2
ip domain-lookup
end
wr
++++++++++++++++++++
# SAVE VLAN.DAT TO NVRAM
configure terminal
copy vtp file nvram:vlan.dat
++++++++++++++++++++
# CONFIGURATION VTP FOR SWITCH
[[SW1]]
enable
configure terminal
hostname SW1Server
vtp domain vnpro
vtp password vnpro
vtp mode server
vlan 2
vlan 3
vlan 4
interface Fa0/2
switchport mode trunk
interface Fa0/3
switchport mode trunk
interface Fa0/4
switchport mode trunk
interface vlan 3
ip address 192.168.30.201 255.255.255.0
end
wr
++++++++++++++++++++++++
[[SW2]]
enable
configure terminal
hostname SW2Client
vtp domain vnpro
vtp password vnpro
vtp mode client
interface Fa0/1
switchport mode trunk
interface Fa0/3
switchport mode trunk
interface Fa0/4
switchport mode trunk
interface vlan 3
ip address 192.168.30.202 255.255.255.0
end
wr
++++++++++++++++++++++++
[[SW3]]
enable
configure terminal
hostname SW3Client
vtp domain vnpro
vtp password vnpro
vtp mode client
interface Fa0/1
switchport mode trunk
interface Fa0/2
switchport mode trunk
interface Fa0/4
switchport mode trunk
interface vlan 3
ip address 192.168.30.203 255.255.255.0
end
wr
++++++++++++++++++++++++++++
[[SW4]]
enable
configure terminal
hostname SW4Client
vtp domain vnpro
vtp password vnpro
vtp mode client
interface Fa0/1
switchport mode trunk
interface Fa0/2
switchport mode trunk
interface Fa0/3
switchport mode trunk
interface vlan 3
ip address 192.168.30.204 255.255.255.0
end
wr
++++++++++++++++++++++++++++
# ASSIGNING SWITCH PORTS TO A VLAN
[[SW4]]
configure terminal
interface fa0/4 - 6
switchport mode access
switchport access vlan 2
interface fa0/7 - 9
switchport mode access
switchport access vlan 3
interface fa0/10 - 12
switchport mode access
switchport access vlan 4
end
wr
++++++++++++++++++++++++++
# CONFIGURATION ROOT BRIDGE
[[SW1]]
configure terminal
spanning-tree vlan 1 priority 4096
spanning-tree vlan 4 priority 4096
end
wr
[[SW2]]
configure terminal
spanning-tree vlan 2 priority 4096
end
wr
[[SW3]]
configure terminal
spanning-tree vlan 3 priority 4096
end
wr
++++++++++++++++++++++++++++
# VLAN 1, 4 SET BLOCK PORT FOR F0/2 ON SW4
# VLAN 2, 3 SET BLOCK PORT FOR F0/3 ON SW4
[[SW1]]
configure terminal
spanning-tree vlan 1 priority 4096
spanning-tree vlan 4 priority 4096
spanning-tree vlan 2 priority 12288
spanning-tree vlan 3 priority 12288
end
wr
[[SW2]]
configure terminal
spanning-tree vlan 1 priority 8192
spanning-tree vlan 4 priority 8192
spanning-tree vlan 2 priority 4096
spanning-tree vlan 3 priority 12288
end
wr
[[SW3]]
configure terminal
spanning-tree vlan 1 priority 12288
spanning-tree vlan 4 priority 12288
spanning-tree vlan 2 priority 8192
spanning-tree vlan 3 priority 4096
end
wr
[[SW4]]
configure terminal
spanning-tree vlan 1 priority 32768
spanning-tree vlan 4 priority 32768
spanning-tree vlan 2 priority 32768
spanning-tree vlan 3 priority 32768
end
wr
===========================