บทความนี้สำหรับศิษย์ที่ต้องการฝึกฝนการทำ VLAN ACL บน CISCO Switch สำหรับการนำไปใช้จริงและเตรียมตัวสอบ Cert.CCNP ENCOR นะครับ
วาด Lab ตามภาพด้านล่างด้วย GNS3 และ GNS3VM
ทำการ Config เพื่อเตรียม Lab
ISP(config)#interface g0/0
ISP(config-if)#ip address 10.10.10.6 255.255.255.252
ISP(config-if)#no shutdown
ISP(config-if)#exit
ISP(config)#interface loopback 0
ISP(config-if)#ip address 1.1.1.1 255.255.255.255
ISP(config-if)#exit
ISP(config)#router ospf 1
ISP(config-router)#network 0.0.0.0 255.255.255.255 area 0
ISP(config-router)#exit
ISP(config)#enable secret cisco
ISP(config)#username admin password cisco
ISP(config)#aaa new-model
ISP(config)#aaa authentication login default local
ISP(config)#ip domain-name Jodoi.org
ISP(config)#crypto key generate rsa modulus 1024
ISP#show control-plane host open-ports
Active internet connections (servers and established)
Prot Local Address Foreign Address Service State
tcp *:22 *:0 SSH-Server LISTEN
tcp *:23 *:0 Telnet LISTEN
udp *:18999 *:0 udp_transport Server LISTEN
SW-L3(config)#interface g0/0
SW-L3(config-if)#no switchport
SW-L3(config-if)#ip address 10.10.10.5 255.255.255.252
SW-L3(config-if)#no shutdown
SW-L3(config-if)#exit
SW-L3(config)#vlan 20
SW-L3(config-vlan)#vlan 30
SW-L3(config-vlan)#exit
SW-L3(config)#interface vlan 20
SW-L3(config-if)#ip address 192.168.1.254 255.255.255.0
SW-L3(config-if)#no shutdown
SW-L3(config-if)#exit
SW-L3(config)#interface vlan 30
SW-L3(config-if)#ip address 192.168.2.254 255.255.255.0
SW-L3(config-if)#no shutdown
SW-L3(config-if)#exit
SW-L3(config)#interface g0/1
SW-L3(config-if)#switchport trunk encapsulation dot1q
SW-L3(config-if)#switchport mode trunk
SW-L3(config-if)#exit
SW-L3(config)#ip routing
SW-L3(config)#router ospf 1
SW-L3(config-router)#network 0.0.0.0 255.255.255.255 area 0
SW-L3(config)#interface g0/1
SW-L3(config-if)#no negotiation auto
SW-L3(config-if)#duplex half
SW-L3#show ip route ospf
1.0.0.0/32 is subnetted, 1 subnets
O 1.1.1.1 [110/2] via 10.10.10.6, 00:02:18, GigabitEthernet0/0
SW-L3#ping 1.1.1.1
!!!!!
R1(config)#interface f0/0
R1(config-if)#ip address 192.168.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.1.254
R1#ping 1.1.1.1
!!!!!
R2(config)#interface f0/0
R2(config-if)#ip address 192.168.2.1 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.254
R2#ping 1.1.1.1
!!!!!
R1#telnet 1.1.1.1
Trying 1.1.1.1 ... Open
User Access Verification
Username: admin
Password: cisco
HQ>
HQ>
HQ>exit
[Connection to 1.1.1.1 closed by foreign host]
R1#
R1#ssh -l admin 1.1.1.1
Password: cisco
HQ>exit
[Connection to 1.1.1.1 closed by foreign host]
R1#
เริ่มการ Config VLAN ACL ตามขั้นตอนด้านล่าง
1) สร้าง ACL
SW-L3(config)#ip access-list extended ICMP
SW-L3(config-ext-nacl)#permit icmp any any
SW-L3(config-ext-nacl)#exit
SW-L3(config)#ip access-list extended Telnet
SW-L3(config-ext-nacl)#permit tcp any any eq 23
SW-L3(config-ext-nacl)#exit
SW-L3(config)#ip access-list extended Other
SW-L3(config-ext-nacl)#permit ip any any
SW-L3(config-ext-nacl)#exit
2) สร้าง Class MAP ( VLAN-20 )
SW-L3(config)#vlan access-map VLAN-20 5
SW-L3(config-access-map)#match ip address ICMP
SW-L3(config-access-map)#action drop
SW-L3(config-access-map)#exit
SW-L3(config)#vlan access-map VLAN-20 10
SW-L3(config-access-map)#match ip address Telnet
SW-L3(config-access-map)#action drop
SW-L3(config-access-map)#exit
SW-L3(config)#vlan access-map VLAN-20 20
SW-L3(config-access-map)#match ip address Other
SW-L3(config-access-map)#action forward
SW-L3(config-access-map)#exit
3) Enable ACL
SW-L3(config)#vlan filter VLAN-20 vlan-list 20
เริ่มทดสอบผล
R1#ping 1.1.1.1
.....
R1#telnet 1.1.1.1
Trying 1.1.1.1 ...
% Connection timed out; remote host not responding
R1#ssh -l admin 1.1.1.1
Password: cisco
HQ>
R2#ping 1.1.1.1
!!!!!
R2#telnet 1.1.1.1
Trying 1.1.1.1 ... Open
User Access Verification
Username: admin
Password:
HQ>
R2#ssh -l admin 1.1.1.1
Password: cisco
HQ>
SW-L3(config)#vlan filter VLAN-20 vlan-list 20,30
R2#ping 1.1.1.1
.....
R2#telnet 1.1.1.1
Trying 1.1.1.1 ...
% Connection timed out; remote host not responding
R2#ssh -l admin 1.1.1.1
Password: cisco
HQ>
สามารถดูเป็นวีดีโอได้ที่
VIDEO
และ
VIDEO
หวังว่าบทความนี้คงจะมีประโยชน์ไม่มากก็น้อย สำหรับผู้ที่ต้องการออกแบบ Network ภายในองค์กรของตัวเอง
--------------------------------------------------------------------------------------------------------
บทความ Network
บทความ Linux
บทความ Certificate