trakimanhminh
Đã tốn tiền
Chào các thím,
Chẳng qua là dịch rảnh rỗi quá, nên mình lập topic này, chia sẻ về cấu hình các thiết bị Cisco: Router, Switch, Controller, AP.
** Video hướng dẫn chi tiết **
---> Cách cấu hình quay số pppoe cho Cisco Router <---
---> Extra: Cấu hình quay số pppoe đối với đường FTTH Viettel cần tag VLAN 35 <---
---> Cách chia VLAN và Sub Interface trên Cisco Router và Switch <---
---> Cách telnet hoặc ssh vào các Router Cisco <---
---> Cách cấu hình cân bằng tải, cộng gộp băng thông trên switch bằng EtherChannel <---
---> Cách cấu hình Router Cisco chạy dual WAN session based <---
---> Hướng dẫn cấu hình Load Balancing trên Router Cisco theo phương thức Failover <---
***** Tiếp theo ở post số 19 và 20 *****
Riêng firewall thì phải cụ thể từng tình huống, do liên quan license này nọ.
Thím nào có thắc mắc, hoặc cần hỏi gì thì mình sẽ trả lời trong này.
Chẳng qua là dịch rảnh rỗi quá, nên mình lập topic này, chia sẻ về cấu hình các thiết bị Cisco: Router, Switch, Controller, AP.
** Video hướng dẫn chi tiết **
1. Cấu hình quay số pppoe:
2. Cấu hình quay số pppoe Viettel tag VLAN 35:
3. Cách reset router Cisco:
4. Cách reset router khi vướng "PASSWORD RECOVERY FUNCTIONALITY IS DISABLED" :
5. Hướng dẫn khôi phục và copy IOS vào flash trên Cisco router trong chế độ ROMMON bằng TFTP:
2. Cấu hình quay số pppoe Viettel tag VLAN 35:
3. Cách reset router Cisco:
4. Cách reset router khi vướng "PASSWORD RECOVERY FUNCTIONALITY IS DISABLED" :
5. Hướng dẫn khôi phục và copy IOS vào flash trên Cisco router trong chế độ ROMMON bằng TFTP:
---> Cách cấu hình quay số pppoe cho Cisco Router <---
-> Cổng g0/0 kết nối với máy tính.
-> Cổng g0/1 kết nối modem VNPT
-> VD: Tên đường truyền là aaaa, password là bbbb
-> Cấu hình Router như sau:
router> en
Nhập password nếu có
router# conf t
* Bắt đầu cấu hình port kết nối với Modem VNPT *
router(config)# interface g0/1
router(config-if)# description $VNPT$
router(config-if)# no ip address
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# pppoe en group global
router(config-if)# pppoe-client dial-pool-number 1
router(config-if)# no shut
router(config-if)# no cdp enable
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
* Bắt đầu quay số pppoe *
router(config)# int dialer 1
router(config-if)# ip add nego
router(config-if)# ip mtu 1454
router(config-if)# ip nat outside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# encapsulation ppp
router(config-if)# dialer pool 1
router(config-if)# dialer-group 1
router(config-if)# no cdp en
router(config-if)# ppp authentication pap chap callin
router(config-if)# ppp pap sent-username aaaa password 0 bbbb
router(config-if)# ppp chap hostname aaaa
router(config-if)# ppp chap password bbbb
router(config-if)# exit
* Bắt đầu cấu hình port kết nối LAN *
router(config)#int g0/0
router(config-if)# ip add 192.168.1.1 255.255.255.0
router(config-if)# no shut
router(config-if)# ip nat inside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# ip virtual-reassembly
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
* Cấu hình định tuyến, để các IP bên ngoài có thể đi vào router thông qua dialer 1 *
router(config)# ip route 0.0.0.0 0.0.0.0 dialer 1
* Tạo danh sách IP bên trong LAN được phép kết nối ra internet *
router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
* Cấu hình NAT theo access-list đã cấu hình phía trên *
router(config)# ip nat inside source list 1 interface dialer 1 overload
* Tạo pool DHCP để cấp IP cho các máy bên trong mạng LAN *
router(config)# service dhcp
router(config)# ip dhcp pool 1
router(config-if)# network 192.168.1.0 255.255.255.0
router(config-if)# default-router 192.168.1.1
router(config-if)# dns-server 8.8.8.8
router(config-if)# exit
* Tạo dải IP loại trừ để phòng trường hợp cần set IP tĩnh *
router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.20
router(config)#exit
* Lưu toàn bộ cấu hình *
router# wr
* Lưu ý *
1. Đối với mạng VNPT, cần tắt modem nhà mạng tầm 20-30s, sau đó mở lại.
2. Đối với mạng FPT, cần gọi lên tổng đài để xác thực MAC-Address
3. Đối với mạng Viettel, lúc trước cần phải tag VLAN 35, nhưng sau này họ đã bỏ tag, nên trước khi cấu hình, cần phải hỏi rõ để cấu hình cho chính xác.
-> Cổng g0/1 kết nối modem VNPT
-> VD: Tên đường truyền là aaaa, password là bbbb
-> Cấu hình Router như sau:
router> en
Nhập password nếu có
router# conf t
* Bắt đầu cấu hình port kết nối với Modem VNPT *
router(config)# interface g0/1
router(config-if)# description $VNPT$
router(config-if)# no ip address
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# pppoe en group global
router(config-if)# pppoe-client dial-pool-number 1
router(config-if)# no shut
router(config-if)# no cdp enable
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
* Bắt đầu quay số pppoe *
router(config)# int dialer 1
router(config-if)# ip add nego
router(config-if)# ip mtu 1454
router(config-if)# ip nat outside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# encapsulation ppp
router(config-if)# dialer pool 1
router(config-if)# dialer-group 1
router(config-if)# no cdp en
router(config-if)# ppp authentication pap chap callin
router(config-if)# ppp pap sent-username aaaa password 0 bbbb
router(config-if)# ppp chap hostname aaaa
router(config-if)# ppp chap password bbbb
router(config-if)# exit
* Bắt đầu cấu hình port kết nối LAN *
router(config)#int g0/0
router(config-if)# ip add 192.168.1.1 255.255.255.0
router(config-if)# no shut
router(config-if)# ip nat inside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# ip virtual-reassembly
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
* Cấu hình định tuyến, để các IP bên ngoài có thể đi vào router thông qua dialer 1 *
router(config)# ip route 0.0.0.0 0.0.0.0 dialer 1
* Tạo danh sách IP bên trong LAN được phép kết nối ra internet *
router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
* Cấu hình NAT theo access-list đã cấu hình phía trên *
router(config)# ip nat inside source list 1 interface dialer 1 overload
* Tạo pool DHCP để cấp IP cho các máy bên trong mạng LAN *
router(config)# service dhcp
router(config)# ip dhcp pool 1
router(config-if)# network 192.168.1.0 255.255.255.0
router(config-if)# default-router 192.168.1.1
router(config-if)# dns-server 8.8.8.8
router(config-if)# exit
* Tạo dải IP loại trừ để phòng trường hợp cần set IP tĩnh *
router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.20
router(config)#exit
* Lưu toàn bộ cấu hình *
router# wr
* Lưu ý *
1. Đối với mạng VNPT, cần tắt modem nhà mạng tầm 20-30s, sau đó mở lại.
2. Đối với mạng FPT, cần gọi lên tổng đài để xác thực MAC-Address
3. Đối với mạng Viettel, lúc trước cần phải tag VLAN 35, nhưng sau này họ đã bỏ tag, nên trước khi cấu hình, cần phải hỏi rõ để cấu hình cho chính xác.
---> Extra: Cấu hình quay số pppoe đối với đường FTTH Viettel cần tag VLAN 35 <---
Sơ đồ
F0/1: Kết nối với VIETTEL
F0/0: Kết nối với SWITCH hoặc LAPTOP, PC
Bạn cấu hình như sau:
---> Cấu hình port f0/0 <---
router# conf t
router(config)# int f0/0
router(config-if)# description $LOCAL_LAN$
router(config-if)# ip add 192.168.10.1 255.255.255.0
router(config-if)# no shut
router(config-if)# ip nat inside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# ip virtual-reassembly in
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
---> Cấu hình port f0/1 và tag vlan 35 <---
router(config)# interface f0/1
router(config-if)# no shutdown
router(config-if)# exit
router(config-if)# interface f0/1.35
router(config-if)# description $VIETTEL_1$
router(config-if)# encapsulation dot1q 35
router(config-if)# no ip address
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# pppoe en group global
router(config-if)# pppoe-client dial-pool-number 1
router(config-if)# no shut
router(config-if)# no cdp enable
router(config-if)# exit
---> Tiến hành quay số pppoe <---
router(config)# int dialer 1
router(config-if)# ip add nego
router(config-if)# ip mtu 1454
router(config-if)# ip nat outside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# encapsulation ppp
router(config-if)# dialer pool 1
router(config-if)# dialer-group 1
router(config-if)# no cdp en
router(config-if)# ppp authentication pap chap callin
router(config-if)# ppp pap sent-username aaaa password 0 bbbb
router(config-if)# ppp chap hostname aaaa
router(config-if)# ppp chap password bbbb
router(config-if)# exit
---> Tiến hành route, NAT, cấu hình access-list, pool DHCP <---
router(config)# ip route 0.0.0.0 0.0.0.0 dialer 1
router(config)# access-list 1 permit 192.168.10.0 0.0.0.255
router(config)# ip nat inside source list 1 interface dialer 1 overload
router(config)# service dhcp
router(config)# ip dhcp pool 1
router(config-if)# network 192.168.10.0 255.255.255.0
router(config-if)# default-router 192.168.10.1
router(config-if)# dns-server 8.8.8.8
router(config-if)# exit
---> Tạo dải IP loại trừ và lưu cấu hình <---
router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.20
router(config)#exit
router# wr
F0/1: Kết nối với VIETTEL
F0/0: Kết nối với SWITCH hoặc LAPTOP, PC
Bạn cấu hình như sau:
---> Cấu hình port f0/0 <---
router# conf t
router(config)# int f0/0
router(config-if)# description $LOCAL_LAN$
router(config-if)# ip add 192.168.10.1 255.255.255.0
router(config-if)# no shut
router(config-if)# ip nat inside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# ip virtual-reassembly in
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
---> Cấu hình port f0/1 và tag vlan 35 <---
router(config)# interface f0/1
router(config-if)# no shutdown
router(config-if)# exit
router(config-if)# interface f0/1.35
router(config-if)# description $VIETTEL_1$
router(config-if)# encapsulation dot1q 35
router(config-if)# no ip address
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# pppoe en group global
router(config-if)# pppoe-client dial-pool-number 1
router(config-if)# no shut
router(config-if)# no cdp enable
router(config-if)# exit
---> Tiến hành quay số pppoe <---
router(config)# int dialer 1
router(config-if)# ip add nego
router(config-if)# ip mtu 1454
router(config-if)# ip nat outside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# encapsulation ppp
router(config-if)# dialer pool 1
router(config-if)# dialer-group 1
router(config-if)# no cdp en
router(config-if)# ppp authentication pap chap callin
router(config-if)# ppp pap sent-username aaaa password 0 bbbb
router(config-if)# ppp chap hostname aaaa
router(config-if)# ppp chap password bbbb
router(config-if)# exit
---> Tiến hành route, NAT, cấu hình access-list, pool DHCP <---
router(config)# ip route 0.0.0.0 0.0.0.0 dialer 1
router(config)# access-list 1 permit 192.168.10.0 0.0.0.255
router(config)# ip nat inside source list 1 interface dialer 1 overload
router(config)# service dhcp
router(config)# ip dhcp pool 1
router(config-if)# network 192.168.10.0 255.255.255.0
router(config-if)# default-router 192.168.10.1
router(config-if)# dns-server 8.8.8.8
router(config-if)# exit
---> Tạo dải IP loại trừ và lưu cấu hình <---
router(config)# ip dhcp excluded-address 192.168.10.1 192.168.10.20
router(config)#exit
router# wr
---> Cách chia VLAN và Sub Interface trên Cisco Router và Switch <---
* Chia VLAN trên Switch *
switch> en
Nhập password nếu có
switch# conf t
switch(config)# vlan 10 ---> tạo vlan 10
switch(config-vlan)# name TIGERNET ---> đặt tên cho vlan
switch(config-vlan)# exit
switch(config)# int vlan 10
switch(config-if)# ip add 192.168.10.1 255.255.255.0 ---> Gán IP cho vlan 10
switch(config-if)# end
switch# write
* Chia VLAN trên Router *
router> en
Nhập password nếu có
router# conf t
router(config)# interface g0/0.10 ---> Tạo sub - interface trên router
router(config-if)# encapsulation dot1q 10 ---> Gán và tạo vlan 10
router(config-if)# ip add 192.168.10.1 255.255.255.0 ---> Gán địa chỉ IP
router(config-if)# no shut ---> Do mặc định cổng WAN luôn ở chế độ shut, nên phải no shut để port luôn ở chế độ on.
router# write
* Chia VLAN trên router 8xx, hoặc router có gắn thêm card HWIC-4ESW, EHWIC-4ESG, NIM-ES2-4,... *
router> en
Nhập password nếu có
router# conf t
router(config)# vlan 10 ---> tạo vlan 10
router(config-vlan)# name TIGERNET ---> đặt tên cho vlan
router(config-vlan)# exit
router(config)# int vlan 10
router(config-if)# ip add 192.168.10.1 255.255.255.0 ---> Gán IP cho vlan 10
router(config-if)# end
router# write
Lưu ý
1. Trên router series 8xx hoặc router có gắn thêm card mở rộng, VLAN có thêm chức năng NAT, còn đối với các switch thì VLAN không có chức năng này.
2. Địa chỉ IP VLAN trên router không được phép trùng với địa chỉ IP của các cổng mạng.
VD: IP port G0/0 là 192.168.1.1 thì VLAN 1 không thể đặt IP là 192.168.1.10, lúc này router sẽ báo lỗi.
switch> en
Nhập password nếu có
switch# conf t
switch(config)# vlan 10 ---> tạo vlan 10
switch(config-vlan)# name TIGERNET ---> đặt tên cho vlan
switch(config-vlan)# exit
switch(config)# int vlan 10
switch(config-if)# ip add 192.168.10.1 255.255.255.0 ---> Gán IP cho vlan 10
switch(config-if)# end
switch# write
* Chia VLAN trên Router *
router> en
Nhập password nếu có
router# conf t
router(config)# interface g0/0.10 ---> Tạo sub - interface trên router
router(config-if)# encapsulation dot1q 10 ---> Gán và tạo vlan 10
router(config-if)# ip add 192.168.10.1 255.255.255.0 ---> Gán địa chỉ IP
router(config-if)# no shut ---> Do mặc định cổng WAN luôn ở chế độ shut, nên phải no shut để port luôn ở chế độ on.
router# write
* Chia VLAN trên router 8xx, hoặc router có gắn thêm card HWIC-4ESW, EHWIC-4ESG, NIM-ES2-4,... *
router> en
Nhập password nếu có
router# conf t
router(config)# vlan 10 ---> tạo vlan 10
router(config-vlan)# name TIGERNET ---> đặt tên cho vlan
router(config-vlan)# exit
router(config)# int vlan 10
router(config-if)# ip add 192.168.10.1 255.255.255.0 ---> Gán IP cho vlan 10
router(config-if)# end
router# write
Lưu ý
1. Trên router series 8xx hoặc router có gắn thêm card mở rộng, VLAN có thêm chức năng NAT, còn đối với các switch thì VLAN không có chức năng này.
2. Địa chỉ IP VLAN trên router không được phép trùng với địa chỉ IP của các cổng mạng.
VD: IP port G0/0 là 192.168.1.1 thì VLAN 1 không thể đặt IP là 192.168.1.10, lúc này router sẽ báo lỗi.
---> Cách telnet hoặc ssh vào các Router Cisco <---
* Mục đích: Quản trị từ xa bằng Telnet hoặc SSH *
* Cấu hình Telnet *
router> en
Nhập password nếu có
router# conf t
router(config)# enable secret Tigernet
router(config-line)# line vty 0 4
router(config-line)# transport input telnet
router(config-line)# password Tigernet
router(config-line)# login
router(config-line)# end
router# wr
* Đôi khi, một số nhà mạng chặn port mặc định 23, do đó chúng ta thay đổi port mặc định thành 3223 như sau *
router(config)# ip nat inside source static tcp 192.168.1.1 23 interface Dialer1 3223
Trong đó:
---> 192.168.1.1 là IP của default-gateway
Sau khi cấu hình xong, chúng ta đã có thể telnet vào router từ xa, với địa chỉ IP pulic (Có thể vào ping.eu để kiểm tra), bằng port 23 (Mặc định) hoặc port 3223 (Sau khi thay đổi)
* Cấu hình SSH*
router> en
Nhập username hoặc password nếu có
router# conf t
router(config)# hostname TIGERNET
TIGERNET(config)# enable password Tigernet
TIGERNET(config)# ip domain name tigernet.com.vn
TIGERNET(config)# ip ssh version 2
TIGERNET(config)# crypto key generate rsa
The name for the keys will be: tigernet.com.vn
Choose the size of the key modulus in the range of 360 to 4096 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.
How many bits in the modulus [512]: 768
% Generating 768 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 2 seconds)
TIGERNET(config)# username Tigernet privilege 15 password Tigernet
TIGERNET(config)# line vty 0 4
TIGERNET(config-line)# login local
TIGERNET(config-line)# transport input ssh
TIGERNET(config-line)# exec-timeout 0 0 ---> Để không bị timeout khi không tác động đến phiên ssh
TIGERNET(config-line)#end
TIGERNET#wr
Sau khi cấu hình xong, chúng ta đã có thể SSH vào router từ xa, với địa chỉ IP pulic (Có thể vào ping.eu để kiểm tra), bằng port 22 (Mặc định).
* Lưu ý *
---> SSH luôn được đánh giá cao hơn Telnet về mặt bảo mật
---> Có thể kết hợp với access-list để cấu hình thêm các lựa chọn (Chỉ cho phép 1 IP hoặc dải IP nhất định nào đó telnet hoặc ssh đến,...)
* Cấu hình Telnet *
router> en
Nhập password nếu có
router# conf t
router(config)# enable secret Tigernet
router(config-line)# line vty 0 4
router(config-line)# transport input telnet
router(config-line)# password Tigernet
router(config-line)# login
router(config-line)# end
router# wr
* Đôi khi, một số nhà mạng chặn port mặc định 23, do đó chúng ta thay đổi port mặc định thành 3223 như sau *
router(config)# ip nat inside source static tcp 192.168.1.1 23 interface Dialer1 3223
Trong đó:
---> 192.168.1.1 là IP của default-gateway
Sau khi cấu hình xong, chúng ta đã có thể telnet vào router từ xa, với địa chỉ IP pulic (Có thể vào ping.eu để kiểm tra), bằng port 23 (Mặc định) hoặc port 3223 (Sau khi thay đổi)
* Cấu hình SSH*
router> en
Nhập username hoặc password nếu có
router# conf t
router(config)# hostname TIGERNET
TIGERNET(config)# enable password Tigernet
TIGERNET(config)# ip domain name tigernet.com.vn
TIGERNET(config)# ip ssh version 2
TIGERNET(config)# crypto key generate rsa
The name for the keys will be: tigernet.com.vn
Choose the size of the key modulus in the range of 360 to 4096 for your
General Purpose Keys. Choosing a key modulus greater than 512 may take
a few minutes.
How many bits in the modulus [512]: 768
% Generating 768 bit RSA keys, keys will be non-exportable...
[OK] (elapsed time was 2 seconds)
TIGERNET(config)# username Tigernet privilege 15 password Tigernet
TIGERNET(config)# line vty 0 4
TIGERNET(config-line)# login local
TIGERNET(config-line)# transport input ssh
TIGERNET(config-line)# exec-timeout 0 0 ---> Để không bị timeout khi không tác động đến phiên ssh
TIGERNET(config-line)#end
TIGERNET#wr
Sau khi cấu hình xong, chúng ta đã có thể SSH vào router từ xa, với địa chỉ IP pulic (Có thể vào ping.eu để kiểm tra), bằng port 22 (Mặc định).
* Lưu ý *
---> SSH luôn được đánh giá cao hơn Telnet về mặt bảo mật
---> Có thể kết hợp với access-list để cấu hình thêm các lựa chọn (Chỉ cho phép 1 IP hoặc dải IP nhất định nào đó telnet hoặc ssh đến,...)
---> Cách cấu hình cân bằng tải, cộng gộp băng thông trên switch bằng EtherChannel <---
Mục đích
1. Cân bằng tải giữa Router với Switch, Switch với Switch. Đặc biệt hữu hiệu khi chạy chế độ stack giữa 2 switch với nhau, khi 1 switch gặp sự cố, đường link không bị down.
2. Gộp 2 hoặc nhiều ports (Tối đa 8 ports) thành 1 port để tăng băng thông. VD: Gộp 8port 1Gbs thành 1 port 10Gbs.
Tiến hành cấu hình như sau
Switch 1:
switch1> en
Nhập password nếu có
switch1# conf t
switch1(config)# port-channel load-balance src-dst-mac
switch1(config)# interface Port-channel2
switch1(config-if)# description LINK TO SWITCH 2
switch1(config-if)# switchport trunk allowed vlan 1,7,10 ---> Cho phép các vlan được phép đi qua etherchannel này
switch1(config-if)# switchport mode trunk
switch1(config-if)# exit
switch1(config)# interface range GigabitEthernet1/0/1-2 ---> Gộp 2 port
switch1(config-if)# shut
switch1(config-if)# description Portchannel 2 Switch 1
switch1(config-if)# switchport trunk allowed vlan 1,7,10
switch1(config-if)# switchport mode trunk
switch1(config-if)# channel-protocol lacp ---> Phương thức này để cho phép sử dụng kết nối giữa switch Cisco và non-Cisco
switch1(config-if)# channel-group 2 mode active
switch1(config-if)# no shut
switch1(config-if)# end
switch1# wr
Trên switch 2:
switch2> en
Nhập password nếu có
switch2#conf t
switch2(config)# port-channel load-balance src-dst-mac
switch2(config)# interface Port-channel2
switch2(config-if)# description LINK TO SWITCH 1
switch2(config-if)# switchport trunk allowed vlan 1,7,10
switch2(config-if)# switchport mode trunk
switch2(config)# exit
switch2(config-if)# interface range GigabitEthernet1/0/1-2
switch2(config-if)# shut
switch2(config-if)# description Portchannel 2 Switch 2
switch2(config-if)# switchport trunk allowed vlan 1,7,10
switch2(config-if)# switchport mode trunk
switch2(config-if)# channel-protocol lacp
switch2(config-if)# channel-group 2 mode active
switch2(config-if)# no shut
switch2(config-if)# end
switch2#wr
* Lưu ý *
---> Bắt buộc phải shutdown các port trước khi cấu hình, nếu không sẽ gây ra lỗi. Các port phải cùng tốc độ (Speed/Duplex)
---> Có thể gắn card HWIC-4ESW, EHWIC-4ESG, NIM-ES2-4, .... trên router, rồi nối các port trên card vào switch để cân bằng tải.
---> Có thể kết hợp cấu hình etherchannel để cân bằng tải và dự phòng giữa switch Cisco với server.
---> Mỗi chip xử lý trên switch gộp 8ports lại và xử lý cùng 1 chip, do đó, để cân bằng tải hiệu quả, thường tính port theo nguyên tắc 8+. VD: Port 1 và port 9 thành 1 group, Port 10 và 18 thành 1 group,...
1. Cân bằng tải giữa Router với Switch, Switch với Switch. Đặc biệt hữu hiệu khi chạy chế độ stack giữa 2 switch với nhau, khi 1 switch gặp sự cố, đường link không bị down.
2. Gộp 2 hoặc nhiều ports (Tối đa 8 ports) thành 1 port để tăng băng thông. VD: Gộp 8port 1Gbs thành 1 port 10Gbs.
Tiến hành cấu hình như sau
Switch 1:
switch1> en
Nhập password nếu có
switch1# conf t
switch1(config)# port-channel load-balance src-dst-mac
switch1(config)# interface Port-channel2
switch1(config-if)# description LINK TO SWITCH 2
switch1(config-if)# switchport trunk allowed vlan 1,7,10 ---> Cho phép các vlan được phép đi qua etherchannel này
switch1(config-if)# switchport mode trunk
switch1(config-if)# exit
switch1(config)# interface range GigabitEthernet1/0/1-2 ---> Gộp 2 port
switch1(config-if)# shut
switch1(config-if)# description Portchannel 2 Switch 1
switch1(config-if)# switchport trunk allowed vlan 1,7,10
switch1(config-if)# switchport mode trunk
switch1(config-if)# channel-protocol lacp ---> Phương thức này để cho phép sử dụng kết nối giữa switch Cisco và non-Cisco
switch1(config-if)# channel-group 2 mode active
switch1(config-if)# no shut
switch1(config-if)# end
switch1# wr
Trên switch 2:
switch2> en
Nhập password nếu có
switch2#conf t
switch2(config)# port-channel load-balance src-dst-mac
switch2(config)# interface Port-channel2
switch2(config-if)# description LINK TO SWITCH 1
switch2(config-if)# switchport trunk allowed vlan 1,7,10
switch2(config-if)# switchport mode trunk
switch2(config)# exit
switch2(config-if)# interface range GigabitEthernet1/0/1-2
switch2(config-if)# shut
switch2(config-if)# description Portchannel 2 Switch 2
switch2(config-if)# switchport trunk allowed vlan 1,7,10
switch2(config-if)# switchport mode trunk
switch2(config-if)# channel-protocol lacp
switch2(config-if)# channel-group 2 mode active
switch2(config-if)# no shut
switch2(config-if)# end
switch2#wr
* Lưu ý *
---> Bắt buộc phải shutdown các port trước khi cấu hình, nếu không sẽ gây ra lỗi. Các port phải cùng tốc độ (Speed/Duplex)
---> Có thể gắn card HWIC-4ESW, EHWIC-4ESG, NIM-ES2-4, .... trên router, rồi nối các port trên card vào switch để cân bằng tải.
---> Có thể kết hợp cấu hình etherchannel để cân bằng tải và dự phòng giữa switch Cisco với server.
---> Mỗi chip xử lý trên switch gộp 8ports lại và xử lý cùng 1 chip, do đó, để cân bằng tải hiệu quả, thường tính port theo nguyên tắc 8+. VD: Port 1 và port 9 thành 1 group, Port 10 và 18 thành 1 group,...
---> Cách cấu hình Router Cisco chạy dual WAN session based <---
Sơ đồ như sau
Cổng G0/1: Nối với đường VNPT, username aaaa / password bbbb
Cổng G0/2: Nối với đường FPT, username cccc / password dddd
Cổng G0/0: Nối đến switch, IP: 192.168.1.1 / Netmask 255.255.255.0
---> Mục đích: Chạy 1 lúc cả 2 đường truyền, khi một trong hai đường truyền gặp trục trặc, sẽ chuyển sang đường truyền còn lại mà không gây gián đoạn.
Tiến hành cấu hình như sau
router> en
Nhập password nếu có
router# conf t
Cấu hình cổng LAN
router(config)#int g0/0
router(config-if)# ip add 192.168.1.1 255.255.255.0
router(config-if)# no shut
router(config-if)# ip nat inside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# ip virtual-reassembly
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
Cấu hình cổng kết nối modem VNPT
router(config)# interface g0/1
router(config-if)# description $VNPT$
router(config-if)# no ip address
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# pppoe en group global
router(config-if)# pppoe-client dial-pool-number 1
router(config-if)# no shut
router(config-if)# no cdp enable
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
Cấu hình cổng kết nối modem FPT
router(config)# interface g0/2
router(config-if)# description $FPT$
router(config-if)# no ip address
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# pppoe en group global
router(config-if)# pppoe-client dial-pool-number 2
router(config-if)# no shut
router(config-if)# no cdp enable
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
Tiến hành quay số pppoe đường VNPT
router(config)# int dialer 1
router(config-if)# ip add nego
router(config-if)# ip mtu 1454
router(config-if)# ip nat outside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# encapsulation ppp
router(config-if)# dialer pool 1
router(config-if)# dialer-group 1
router(config-if)# no cdp en
router(config-if)# ppp authentication pap chap callin
router(config-if)# ppp pap sent-username aaaa password 0 bbbb
router(config-if)# ppp chap hostname aaaa
router(config-if)# ppp chap password bbbb
router(config-if)# exit
Tiến hành quay số pppoe đường FPT
router(config)# int dialer 2
router(config-if)# ip add nego
router(config-if)# ip mtu 1454
router(config-if)# ip nat outside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# encapsulation ppp
router(config-if)# dialer pool 2
router(config-if)# dialer-group 2
router(config-if)# no cdp en
router(config-if)# ppp authentication pap chap callin
router(config-if)# ppp pap sent-username cccc password 0 dddd
router(config-if)# ppp chap hostname cccc
router(config-if)# ppp chap password dddd
router(config-if)# exit
Tạo route-map cho 2 đường
router(config)# route-map VNPT permit 10
router(config-route-map)# match ip address 1
router(config-route-map)# match interface dialer1
router(config-route-map)# exit
router(config)#route-map FPT permit 10
router(config-route-map)# match ip address 1
router(config-route-map)# match interface dialer2
router(config-route-map)# exit
Tạo dải IP cho phép, NAT và route theo route-map đã cấu hình phía trên
router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
router(config)# ip route 0.0.0.0 0.0.0.0 dialer1 name VNPT
router(config)# ip route 0.0.0.0 0.0.0.0 dialer2 name FPT
router(config)# ip nat inside source route-map VNPT interface dialer1 overload
router(config)# ip nat inside source route-map FPT interface dialer2 overload
Tạo pool DHCP để cấp IP cho các thiết bị bên dưới
router(config)# service dhcp
router(config)# ip dhcp pool 1
router(dhcp-config)# network 192.168.1.0 255.255.255.0
router(dhcp-config)# default-router 192.168.1.1
router(dhcp-config)# dns-server 208.67.220.220 208.67.222.222
router(dhcp-config)# exit
Tạo dải IP loại trừ
router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.20
router(config)# exit
router# wr
Lưu ý
---> Cấu hình trên sử dụng 1 lúc hai đường truyền. Tuy nhiên, khi speedtest không cộng gộp băng thông như Router Draytek hay Mikrotik.
---> Khuyến cáo chỉ nên sử dụng 2 đường WAN đối với cách cấu hình này, đã test và chạy ổn. Khi có nhiều hơn 3 đường WAN, bảng định tuyến lúc này sẽ trở nên rối rắm, router mất một khoản thời gian để so sánh và đối chiếu, nên sẽ làm mạng chạy không được mượt.
---> Đối với mạng VNPT, cần tắt modem nhà mạng tầm 20-30s, sau đó mở lại để nhận IP pppoe.
---> Đối với mạng FPT, cần gọi lên tổng đài để xác thực MAC-Address.
---> Đối với mạng Viettel, lúc trước cần phải tag VLAN 35, nhưng sau này họ đã bỏ tag, nên trước khi cấu hình, cần phải hỏi rõ để cấu hình cho chính xác.
Cổng G0/1: Nối với đường VNPT, username aaaa / password bbbb
Cổng G0/2: Nối với đường FPT, username cccc / password dddd
Cổng G0/0: Nối đến switch, IP: 192.168.1.1 / Netmask 255.255.255.0
---> Mục đích: Chạy 1 lúc cả 2 đường truyền, khi một trong hai đường truyền gặp trục trặc, sẽ chuyển sang đường truyền còn lại mà không gây gián đoạn.
Tiến hành cấu hình như sau
router> en
Nhập password nếu có
router# conf t
Cấu hình cổng LAN
router(config)#int g0/0
router(config-if)# ip add 192.168.1.1 255.255.255.0
router(config-if)# no shut
router(config-if)# ip nat inside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# ip virtual-reassembly
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
Cấu hình cổng kết nối modem VNPT
router(config)# interface g0/1
router(config-if)# description $VNPT$
router(config-if)# no ip address
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# pppoe en group global
router(config-if)# pppoe-client dial-pool-number 1
router(config-if)# no shut
router(config-if)# no cdp enable
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
Cấu hình cổng kết nối modem FPT
router(config)# interface g0/2
router(config-if)# description $FPT$
router(config-if)# no ip address
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# pppoe en group global
router(config-if)# pppoe-client dial-pool-number 2
router(config-if)# no shut
router(config-if)# no cdp enable
router(config-if)# duplex auto
router(config-if)# speed auto
router(config-if)# exit
Tiến hành quay số pppoe đường VNPT
router(config)# int dialer 1
router(config-if)# ip add nego
router(config-if)# ip mtu 1454
router(config-if)# ip nat outside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# encapsulation ppp
router(config-if)# dialer pool 1
router(config-if)# dialer-group 1
router(config-if)# no cdp en
router(config-if)# ppp authentication pap chap callin
router(config-if)# ppp pap sent-username aaaa password 0 bbbb
router(config-if)# ppp chap hostname aaaa
router(config-if)# ppp chap password bbbb
router(config-if)# exit
Tiến hành quay số pppoe đường FPT
router(config)# int dialer 2
router(config-if)# ip add nego
router(config-if)# ip mtu 1454
router(config-if)# ip nat outside
router(config-if)# ip nat enable
router(config-if)# ip tcp adjust-mss 1400
router(config-if)# encapsulation ppp
router(config-if)# dialer pool 2
router(config-if)# dialer-group 2
router(config-if)# no cdp en
router(config-if)# ppp authentication pap chap callin
router(config-if)# ppp pap sent-username cccc password 0 dddd
router(config-if)# ppp chap hostname cccc
router(config-if)# ppp chap password dddd
router(config-if)# exit
Tạo route-map cho 2 đường
router(config)# route-map VNPT permit 10
router(config-route-map)# match ip address 1
router(config-route-map)# match interface dialer1
router(config-route-map)# exit
router(config)#route-map FPT permit 10
router(config-route-map)# match ip address 1
router(config-route-map)# match interface dialer2
router(config-route-map)# exit
Tạo dải IP cho phép, NAT và route theo route-map đã cấu hình phía trên
router(config)# access-list 1 permit 192.168.1.0 0.0.0.255
router(config)# ip route 0.0.0.0 0.0.0.0 dialer1 name VNPT
router(config)# ip route 0.0.0.0 0.0.0.0 dialer2 name FPT
router(config)# ip nat inside source route-map VNPT interface dialer1 overload
router(config)# ip nat inside source route-map FPT interface dialer2 overload
Tạo pool DHCP để cấp IP cho các thiết bị bên dưới
router(config)# service dhcp
router(config)# ip dhcp pool 1
router(dhcp-config)# network 192.168.1.0 255.255.255.0
router(dhcp-config)# default-router 192.168.1.1
router(dhcp-config)# dns-server 208.67.220.220 208.67.222.222
router(dhcp-config)# exit
Tạo dải IP loại trừ
router(config)# ip dhcp excluded-address 192.168.1.1 192.168.1.20
router(config)# exit
router# wr
Lưu ý
---> Cấu hình trên sử dụng 1 lúc hai đường truyền. Tuy nhiên, khi speedtest không cộng gộp băng thông như Router Draytek hay Mikrotik.
---> Khuyến cáo chỉ nên sử dụng 2 đường WAN đối với cách cấu hình này, đã test và chạy ổn. Khi có nhiều hơn 3 đường WAN, bảng định tuyến lúc này sẽ trở nên rối rắm, router mất một khoản thời gian để so sánh và đối chiếu, nên sẽ làm mạng chạy không được mượt.
---> Đối với mạng VNPT, cần tắt modem nhà mạng tầm 20-30s, sau đó mở lại để nhận IP pppoe.
---> Đối với mạng FPT, cần gọi lên tổng đài để xác thực MAC-Address.
---> Đối với mạng Viettel, lúc trước cần phải tag VLAN 35, nhưng sau này họ đã bỏ tag, nên trước khi cấu hình, cần phải hỏi rõ để cấu hình cho chính xác.
---> Hướng dẫn cấu hình Load Balancing trên Router Cisco theo phương thức Failover <---
Sơ đồ như sau
ISP1: FPT
Tên đường truyền: aaaa Password: bbbb
Kết nối port G0/1
ISP2: VNPT
Tên đường truyền: cccc Password: dddd
Kết nối port G0/2
Local LAN: 192.168.1.1 / Netmask: 255.255.255.0
Kết nối port G0/0
Mục đích
Sử dụng đường FPT là đường sử dụng chính, VNPT là đường dự phòng. Khi đường FPT down thì ngay lập tức chuyển sang đường VNPT. Khi đường FPT up trở lại thì chuyển sang đường FPT, còn đường VNPT quay trở lại trạng thái chờ.
Tiến hành cấu hình như sau
---> Mình bỏ qua khúc quay số pppoe và tạo pool DHCP vì đã có tài liệu hướng dẫn, các bạn có thể tham khảo ở bài quay số pppoe và tạo pool DHCP ở các phần trên.
---> Sau khi tiến hành quay số pppoe xong, chúng ta tiếp tục cấu hình như sau:
Tạo access-list cho phép NAT
router(config)# ip access-list standard ACL-DNAT
router(config-ext-nacl)# permit 192.168.1.0 0.0.0.255
router(config-ext-nacl)# exit
Tạo route-map để xác định bảng định tuyến
router(config)# route-map RM-NAT-ISP01 10 ---> Số 10 là số thứ tự
router(config-route-map)# match ip add ACL-DNAT
router(config-route-map)# match int dialer 1
router(config-route-map)# exit
router(config)# route-map RM-NAT-ISP02 10
router(config-route-map)# match ip add ACL-DNAT
router(config-route-map)# match int dialer 2
router(config-route-map)# exit
Tiến hành NAT theo bảng định tuyến
router(config)# ip nat inside source route-map RM-NAT-ISP01 int dialer 1 overload
router(config)# ip nat inside source route-map RM-NAT-ISP02 int dialer 2 overload
Tạo ip sla để theo dõi tình trạng dialer
router(config)#ip sla 20 ---> 20 là số thứ tự
router(config-ip-sla)# icmp-echo 8.8.8.8
router(config-ip-sla)# threshold 1 ---> nếu 1 lần ping thất bại thì tiến trình track sẽ rơi vào trạng thái down
router(config-ip-sla)# timeout 200 ---> kể từ lúc gửi gói tin ping icmp-echo, sau 200 ms mà không nhận được hồi đáp icmp-reply thì được tính là một lần ping thất bại
router(config-ip-sla)# frequency 1 ---> ping định kỳ 1 giây một lần tới địa chỉ 8.8.8.8
router(config-ip-sla)# exit
router(config)# ip sla schedule 20 life forever start-time now
router(config)# track 1 ip sla 20 reachability ---> Số 1 là số thứ tự, số 20 là số ip sla đã khai báo bên trên
router(config-track)# delay down 0 up 0 ---> Downtime 0s, sau 0s sẽ quay về lại Dialer1 để định tuyến, khi phát hiện Dialer 1 ở trạng thái up
router(config-track)# exit
Track định tuyến dialer theo IP SLA đã thiết lập
router(config)# ip route 0.0.0.0 0.0.0.0 dialer 1 track 1
router(config)# ip route 0.0.0.0 0.0.0.0 dialer 2 2 ---> So 2: là số thứ tự
Lưu ý
1. Router Cisco cần có license DATA, hoặc SEC để có thể sử dụng được IP SLA. Riêng đối với các dòng ISR 4K thì cần license App hoặc SEC. Các dòng router đời cũ thì cần tối thiểu advservices IOS.
2. Có thể thay IP 8.8.8.8 bằng các IP khác. VD: 1.1.1.1 , 208.67.222.222 , ...
ISP1: FPT
Tên đường truyền: aaaa Password: bbbb
Kết nối port G0/1
ISP2: VNPT
Tên đường truyền: cccc Password: dddd
Kết nối port G0/2
Local LAN: 192.168.1.1 / Netmask: 255.255.255.0
Kết nối port G0/0
Mục đích
Sử dụng đường FPT là đường sử dụng chính, VNPT là đường dự phòng. Khi đường FPT down thì ngay lập tức chuyển sang đường VNPT. Khi đường FPT up trở lại thì chuyển sang đường FPT, còn đường VNPT quay trở lại trạng thái chờ.
Tiến hành cấu hình như sau
---> Mình bỏ qua khúc quay số pppoe và tạo pool DHCP vì đã có tài liệu hướng dẫn, các bạn có thể tham khảo ở bài quay số pppoe và tạo pool DHCP ở các phần trên.
---> Sau khi tiến hành quay số pppoe xong, chúng ta tiếp tục cấu hình như sau:
Tạo access-list cho phép NAT
router(config)# ip access-list standard ACL-DNAT
router(config-ext-nacl)# permit 192.168.1.0 0.0.0.255
router(config-ext-nacl)# exit
Tạo route-map để xác định bảng định tuyến
router(config)# route-map RM-NAT-ISP01 10 ---> Số 10 là số thứ tự
router(config-route-map)# match ip add ACL-DNAT
router(config-route-map)# match int dialer 1
router(config-route-map)# exit
router(config)# route-map RM-NAT-ISP02 10
router(config-route-map)# match ip add ACL-DNAT
router(config-route-map)# match int dialer 2
router(config-route-map)# exit
Tiến hành NAT theo bảng định tuyến
router(config)# ip nat inside source route-map RM-NAT-ISP01 int dialer 1 overload
router(config)# ip nat inside source route-map RM-NAT-ISP02 int dialer 2 overload
Tạo ip sla để theo dõi tình trạng dialer
router(config)#ip sla 20 ---> 20 là số thứ tự
router(config-ip-sla)# icmp-echo 8.8.8.8
router(config-ip-sla)# threshold 1 ---> nếu 1 lần ping thất bại thì tiến trình track sẽ rơi vào trạng thái down
router(config-ip-sla)# timeout 200 ---> kể từ lúc gửi gói tin ping icmp-echo, sau 200 ms mà không nhận được hồi đáp icmp-reply thì được tính là một lần ping thất bại
router(config-ip-sla)# frequency 1 ---> ping định kỳ 1 giây một lần tới địa chỉ 8.8.8.8
router(config-ip-sla)# exit
router(config)# ip sla schedule 20 life forever start-time now
router(config)# track 1 ip sla 20 reachability ---> Số 1 là số thứ tự, số 20 là số ip sla đã khai báo bên trên
router(config-track)# delay down 0 up 0 ---> Downtime 0s, sau 0s sẽ quay về lại Dialer1 để định tuyến, khi phát hiện Dialer 1 ở trạng thái up
router(config-track)# exit
Track định tuyến dialer theo IP SLA đã thiết lập
router(config)# ip route 0.0.0.0 0.0.0.0 dialer 1 track 1
router(config)# ip route 0.0.0.0 0.0.0.0 dialer 2 2 ---> So 2: là số thứ tự
Lưu ý
1. Router Cisco cần có license DATA, hoặc SEC để có thể sử dụng được IP SLA. Riêng đối với các dòng ISR 4K thì cần license App hoặc SEC. Các dòng router đời cũ thì cần tối thiểu advservices IOS.
2. Có thể thay IP 8.8.8.8 bằng các IP khác. VD: 1.1.1.1 , 208.67.222.222 , ...
***** Tiếp theo ở post số 19 và 20 *****
Riêng firewall thì phải cụ thể từng tình huống, do liên quan license này nọ.
Thím nào có thắc mắc, hoặc cần hỏi gì thì mình sẽ trả lời trong này.
Last edited: