lab 1-3 cấu hình nat động dùng route-map để kiểm soát nat

11 533 4
lab 1-3 cấu hình nat động dùng route-map để kiểm soát nat

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Lab 1-3: CẤU HÌNH NAT ĐỘNG DÙNG NHIỀU DÃY ĐỊA CHỈ VÀ DÙNG ROUTEMAP ĐỂ KIỂM SỐT Q TRÌNH NAT Mô tả Trong thực hành này, cấu hình NAT động với nhiều dãy địa IP khác (ip pool) dùng Route-map Tất người dùng LAN SanJose1 có nhu cầu truy cập tới máy chủ Web SanJose2 SanJose3 Qua NAT, tất host mạng 192.168.1.0 chuyển thành: - 172.106.2.0 truy cập WebServer2 (172.106.1.2) - 172.160.2.0 truy cập Web Server3 (172.160.1.2) Thực Cấu hình địa IP router dựa theo sơ đồ Đồng thời, để giả lập máy chủ Web, ta cấu hình router SanJose2 SanJose3 thành WebServer sau: SanJose2(config)#ip http server SanJose3(config)#ip http server Ta cấu hình định tuyến tĩnh SanJose1 để mạng thông suốt Default route cấu hình SanJose2 SanJose3: SanJose1(config)#ip route 172.106.1.0 255.255.255.0 10.0.0.3 SanJose1(config)#ip route 172.160.1.0 255.255.255.0 10.0.0.2 SanJose2(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.1 SanJose3(config)#ip route 0.0.0.0 0.0.0.0 10.0.0.1 Dùng lệnh ping mở rộng (extended ping) từ SanJose2 (172.160.1.2) đến SanJose3 (172.106.1.2) Phép thử ping thành công Tạo dãy địa để host mạng 192.168.1.0 (địa riêng) ánh xạ vào dãy địa Đồng thời tạo ACL cho phép host mạng 192.168.1.0 truy cập vào mạng 172.106.1.0 172.160.1.0 SanJose1(config)#ip nat pool pool106 172.106.2.1 172.106.2.254 prefix-length 24 SanJose1(config)#ip nat pool pool160 172.160.2.1 172.160.2.254 prefix-length 24 SanJose1(config)#access-list 106 permit ip 192.168.1.0 0.0.0.255 172.106.1.0 0.0.0.255 SanJose1(config)#access-list 160 permit ip 192.168.1.0 0.0.0.255 172.160.1.0 0.0.0.255 Chỉ định inside outside cho NAT SanJose1: SanJose1(config)#interface e0/0 SanJose1(config)#ip nat outside SanJose1(config)#interface e1/0 SanJose1(config)#ip nat inside Cài đặt lệnh thực NAT SanJose1(config)#ip nat inside source list 106 pool pool106 SanJose1(config)#ip nat inside source list 160 pool pool160 Dùng debug ip nat router SanJose1 SanJose3 Tại Host A SanJose1 truy cập tới Web Server SanJose3 (địa 172.106.1.2) theo dõi kết debug SanJose1#debug ip nat IP NAT debugging is on SanJose1# 00:26:18: NAT*: s=192.168.1.2->172.106.2.1, d=172.106.1.2 [12415] 00:26:18: NAT*: s=172.106.1.2, d=172.106.2.1->192.168.1.2 [12415] 00:26:19: NAT*: s=192.168.1.2->172.106.2.1, d=172.106.1.2 [12416] 00:26:19: NAT*: s=172.106.1.2, d=172.106.2.1->192.168.1.2 [12416] Dùng lệnh show ip nat translations router SanJose1: SanJose1#show ip nat translations Pro Inside global Inside local Outside local Outside global - 172.106.2.1 192.168.1.2 - - Dùng debug ip nat router SanJose1 SanJose2 Tại Host A SanJose1 truy cập tới Web Server SanJose3 (địa 172.160.1.2) theo dõi kết debug SanJose1#debug ip nat IP NAT debugging is on SanJose1# 00:26:18: NAT*: s=192.168.1.2->172.106.2.1, d=172.160.1.2 [12415] 00:26:18: NAT*: s=172.160.1.2, d=172.106.2.1->192.168.1.2 [12415] 00:26:19: NAT*: s=192.168.1.2->172.106.2.1, d=172.160.1.2 [12416] 00:26:19: NAT*: s=172.160.1.2, d=172.106.2.1->192.168.1.2 [12416] Dùng lệnh show ip nat translations router SanJose1: SanJose1#show ip nat translations Pro Inside global Inside local Outside local Outside global - 172.106.2.1 192.168.1.2 - - Ta bắt buộc NAT phải xét đến ACL translation entry cách tắt chế độ fast-switching cổng e1/0 SanJose1(config)#int e1/0 SanJose1(config-if)#no ip route-cache Dùng lệnh debug ip packet để xem thêm thông tin SanJose1#debug ip packet IP packet debugging is on SanJose1# 00:29:42: IP: s=172.106.1.2 (Ethernet0/0), d=192.168.1.2(Ethernet1/0), g=192.168.1.2, len 60, forward 00:29:43: IP: s=172.106.1.2 (Ethernet0/0), d=192.168.1.2 (Ethernet1/0), g=192.168.1.2, len 60, forward 00:29:44: IP: s=172.106.1.2 (Ethernet0/0), d=192.168.1.2 (Ethernet1/0), g=192.168.1.2, len 60, forward 00:29:45: IP: s=172.106.1.2 (Ethernet0/0), d=192.168.1.2 (Ethernet1/0), g=192.168.1.2, len 60, forward Trước cấu hình route map, ta bỏ vài lệnh cấu hình trước sau : SanJose1#undebug ip nat SanJose1#clear ip nat translation * SanJose1#configure terminal SanJose1(config)#no ip nat inside source list 106 pool pool106 SanJose1(config)#no ip nat inside source list 160 pool pool160 Lúc ta pool định nghĩa trước sau : ip nat pool pool106 172.106.2.1 172.106.2.254 prefix-length 24 ip nat pool pool160 172.160.2.1 172.160.2.254 prefix-length 24 Bây giờ, ta cấu hình route map: SanJose1(config)#ip nat inside source route-map MAP-106 pool pool106 SanJose1(config)#ip nat inside source route-map MAP-160 pool pool160 Tạo route map: SanJose1(config)#route-map MAP-106 permit 10 SanJose1(config-route-map)#match ip address 106 SanJose1(config)#route-map MAP-160 permit 10 SanJose1(config-route-map)#match ip address 160 Dùng debug ip nat router SanJose1 SanJose3 Tại Host A SanJose1 truy cập tới Web Server SanJose3 (địa 172.106.1.2) theo dõi kết debug SanJose1#debug ip nat IP NAT debugging is on SanJose1# 00:42:12: NAT : s=192.168.1.2->172.106.2.2, d=172.106.1.2 [12435] 00:42:12: NAT*: s=172.106.1.2, d=172.106.2.2->192.168.1.2 [12435] 00:42:13: NAT*: s=192.168.1.2->172.106.2.2, d=172.106.1.2 [12436] 00:42:13: NAT*: s=172.106.1.2, d=172.106.2.2->192.168.1.2 [12436] 00:42:14: NAT*: s=192.168.1.2->172.106.2.2, d=172.106.1.2 [12437] Dùng debug ip nat debug ip packet router SanJose1 SanJose2 Tại Host A SanJose1 truy cập tới Web Server SanJose3 (địa 172.160.1.2) theo dõi kết debug SanJose1#debug ip nat IP NAT debugging is on SanJose1# 00:46:21: NAT*: s=192.168.1.2->172.160.2.2, d=172.160.1.2 [12455] 00:46:21: NAT*: s=172.160.1.2, d=172.160.2.2->192.168.1.2 [12455] 00:46:22: NAT*: s=192.168.1.2->172.160.2.2, d=172.160.1.2 [12456] 00:46:22: NAT*: s=172.160.1.2, d=172.160.2.2->192.168.1.2 [12456] 00:46:23: NAT*: s=192.168.1.2->172.160.2.2, d=172.160.1.2 [12457] SanJose1#debug ip packet IP packet debugging is on SanJose1# 00:46:55: IP: s=172.160.1.2 (Ethernet0/0), d=192.168.1.2(Ethernet1/0), g=192.168.1.2, len 60, forward 00:46:56: IP: s=172.160.1.2 (Ethernet0/0), d=192.168.1.2 (Ethernet1/0), g=192.168.1.2, len 60, forward 00:46:56: IP: s=0.0.0.0 (Ethernet0/0), d=255.255.255.255, len 328, rcvd 00:46:57: IP: s=172.160.1.2 (Ethernet0/0), d=192.168.1.2 (Ethernet1/0), g=192.168.1.2, len 60, forward Dùng lệnh show ip nat translations verbose router SanJose1: SanJose1#show ip nat translations verbose Pro Inside global Inside local Outside local Outside global icmp 172.160.2.2:512 192.168.1.2:512 172.160.1.2:512 172.160.1.2:512 create 00:01:39, use 00:00:46, left 00:00:13, flags: extended, use_count: tcp 172.160.2.1:23 10.0.0.1:23 10.0.0.2:11002 10.0.0.2:11002 create 00:02:41, use 00:00:05, left 00:00:54, flags: extended, timing-out, use_count: Dynamic NAT with multiple pools using route map ó c cu hỡnh thnh cụng Ô NAT dựng route map với chế chuyển dịch tĩnh giới thiệu lần đầu với Cisco IOS 12.2(4)T 12.2(4)T2 cho Cisco 7500 series routers NAT sử dụng access list với overload tạo chuyển đổi “đầy đủ” với route map Cả chế dùng ACL Route-map sử dụng fast-swiching - ACL tạo lần chuyển dịch địa host Sau đó, host có yêu cầu ngồi (ví dụ đến webserver) NAT khơng xét đến địa đích hay ACL mà sử dụng kết có sẵn lần NAT trước - Route-map xét địa nguồn lẫn địa đích nên thực với yêu cầu đề Cấu hình SanJose1#show running-config ! hostname SanJose1 ! interface Ethernet0/0 ip address 10.0.0.1 255.255.255.0 no ip directed-broadcast ip nat outside ! interface Ethernet1/0 ip address 192.168.1.1 255.255.255.0 no ip directed-broadcast ip nat inside ! ip nat pool pool106 172.106.2.1 172.106.2.254 prefix-length 24 ip nat pool pool160 172.160.2.1 172.160.2.254 prefix-length 24 ip nat inside source route-map MAP-106 pool pool106 ip nat inside source route-map MAP-160 pool pool160 ip classless ip route 172.106.1.0 255.255.255.0 10.0.0.3 ip route 172.160.1.0 255.255.255.0 10.0.0.2 ! access-list 106 permit ip 192.168.1.0 0.0.0.255 172.106.1.0 0.0.0.255 access-list 160 permit ip 192.168.1.0 0.0.0.255 172.160.1.0 0.0.0.255 route-map MAP-106 permit 10 match ip address 106 ! route-map MAP-160 permit 10 match ip address 160 ! End SanJose2#show run ! hostname SanJose2 ! no ip domain-lookup ! interface Loopback0 ip address 172.160.1.2 255.255.255.0 ! interface FastEthernet0/0 ip address 10.0.0.2 255.255.255.0 ! ip classless ip route 0.0.0.0 0.0.0.0 10.0.0.1 ip http server ! End SanJose3#show run ! hostname SanJose3 ! interface Loopback0 ip address 172.106.1.2 255.255.255.0 ! interface Ethernet0/0 ip address 10.0.0.3 255.255.255.0 ! ip kerberos source-interface any ip classless ip route 0.0.0.0 0.0.0.0 10.0.0.1 ip http server ! line logging synchronous transport input none line aux line vty privilege level 15 no login ! end ... forward Trước cấu hình route map, ta bỏ vài lệnh cấu hình trước sau : SanJose1#undebug ip nat SanJose1#clear ip nat translation * SanJose1#configure terminal SanJose1(config)#no ip nat inside source... cấu hình route map: SanJose1(config)#ip nat inside source route-map MAP-106 pool pool106 SanJose1(config)#ip nat inside source route-map MAP-160 pool pool160 Tạo route map: SanJose1(config) #route-map. .. cho NAT SanJose1: SanJose1(config)#interface e0/0 SanJose1(config)#ip nat outside SanJose1(config)#interface e1/0 SanJose1(config)#ip nat inside Cài đặt lệnh thực NAT SanJose1(config)#ip nat

Ngày đăng: 16/11/2014, 19:46

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan