1 / 86

ACL

ACL. Quản trị mạng cơ bản. Nguyên lý cơ bản ACL. Quản trị mạng cơ bản. Tổng quan. Quản trị viên cần ngăn chặn những truy cập không mong muốn trong khi vẫn duy trì được các luồng lưu lượng cần thiết

ranger
Télécharger la présentation

ACL

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ACL Quảntrịmạngcơbản

  2. Nguyênlýcơbản ACL Quảntrịmạngcơbản

  3. Tổngquan • Quảntrịviêncầnngănchặnnhữngtruycậpkhôngmongmuốntrongkhivẫnduytrìđượccácluồnglưulượngcầnthiết • Nhữngchươngtrìnhbảomậtnhư password, thiếtbị callback…vẫncónhữngthiếuhụttrongviệcquảnlýmềmdẻo, lọclưulượng • Vídụnhưquảntrịviênchophép user truycập internet, nhưngkhôngchocác user bênngoài telnet vàohệthốngmạngbêntrong • Router cungcấpthiếtbịlọclưulượngvớikhảnăngmởrộng, mềmdẻocao, đólàaccess control lists (ACLs). • ACL làmộtdanhsáchđiềukhiểntruycậpchophépquảntrịviêncóthểthiếtlậpcácquytắctruycậpmạng • Bàihọcnàysẽgiớithiệuvớicácanhchịvềkháiniêm ACL, cácloại ACL như standard và extended.

  4. Tổngquan • Ngoàira, bàinàycònđưara: • Cácphươngpháp, lờikhuyênvàhướngdẫn chi tiếtchoviệcsửdụng ACL • Cấuhìnhcầnthiếtđểtạo ACL • Vídụvề standard và extended ACL • Ápdụng ACL nhưthếnàotrên router?

  5. What are ACLs? • Note: bắtđầubàinàysẽcónhiềukháiniệm, cáckháiniệmnàysẽđượcmôtảrõhơntrongphầnsaucủabài (cấuhình). • ACL làmộttậphợptuầntựcáccâulệnh hay bộlọc • Mỗibộlọccó 2 hànhđộngchínhsau: • Deny (từchối) • Permit (chophép) • Việcchấpnhận hay từchốisẽdựavàotìnhhuốngcụthể. • ACL sẽđượcápdụngtrên interface hoặc line của router

  6. What are ACLs? • Router kiểmtramỗigói tin, xácđịnhxemcầnphảichuyển hay hủygói tin đódựatrênđiềukiệncủa ACL • Điềukiệncóthểxâydựngtrên: • IP nguồn • IP đích • UDP or TCP protocols • upper-layer (TCP/UDP) port

  7. What are ACLs? • ACLs cầnđượcxácđịnh: • per-protocol (IP, IPX, AppleTalk) • per direction (in or out) • per port (interface) basis. • ACL điềukhiểnlưulượngtheo 1 hướngtrên router • Các ACL khácnhaucầnphảitạochocáchướngkhácnhau: 1 cho in, 1 cho out • Mỗi interface cóthểsửdụngnhiềugiaothứcvàhướngkhácnhau

  8. ACL làmviệcthếnào • ACL làmộttậphợpcácbộlọc (statement), mỗibộlọcsẽxácđịnhgói tin đượcchấpnhận hay bịtừchối • Mỗibộlọc ACL sẽcó 1 sốthứtự • Khimộtbộlọckhớpvớigói tin, gói tin dósẽkiểmtraxemlàchophép hay từchối. Khiđãkhớpvớimộtbộlọc, router sẽkhông so khớpgói tin vớicácbộlọctiếptheo • Mỗi ACL sẽcómộtbộlọcẩn ở cuối ACL, bộlọcnàysẽtừchốitoànbộcácgói tin. Điềunàyđồngnghĩavớiviệc, nếugói tin khôngkhớpvớibộlọcnàocủa ACL, nósẽbịxóa

  9. ACL làmviệcnhưthếnào? • ACL statement (bộlọc) hoạtđộngtheothứtự logic. • Theo hướng top down • Nếumộtgói tin khớivớiđiềukiện, gói tin sẽđượcchophépđi qua hoặctừchối • Chỉcóthểsửdụng 1 ACL cho 1 giaothứctrênmột interface theomộthướngnhấtđịnh • Cómộtbộlọcẩn deny any ở cuốicác ACL • ACP không block cácgói tin xuấtpháttừchính router đó

  10. Hailoại ACL • Standard IP ACLs • Chỉlọcđượctheođịachỉ IP nguồn • Extended IP ACLs • Cóthểlọctheo: • IP nguồn • IP đích • Giaothức (TCP, UDP, ICMP…) • Port

  11. Tạo Standard ACL – 2 bước

  12. Tạo Standard ACL – 2 bước (Standard IP)

  13. Vídụ • Yêucầu: • Chỉ Cho phép host 172.16.30.2 rangoàimạng Sales • Các host cònlạikhôngđượcrakhỏimạng Sales

  14. Vídụ RouterB(config)#access-list 10 permit 172.16.30.2 Implicit “deny any” -do not need to add this, discussed later RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255 Bước 1: bộlọcẩn “deny any” đượctạora ở cuối ACL Test Condition (Standard IP)

  15. Vídụ Applying ACLs • Bạncóthểtạo ACL màkhôngsửdụngnó. • ACL chỉcóhiệulựckhinóđượcgắnlên interface màthôi. • Mộttrongnhữngkinhnghiệm hay làđốivới standard ACL, bạnnêngắnnócànggầnđíchcàngtốt (later) Xácđịnh: In, Out, Source, and Destination • Out– khớpvớinhữnglưulượngđã qua quátrìnhđịnhtuyến • In– lưulượngmớiđến router, chưa qua quátrìnhđịnhtuyến.

  16. Vídụ RouterB(config)#access-list 10 permit 172.16.30.2 Implicit “deny any” -do not need to add this, discussed later RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255 RouterB(config)# interface e 0 RouterB(config-if)# ip access-group 10 in Step 2 – Apply to an interface(s)

  17. Vídụ RouterB(config)#access-list 10 permit 172.16.30.2 Implicit “deny any” -do not need to add this, discussed later RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255 RouterB(config)# interface s 0 RouterB(config-if)# ip access-group 10 out RouterB(config)# interface s 1 RouterB(config-if)# ip access-group 10 out Step 2 – Or the outgoing interfaces… Which is preferable and why?

  18. Vídụ RouterB(config)#access-list 10 permit 172.16.30.2 Implicit “deny any” -do not need to add this, discussed later RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255 RouterB(config)# interface s 0 RouterB(config-if)# ip access-group 10 out RouterB(config)# interface s 1 RouterB(config-if)# ip access-group 10 out Vìcómộtbộlọcẩn “deny any” cũngsẽảnhHưởngluồngdữliệutừAdmininistrationtới Engineering

  19. Vídụ RouterB(config)#access-list 10 permit 172.16.30.2 Implicit “deny any” -do not need to add this, discussed later RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255 RouterB(config)# interface e 0 RouterB(config-if)# ip access-group 10 in

  20. Vídụ 2 • Yêucầu: • Chỉchophépcác host 172.16.30.2, 172.16.30.3, 172.16.30.4, 172.16.30.5 đirakhỏiđượcmạng Sales • Từchốitoànbộcác host khácrakhỏimạng Sales

  21. Vídụ 2 RouterB(config)#access-list 10 permit 172.16.30.2 RouterB(config)#access-list 10 permit 172.16.30.3 RouterB(config)#access-list 10 permit 172.16.30.4 RouterB(config)#access-list 10 permit 172.16.30.5 Implicit “deny any” -do not need to add this, discussed later RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255 RouterB(config)# interface e 0 RouterB(config-if)# ip access-group 10 in Vì ACL đãcósẵnbộlọcẩn “deny any”, vìvậynócóthểđápứngđượcyêucầuđềbài

  22. Vídụ 2 RouterB(config)#noaccess-list 10 RouterB(config)# interface e 0 RouterB(config-if)# noip access-group 10 in Đểxóa ACL, thựchiệnnhưsau:

  23. Vídụ 3 • Yêucầu: • Chỉtừchối host 172.16.30.2 đitừ Sales rangoài, • Cho phéptoànbộcác host cònlại • Từkhóa “any” ámchỉtoànbộcácđịachỉ IP

  24. Vídụ 3 RouterB(config)#access-list 10 deny 172.16.30.2 RouterB(config)#access-list 10 permit any Implicit “deny any” -do not need to add this, discussed later RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255 RouterB(config)# interface e 0 RouterB(config-if)# ip access-group 10 in Chú ý: vìmặcđịnhcó statement ẩn “deny any” ở cuốimỗi ACL, nênbạnphảithêm statement “ Access-list 10 permit any” đểđảmbảoyêucầuđềbài

  25. Chú ý với IN access-list • Khi access list ápdụngtheochiều IN trên interface, cácgói tin sẽđược check trướckhithamgiaquátrìnhđịnhtuyến • OUT ACL sẽhoạtđộng, check saukhigói tin đượcđịnhtuyếnbởi router • Khigói tin bịtừchốibới ACL, router sẽgửibản tin ICMP “Destination unreachable”, vớigiátrị code là “Administratively Prohibited” tớinguồngói tin RouterB(config)#access-list 10 deny 172.16.30.2 RouterB(config)#access-list 10 permit any Implicit “deny any” (do not need to add this, discussed later): RouterB(config)#access-list 10 deny 0.0.0.0 255.255.255.255 RouterB(config)# interface e 0 RouterB(config-if)# ip access-group 10 in

  26. Chú ý từ www.cisco.com • Lưulượngđến router sẽđược so khớplầnlượtvớitừngbộlọctheothứtựbộlọcđótrong ACL • Cácbộlọctạorasausẽ add vàocuối ACL • Router sẽtìmchođếnkhinàokhớpthìthôi • Cólọcẩn “deny any”, vìvậynếukhôngkhớp, gói tin sẽbịtừchối • ACL mộtbộlọcvớihànhđộnglà “deny” đượchiểulàtừchốitoànbộmọigói tin • Bạncầnphảicóítnhấtmộtbộlọcvớihànhđộng “permit” trongmột ACL, nếukhôngtoànbộlưulượngsẽbịlọc access-list 10 permit 10.1.1.1 0.0.0.255 access-list 10 deny ip any (implicit)

  27. Wildcard Masks! Wildcard mask: • Đểchỉracácđịachỉ IP nàokhớpvớibộlọccủa ACL

  28. Thờigiancho Wildcard Masks! • wildcard mask: 32 bit chia thành 4 octet • Sửdụngkèmvớiđịachỉ IP • Sốlượng bit 0 và 1 chỉra, cácbítnàocần so khớp, cácbítnàokhôngcần. • Wildcard mask khôngcóchứcnăngnàoliênquantớiSubnetmask • Các bit 0, 1 trong wildcard mask cóthểsắpxếpđanxenvàonhau • Wildcard mask đượcxâydựngvớimụcđíchlọcmộtđịachỉ hay mộtnhómđịachỉcụthểdựavàoviệc so khớpvớiĐịachỉ IP cósẵn (bit 0 thìcần so khớp, bit 1 thìkhông )

  29. Wildcard Masks! • Mộttrongnhữngcáchthứcđơngiảnđầutiêngiúpbạncóthểlấyđược wildcard mask làngượclạicủa subnet mask (lấy 255.255.255.255 trừđi subnet mask).

  30. Wildcard Masks! Test Condition Test Conditon • Wildcard mask đượcsửdụngđểđưaracácgiátrịphùhợp • 0 - “Kiểmtravớibíttươngứng.” • 1 - “khôngcần check vớibíttươngứng.” 10101100.00010000.00000000.00000000 00000000.00000000.11111111.11111111 ------------------------------------ 10101100.00010000.any value.any value The packet Cácgói tin phùhợp (khớp) sẽnhưsau: A Match…

  31. Wildcard Masks! Test Condition Test Conditon • 0 - “Kiểmtravớibíttươngứng.” • 1 - “khôngcần check vớibíttươngứng.” 10101100.00010000.00000000.00000000 00000000.00000000.11111111.11111111 ------------------------------------ 10101100.00010000.any value.any value Must Match No Match Necessary The packet A Match… Resulting in the bits that must match or doesn’t matter. Các gói tin phù hợp với sẽ như sau:

  32. Vídụ 4 – SửdụngWildcard Masks • Yêucầu: • RouterAchophépmạng Sales vàchỉ host 172.16.50.2 • RouterAtừchốimọi traffic vàomạng Administrative

  33. Vídụ 4 – Sửdụng Wildcard Masks 172.16.30.0 0.0.0.255 • 0 check – đảmbảo octet 1 là 172 • 0 check – đảmbảo octet 2 là 16 • 0 check – đảmbảo octet 3 là 30 • 255 - don’t check RouterA(config)#access-list 11 permit 172.16.30.0 0.0.0.255 RouterA(config)#access-list 11 permit 172.16.50.2 0.0.0.0 172.16.50.2 0.0.0.0 • 0 check – đảmbảo octet 1 là172 • 0 check - đảmbảo octet 2h là16 • 0 check - đảmbảo octet 3 là50 • 0 check - đảmbảo octet 4 là2

  34. Vídụ 4 – Sửdụng Wildcard Masks 172.16.30.0 10101100 . 00010000 . 00011110 . 00000000 0.0.0.255 00000000 . 00000000 . 00000000 . 11111111 ----------------------------------------- 172.16.30.0 10101100 . 00010000 . 00011110 . 00000000 172.16.30.1 10101100 . 00010000 . 00011110 . 00000001 ... (through) 172.16.30.255 10101100 . 00010000 . 00011110 . 11111111 RouterA(config)#access-list 11 permit 172.16.30.0 0.0.0.255 0 = check, we want this to match, 1 = don’t check (don’t care) Test Conditon The packet(s)

  35. Vídụ 4 – Sửdụng Wildcard Masks 172.16.50.2 10101100 . 00010000 . 00110010 . 00000010 0.0.0.0 00000000 . 00000000 . 00000000 . 00000000 ----------------------------------------- 172.16.50.2 10101100 . 00010000 . 00110010 . 00000010 RouterA(config)#access-list 11 permit 172.16.50.2 0.0.0.0 0 = check, we want this to match, 1 = don’t check (don’t care) Test Conditon The packet(s)

  36. Vídụ 4 – Sửdụng Wildcard Masks Đừngquêngán ACL lên interface RouterA(config)#access-list 11 permit 172.16.30.0 0.0.0.255 RouterA(config)#access-list 11 permit 172.16.50.2 0.0.0.0 RouterA(config)# interface e 0 RouterA(config-if)#ip access-group 11 out

  37. Vídụ 4 – Sửdụng Wildcard Masks Nênnhớcó statement ẩn “deny any”, tuynhiênđốivới beginner, thì statement cuối “deny 0.0.0.0 255.255.255.255” đểthựchành RouterA(config)#access-list 11 permit 172.16.30.0 0.0.0.255 RouterA(config)#access-list 11 permit 172.16.50.2 0.0.0.0 RouterA(config)#access-list 11 deny 0.0.0.0 255.255.255.255 RouterA(config)# interface e 0 RouterA(config-if)#ip access-group 11 out

  38. Vídụ 4 – Sửdụng Wildcard Masks 0.0.0.0 00000000 . 00000000 . 00000000 . 00000000 255.255.255.255 11111111 . 11111111 . 11111111 . 11111111 ----------------------------------------- 0.0.0.0 00000000 . 00000000 . 00000000 . 00000000 0.0.0.1 00000000 . 00000000 . 00000000 . 00000001 ... (through) 255.255.255.255 11111111 . 11111111 . 11111111 . 11111111 RouterA(config)#access-list 11 deny 0.0.0.0 255.255.255.255 0 = check, we want this to match, 1 = don’t check (don’t care) Test Conditon The packet(s)

  39. Từkhóa “any” Đểđơngiản : any = 0.0.0.0 255.255.255.255 RouterA(config)#access-list 11 deny 0.0.0.0 255.255.255.255 Or RouterA(config)#access-list 11 deny any

  40. Từkhóa “any” từvídụ 3 . RouterB(config)#access-list 10 deny 172.16.30.2 RouterB(config)#access-list 10 permit any or RouterB(config)#access-list 10 permit 0.0.0.0 255.255.255.255

  41. Luyệntập RouterB(config)#access-list 10 permit __________ ___________ Permit the following networks: Network/Subnet MaskAddress/Wildcard Mask • 172.16.0.0 255.255.0.0 • 172.16.1.0 255.255.255.0 • 192.168.1.0 255.255.255.0 • 172.16.16.0 255.255.240.0 (hmmm . . .?) • 172.16.128.0 255.255.192.0 (hmmm . . .?) Permit the following hosts: Network/Subnet MaskAddress/Wildcard Mask • 172.16.10.100 • 192.168.1.100 • All hosts

  42. Luyệntập– bạncónhìnthấymốiquanhệ? RouterB(config)#access-list 10 permit __________ ___________ Permit the following networks: Network/Subnet MaskAddress/Wildcard Mask • 172.16.0.0 255.255.0.0 172.16.0.0 0.0.255.255 • 172.16.1.0 255.255.255.0 172.16.1.0 0.0.0.255 • 192.168.1.0 255.255.255.0 192.168.1.0 0.0.0.255 • 172.16.32.0 255.255.240.0 172.16.32.0 0.0.15.255 • 172.16.128.0 255.255.192.0 172.16.128 0.0.63.255 Permit the following hosts: Network/Subnet MaskAddress/Wildcard Mask • 172.16.10.100 172.16.10.100 0.0.0.0 • 192.168.1.100 192.168.1.100 0.0.0.0 • All hosts 0.0.0.0 255.255.255.255

  43. Giảithíchcâutrảlời • 172.16.0.0 0.0.255.255 RouterB(config)#access-list 10 permit 172.16.0.0 0.0.255.255 0 = check, we want this to match 1 = don’t check, this can be any value, does not need to match 172.16.0.0 10101100 . 00010000 . 00000000 . 00000000 0.0.255.255 00000000 . 00000000 . 11111111 . 11111111 ----------------------------------------- 172.16.0.0 10101100 . 00010000 . 00000000 . 00000000 172.16.0.1 10101100 . 00010000 . 00000000 . 00000001 172.16.0.2 10101100 . 00010000 . 00000000 . 00000010 ... (through) 172.16.255.255 10101100 . 00010000 . 11111111 . 11111111 Test Conditon The packet(s)

  44. Giảithíchcâutrảlời D. 172.16.32.0 255.255.240.0 RouterB(config)#access-list 10 permit 172.16.32.0 0.0.15.255 0 = check, we want this to match 1 = don’t check, this can be any value, does not need to match 172.16.16.0 10101100 . 00010000 . 00100000 . 00000000 0.0.15.255 00000000 . 00000000 . 00001111 . 11111111 ----------------------------------------- 172.16.16.0 10101100 . 00010000 . 00100000 . 00000000 172.16.16.1 10101100 . 00010000 . 00100000 . 00000001 172.16.16.2 10101100 . 00010000 . 00100000 . 00000010 ... (through) 172.16.16.255 10101100 . 00010000 . 00101111 . 11111111 Test Conditon The packet(s)

  45. Đâychínhlàmốiquanhệ D. 172.16.32.0 255.255.240.0 RouterB(config)#access-list 10 permit 172.16.32.0 0.0.15.255 Subnet Mask: 255 . 255 . 240 . 0 Wildcard Mask: + 0 . 0 . 15 . 255 ---------------------- 255 . 255 . 255 . 255 So, we could calculate the Wildcard Mask by: 255 . 255 . 255 . 255 Subnet Mask: - 255 . 255 . 240 . 0 --------------------- Wildcard Mask: 0 . 0 . 15 . 255

  46. 255.255.255.255 – Subnet = Wildcard RouterB(config)#access-list 10 permit __________ ___________ Permit the following networks: 255.255.255.255. - Subnet Mask = Wildcard Mask • 255.255.255.255 - 255.255.0.0 = 0.0.255.255 • 255.255.255.255 - 255.255.255.0 = 0.0.0.255 • 255.255.255.255 - 255.255.255.0 = 0.0.0.255 • 255.255.255.255 - 255.255.240.0 = 0.0.15.255 • 255.255.255.255 - 255.255.192.0 = 0.0.63.255 Permit the following hosts: (host routes have a /32 mask) 255.255.255.255. - /32 Mask = Wildcard Mask • 255.255.255.255 – 255.255.255.255 = 0.0.0.0 • 255.255.255.255 – 255.255.255.255 = 0.0.0.0

  47. 255.255.255.255 – Subnet = Wildcard RouterB(config)#access-list 10 permit __________ ___________ Permit the following networks: Network/Subnet MaskAddress/Wildcard Mask • 172.16.0.0 255.255.0.0 172.16.0.0 0.0.255.255 • 172.16.1.0 255.255.255.0 172.16.1.0 0.0.0.255 • 192.168.1.0 255.255.255.0 192.168.1.0 0.0.0.255 • 172.16.32.0 255.255.240.0 172.16.32.0 0.0.15.255 • 172.16.128.0 255.255.192.0 172.16.128 0.0.63.255 Permit the following hosts: Network/Subnet MaskAddress/Wildcard Mask • 172.16.10.100 172.16.10.100 0.0.0.0 • 192.168.1.100 192.168.1.100 0.0.0.0 • All hosts or “any” 0.0.0.0 255.255.255.255

  48. Lựachọn“host” RouterB(config)#access-list 10 permit 192.168.1.100 0.0.0.0 RouterB(config)#access-list 10 permit host 192.168.1.100 Permit the following hosts: Network/Subnet MaskAddress/Wildcard Mask • 172.16.10.100 172.16.10.100 0.0.0.0 • 192.168.1.100 192.168.1.100 0.0.0.0 • “host” đượcsửdụngthaycho wildcard 0.0.0.0 -> Điềunàycónghĩacầnphải so khớptoànbộcác bit ở trongđịachỉ ACL • Tùychọn host nàychỉkhớpvới 1 địachỉ IP 172.16.10.100 0.0.0.0 replaced by host 172.16.10.100 192.168.1.100 0.0.0.0 replaced by host 192.168.1.100

  49. Khoảngđịachỉvới Wildcard Masks - Extra • Wildcard masks cóthểsửdụngđểchỉradảiđạichỉcầnlọc. • Vídụ: • Quảntrịviênmuốnlọccácđịachỉtừ172.30.16.0/24 tới 172.30.31.0/24. • access-list 20 permit 172.30.16.0 0.0.15.255

  50. Khoảngđịachỉvới Wildcard Masks - Extra Match subnets 172.30.16.0 to 172.30.31.0 access-list 20 permit 172.30.16.0 0.0.15.255 172.30.16.0 10101100 . 00011110 . 00010000 . 00000000 0.0.15.255 00000000 . 00000000 . 00001111 . 11111111 ----------------------------------------- 172.30.16.0 10101100 . 00011110 . 00010000 . 00000000 172.30.16.1 10101100 . 00011110 . 00010000 . 00000001 through . . . 172.30.31.254 10101100 . 00011110 . 00011111 . 11111110 172.30.31.255 10101100 . 00011110 . 00011111 . 11111115

More Related