Loading...

Cấu hình cân bằng tải 2 line Internet trên Router Cisco

Bài này sẽ hướng dẫn các bạn cấu hình cân bằng tải 2 line Internet (FTTH) kết nối đến 2 nhà mạng (ISP) để cân bằng/share tải cũng như back-up dự phòng Internet. Ngoài ra còn hướng dẫn public một dịch vụ (web service) ra ngoài mạng từ 2 ISP này.

Ở đây cần chuẩn bị:

- Router Cisco có 3 interface: GigabitEthernet0/0 cho LAN, GigabitEthernet0/1 cho IPS1, GigabitEthernet0/2 cho ISP2

- Thông tin username, password của nhà mạng

- Địa chỉ IP tĩnh từ 2 nhà mạng (dùng public dịch vụ ra ngoài mạng)

   

Các bước cấu hình cụ thể như sau:

// Cấu hình LAN

CISCO(config)# interface GigabitEthernet0/0
CISCO(config-if)#description #LAN Interface#
CISCO(config-if)#ip address 192.168.0.1 255.255.255.0
CISCO(config-if)#no shutdown
CISCO(config-if)#ip nat inside
CISCO(config-if)#ip virtual-reassembly in
CISCO(config-if)#ip tcp adjust-mss 1452
 
// Cấu hình quay PPPoE 
CISCO(config)# interface GigabitEthernet0/1
CISCO(config-if)#description #Interface to ISP1#
CISCO(config-if)#no ip address
CISCO(config-if)#pppoe enable group global
CISCO(config-if)#pppoe-client dial-pool-number 1
CISCO(config-if)#no shutdown
 
CISCO(config)# interface GigabitEthernet0/2
CISCO(config-if)#description #Interface to ISP2#
CISCO(config-if)#no ip address
CISCO(config-if)#pppoe enable group global
CISCO(config-if)#pppoe-client dial-pool-number 2
CISCO(config-if)#no shutdown
 
CISCO(config)# interface dialer 1
CISCO(config-if)#description #Dialer interface to ISP 1#
CISCO(config-if)#ip mtu 1492
CISCO(config-if)# dialer pool 1
CISCO(config-if)#dialer-group 1
CISCO(config-if)# encapsulation ppp
CISCO(config-if)# ip address negotiated
CISCO(config-if)#ip nat outside
CISCO(config-if)#ppp authentication pap callin
CISCO(config-if)#ppp pap sent-username Username_ISP1 password 0 Password_ISP1
 
CISCO(config)# interface dialer 2
CISCO(config-if)#description #Dialer interface to ISP 2#
CISCO(config-if)#ip mtu 1492
CISCO(config-if)# dialer pool 2
CISCO(config-if)#dialer-group 2
CISCO(config-if)# encapsulation ppp
CISCO(config-if)# ip address negotiated
CISCO(config-if)#ip nat outside
CISCO(config-if)#ppp authentication pap callin
CISCO(config-if)#ppp pap sent-username Username_ISP2 password 0 Password_ISP2
 
// Cấu hình access-list cho phép toàn bộ các máy tính trong LAN ra mạng
CISCO(config)#access-list 100 permit ip 192.168.0.0 0.0.0.255 any
 
// Cấu hình route-map & nat
CISCO(config)#route-map isp1 permit 10
CISCO(config-route-map)#match ip address 100
CISCO(config-router-map)#match interface Dialer 1
 
CISCO(config)#route-map isp2 permit 20
CISCO(config-route-map)#match ip address 100
CISCO(config-router-map)#match interface Dialer 2
 
CISCO(config)#ip nat inside source route-map isp1 interface Dialer 1 overload
CISCO(config)#ip nat inside source route-map isp2 interface Dialer 2 overload
 
// Tracking IP SLA - mục đích kiểm tra kết nối Internet đến các ISP còn hay không? Nếu còn kết nối (Up) thì đưa vào bảng route còn không (Down) thì loại ra
// Tạo Tracking-Object cho Dialer 1,2 . Ở đây thực hiện ping Google DNS, Cloudflare 8.8.8.8, 1.1.1.1 (nên chọn 2 IP khác nhau cho 2 tracking để không chết đồng thời) qua interface Dialer 1,2 mỗi 5 giây và timeout sau 500ms không nhận được response. (*)
 
// Tracking-Object Dialer 1
CISCO(config)#ip sla 100
CISCO(config-sla-monitor)#icmp-echo 8.8.8.8 source-interface Dialer1
CISCO(config-sla-monitor)#timeout 500
CISCO(config-sla-monitor)#frequency 5
 
// Lập lịch cho Tracking-Object thực thi tức thì và liên tục
CISCO(config)#ip sla schedule 100 life forever start-time now
 
// Track đối tượng Tracking-Object ở trên
CISCO(config)#track 100 ip sla 100 reachability
CISCO(config-track)#delay down 15 up 15
 
// Tracking-Object Dialer 2
CISCO(config)#ip sla 200
CISCO(config-sla-monitor)#icmp-echo 1.1.1.1 source-interface Dialer2
CISCO(config-sla-monitor)#timeout 500
CISCO(config-sla-monitor)#frequency 5
 
// Lập lịch cho Tracking-Object thực thi tức thì và liên tục
CISCO(config)#ip sla schedule 200 life forever start-time now
 
// Track đối tượng Tracking-Object ở trên
CISCO(config)#track 200 ip sla 200 reachability
CISCO(config-track)#delay down 15 up 15
 
// Add static route
CISCO(config)#ip route 0.0.0.0 0.0.0.0 Dialer 1 track 100
CISCO(config)#ip route 0.0.0.0 0.0.0.0 Dialer 2 track 200
 
// Publish dịch vụ web ra Internet qua 2 WAN IP.
CISCO(config)#route-map isp1static permit 10
CISCO(config-route-map)#match interface Dialer 1
 
CISCO(config)#route-map isp2static permit 10
CISCO(config-route-map)#match interface Dialer 2
 
CISCO(config)#ip nat inside source static tcp 192.168.0.250 80 171.237.209.14 80 route-map isp1static
CISCO(config)#ip nat inside source static tcp 192.168.0.250 80 103.28.37.243 80 route-map isp2static
 
* Có thể tham khảo thêm track theo ip routing
track 300 interface dialer 1,2 ip routing
delay down 15 up 15
 
 (Tổng hợp & cập nhật)

 

Comments

No posts found

New post


Liên hệThỏa thuận sử dụng | Chính sách bảo mật