! ===================================================================== ! CAU HINH MAU: Switch Layer 3 Cisco 3560 / 3560-X / 3750-X / 3850 lam switch loi ! Dinh tuyen giua cac VLAN + cap DHCP + duong ra router ! Nguon: https://thietbimangcu.com/cau-hinh-mau/ ! - Can license IP Base (ma -S) tro len. Ban -L (LAN Base) cua 3560-X/3750-X khong dung duoc cau hinh nay. ! - Ten cong: 3560 doi dau la fa0/x + gi0/x; 3560-X/3750-X/3850 la gi1/0/x. ! - Doi MAT_KHAU_..., IP, VLAN cho dung mang cua ban. ! ===================================================================== enable configure terminal ! hostname SW-CORE no ip domain-lookup service password-encryption enable secret MAT_KHAU_ENABLE username admin privilege 15 secret MAT_KHAU_ADMIN ip domain-name congty.local crypto key generate rsa modulus 2048 ip ssh version 2 line vty 0 15 login local transport input ssh ! ! --- Bat dinh tuyen --- ip routing ! ! --- VLAN --- vlan 10 name VAN-PHONG vlan 20 name CAMERA vlan 99 name QUAN-LY ! ! --- Cong ao (SVI) lam gateway cho tung VLAN --- interface vlan 10 ip address 192.168.10.1 255.255.255.0 no shutdown interface vlan 20 ip address 192.168.20.1 255.255.255.0 no shutdown interface vlan 99 ip address 192.168.99.1 255.255.255.0 no shutdown ! ! --- Trunk xuong cac switch truy cap --- ! (3560 / 3560-X / 3750-X can dong encapsulation; 3850 khong co lenh nay, bo dong do di) interface gi1/0/1 description XUONG-SW-ACCESS-01 switchport trunk encapsulation dot1q switchport mode trunk switchport trunk allowed vlan 10,20,99 ! ! --- Cong noi router: cong dinh tuyen (routed port) --- interface gi1/0/24 description LEN-ROUTER no switchport ip address 10.0.0.2 255.255.255.252 no shutdown ! ! --- Duong mac dinh ra router --- ip route 0.0.0.0 0.0.0.0 10.0.0.1 ! ! --- DHCP --- ip dhcp excluded-address 192.168.10.1 192.168.10.20 ip dhcp excluded-address 192.168.20.1 192.168.20.20 ! ip dhcp pool VAN-PHONG network 192.168.10.0 255.255.255.0 default-router 192.168.10.1 dns-server 8.8.8.8 1.1.1.1 ! ip dhcp pool CAMERA network 192.168.20.0 255.255.255.0 default-router 192.168.20.1 dns-server 8.8.8.8 1.1.1.1 ! end write memory ! ! --- PHIA ROUTER (vi du Cisco ISR) phai co duong quay ve cac VLAN va NAT cho chung --- ! ip route 192.168.0.0 255.255.0.0 10.0.0.2 ! access-list 1 permit 192.168.0.0 0.0.255.255 ! ip nat inside source list 1 interface overload ! ! --- Kiem tra --- ! show ip interface brief ! show ip route ! show ip dhcp binding ! show interfaces trunk