Lab GNS3 ôn tập Route – NAT

bởi | CCNP, GNS3

Home » CCNP » Lab GNS3 ôn tập Route – NAT

Sơ đồ bài lab

Lab GNS3 ôn tập Route - NAT

Cấu hình gán IP theo sơ đồ

//R1
conf t
int serial 2/0
ip address 192.1.12.1 255.255.255.252
no sh
int fa 0/0
ip address 192.168.100.254 255.255.255.0
no sh
exit
//R2
conf t
int serial 2/0
ip address 192.1.12.2 255.255.255.252
no sh
int fa 0/0
ip address 192.1.23.2 255.255.255.252
no sh
int fa 0/1
ip address 171.244.31.1 255.255.255.248
no sh
exit
//R3
conf t
int fa 0/0
ip address 192.1.23.1 255.255.255.252
no sh
int s 2/0
ip address 192.1.34.1 255.255.255.252
no sh
int lo 0
ip add 3.3.3.3 255.255.255.0
ip ospf network point-to-point
exit
//R4
enable
conf t
int s 2/0
ip address 192.1.34.2 255.255.255.252
no sh
exit
int lo 0
ip add 4.4.4.4 255.255.255.0
ip ospf network point-to-point
exit

Định tuyến RIPv2 tại R1 và R2

– Router 1
//R1
router rip
version 2
no auto
network 192.1.12.0
network 192.168.100.0
exit

– Router 2
//R2
router rip
version 2
no auto
network 171.244.0.0
network 192.1.12.0
exit

Định tuyến OSPF tại R3 và R4

– Router 3
//R3
router ospf 1
network 3.3.3.0 0.0.0.255 area 0
network 192.1.34.0 0.0.0.3 area 0
exit
– Router 4
//R4
router ospf 1
network 4.4.4.0 0.0.0.255 area 0
network 192.1.34.0 0.0.0.3 area 0
exit

Cấu hình định tuyến để liên hệ giữa ISP và Khách hàng

– R3 cấu hình static route xuống network 171.244.31.0/29

R3(config)#ip route 171.244.31.0 255.255.255.248 192.1.23.2

– R2 Cấu hình static default route hướng đến R3

R2(config)#ip route 0.0.0.0 0.0.0.0 192.1.23.1

– R3 thực hiện Redistribute Static route vào trong OSPF

R3(config)#router ospf 1
R3(config-router)#redistribute static subnets
R3(config-router)#exit

– R2 truyền Default Route RIP xuống cho R1

R2(config)#router rip
R2(config-router)#default-information originate

– Kiểm tra kết nối

R2#ping 4.4.4.4
....
R2#ping 4.4.4.4 source 171.244.31.1
!!!!

Cấu hình PAT tại R2

– Định nghĩa vùng Inside và Outside

R2(config)#int s 2/0
R2(config-if)#ip nat outside
R2(config-if)#int fa 0/0
R2(config-if)#ip nat inside

– Định nghĩa access-list cho phép các IP thuộc network 192.168.100.0/24

R2(config)#access-list 1 permit 192.168.100.0 0.0.0.255

– Định nghĩa Nat pool chỉ sử dụng 1 IP plublic là 171.244.31.1 để làm IP Public để
kết nối Internet

R2(config)#ip nat pool nat171 171.244.31.1 171.244.31.1 netmask 255.255.255.248

– Câu lệnh chuyển đổi các IP thỏa mãm access-list 1 thành IP thuộc pool nat171

R2(config)#ip nat inside source list 1 pool nat171 overload

– Kiểm tra kết nối tại R1
+ hiển thị quá trình hoạt động của NAT tại R2
R2#debug ip nat
+ Ping từ IP source: 192.1.12.1<— IP không thỏa mãn access-list 1
R1#ping 4.4.4.4
…..
+ Ping từ IP source: 192.168.100.254 <– thỏa mãn access-list 1 <— được PAT tại R2
R1#ping 4.4.4.4 source 192.168.100.254
!!!!

Cấu hình PAT tại R4 để kết nối ” Internet thật”

– Router 4 có đường link kế nối internet . Giả sử “IP plublic trên R4” là IP đang
dynamic

R4(config)#interface fa 0/0
R4(config-if)#ip address dhcp
R4(config-if)#no shutdown
R4(config-if)#exit
R4#show ip int brief
FastEthernet0/0 192.168.1.124 YES DHCP up up

R4#ping 8.8.8.8
!!!!

R4#show ip route static
S* 0.0.0.0/0 [254/0] via 192.168.1.1

– R4 có đường route kết nối internet thông qua static route , R4 và R3 nói chuyện
với nhau thông qua OSPF . Cấu hình Default route để quảng cáo cho R3 biết R4 có route ra internet

R4(config)#router ospf 1
R4(config-router)#default-information originate

+ Thấy có O*E2 , router 3 đã có route để kết nối internet

R3#show ip route ospf
O*E2 0.0.0.0/0 [110/1] via 192.1.34.2, 00:25:16, Serial2/0

– Cấu hình PAT tại R4 cho phép IP thuộc network 171.244.31.0/29, cho phép host 3.3.3.3, cho phép host 4.4.4.4 có thể kết nối “Internet thật”

R4(config)#int serial 2/0
R4(config-if)#ip nat inside
R4(config-if)#int fa 0/0
R4(config-if)#ip nat outside
R4(config)#access-list 1 permit 171.244.31.0 0.0.0.7
R4(config)#access-list 1 permit host 3.3.3.3
R4(config)#access-list 1 permit host 4.4.4.4
R4(config)#ip nat inside source list 1 interface FastEthernet0/0 overload

– Kiểm tra kết nối ra mạng ” Internet thật ”
+ capture quá trình NAT
R4# debug ip nat
+ ping từ R2
R2# ping 8.8.8.8 source 171.244.31.1
!!!!
– Ping từ R1
R1#ping 8.8.8.8 source 192.168.100.254
!!!!