Chapterبەش 5 · Lectureوانە 5.4
Access Control Lists: Filtering TrafficACLـەکان: فلتەرکردنی هاتوچۆ
What an ACL is and how a router reads it (top down, first match, the invisible deny any); wildcard masks with host and any; standard and extended ACLs and their numbers; applying ACLs inbound or outbound; where to place them; a standard and an extended lab on a school router with show access-lists counters; named ACLs and editing with sequence numbers; protecting VTY lines with access-class; ACLs that select traffic for NAT; ACLs versus stateful firewalls; common mistakes and exercises.
چییە و چۆن دەیخوێنێتەوە (لە سەرەوە بۆ خوارەوە، یەکەم گونجان، deny anyـی نەبینراو)؛ لەگەڵ host و any؛ و و ژمارەکانیان؛ جێبەجێکردنی ACL بە in یان out؛ لە کوێ دابنرێن؛ تاقیکردنەوەیەکی ستاندارد و یەکێکی درێژکراوە لەسەر قوتابخانەیەک لەگەڵ ژمێرەرەکانی show access-lists؛ ACLـی ناودار و دەستکاری بە ؛ پاراستنی بە access-class؛ ACL کە هاتوچۆ بۆ NAT هەڵدەبژێرێت؛ ACL بەرانبەر دۆخدار؛ هەڵە باوەکان و ڕاهێنانەکان.
What you will learnچی فێر دەبیت
- Explain how a router processes an ACL: top-down order, first match and the implicit deny.
- Write standard and extended ACL lines with wildcard masks, host, any, protocols and ports.
- Apply ACLs to interfaces in the right direction and place standard and extended ACLs sensibly.
- Verify ACLs with show access-lists and show ip interface, and edit named and numbered ACLs with sequence numbers.
- Protect VTY lines with access-class and tell filtering ACLs from selecting ACLs and from stateful firewalls.
- ڕوون بکەیتەوە چۆن جێبەجێ دەکات: ڕیزبەندیی سەرەوە بۆ خوارەوە، یەکەم گونجان و deny anyـی نەبینراو.
- دێڕی و بنووسیت بە ، host، any، و .
- بە ئاڕاستەی دروست لەسەر جێبەجێ بکەیت و و بە ژیرانە دابنێیت.
- بە show access-lists و show ip interface بپشکنیت و ACLـی ناودار و ژمارەکراو بە دەستکاری بکەیت.
- بە access-class بپارێزیت و ACLـی فلتەرکەر لە ACLـی هەڵبژێرەر و لە دۆخدار جیا بکەیتەوە.
A router forwards everything — unless you tell it not toڕێدۆز هەموو شتێک دەنێرێت — مەگەر پێی بڵێیت نا
A router’s job is to forward: if it has a route, the packet goes on. In this school, router R1 joins three LANs — staff, students and servers. The policy says students may open the web server but must never reach the exam server. R1 cannot keep that rule by itself: it has routes to every LAN, so it forwards every packet. An access control list (ACL) is how you give it rules.
کاری ناردنە: ئەگەر ڕێگەی هەبێت، بەردەوام دەبێت. لەم قوتابخانەیەدا R1 سێ بەیەکەوە دەبەستێت — کارمەندان، قوتابیان و . سیاسەتەکە دەڵێت قوتابیان دەتوانن بکەنەوە بەڵام هەرگیز نابێت بگەنە تاقیکردنەوە. R1 بە تەنیا ناتوانێت ئەو یاسایە بپارێزێت: ڕێگەی بۆ هەموو هەیە، بۆیە هەموو دەنێرێت. ئەو ڕێگایەیە کە یاسای پێ دەدەیت.
What an ACL isACL چییە
Access control list: an ordered list of permit and deny statements that a router checks against each packet one by one, from the top, until one matches; an invisible 'deny any' ends every list. ACLs filter traffic on interfaces (ip access-group … in|out) and pick traffic for NAT.
Access control list: لیستێکی ڕیزکراوی ڕستەکانی permit و denyـە کە یەک بە یەک لەگەڵ هەر بەراوردیان دەکات، لە سەرەوە بۆ خوارەوە، تا یەکێکیان دەگونجێت؛ 'deny any'ـیەکی نەبینراو کۆتایی بە هەموو لیستێک دەهێنێت (). ACLـەکان هاتوچۆ لەسەر فلتەر دەکەن (ip access-group … in|out) و هاتوچۆ بۆ هەڵدەبژێرن.
An ACL is an ordered list of permit and deny statements. Each line — an access control entry (ACE) — has a sequence number, an action and a description of the packets it matches. On an interface it works as a packet filter; elsewhere it only selects traffic, as you saw when access-list 1 picked the hosts for NAT (Dynamic NAT). The same idea is the heart of every firewall.
لیستێکی ڕیزکراوی ڕستەکانی permit و denyـە. هەر دێڕێک — تۆمارێکی (ACE) — ، بڕیارێک و وەسفی ئەو هەیە کە دەیانگرێتەوە. لەسەر وەک کار دەکات؛ لە شوێنی تر تەنیا هاتوچۆ هەڵدەبژێرێت، وەک بینیت کاتێک access-list 1 بۆ NAT هەڵبژارد (وەرگێڕانی بزۆکی ناونیشانی ڕایەڵە). هەمان بیرۆکە دڵی هەموو ئاگرەدیوارێکە.
Think of the guard at the school gate holding a printed list. For each visitor he reads from the top: “Line 1: no visitors from Ranya Street. Line 2: parents may enter.” The first line that fits decides, and he stops reading. If no line fits, he says no.
پاسەوانی دەرگای قوتابخانە بهێنە بەرچاو کە لیستێکی چاپکراوی بە دەستەوەیە. بۆ هەر سەردانکەرێک لە سەرەوە دەخوێنێتەوە: «دێڕی 1: هیچ سەردانکەرێک لە شەقامی ڕانیە نا. دێڕی 2: دایک و باوکان دەتوانن بچنە ژوورەوە.» یەکەم دێڕ کە دەگونجێت بڕیار دەدات و ئیتر ناخوێنێتەوە. ئەگەر هیچ دێڕێک نەگونجێت، دەڵێت نا.
Where the analogy stops workingسنووری ئەم نموونەیە
A real guard remembers faces and can open a bag. An ACL remembers nothing and looks only at the packet’s headers (addresses, protocol, ports), never at its contents.
پاسەوانی ڕاستەقینە ڕووخسارەکان لە بیر دەگرێت و دەتوانێت جانتایەک بکاتەوە. هیچ شتێک لە بیر ناگرێت و تەنیا سەیری سەرپەڕەکانی دەکات (ناونیشانەکان، ، )، هەرگیز ناوەڕۆکەکەی نابینێت.
Top down, first match winsلە سەرەوە بۆ خوارەوە، یەکەم گونجان دەیباتەوە
For every packet, the router compares the lines in order, from the top. As soon as one line matches, its action (permit or deny) is applied and the rest of the list is not read. So the order of the lines is part of the rule: a broad line placed early hides every specific line below it.
بۆ هەر ، دێڕەکان بە ڕیز، لە سەرەوە بەراورد دەکات. هەر کە دێڕێک گونجا، بڕیارەکەی (permit یان deny) جێبەجێ دەکرێت و ئەوانی تری لیستەکە ناخوێندرێنەوە. بۆیە ڕیزبەندیی دێڕەکان بەشێکە لە یاساکە: دێڕێکی فراوان کە زوو دابنرێت هەموو دێڕێکی تایبەتی ژێر خۆی دەشارێتەوە.


The invisible last line: deny anyدوایین دێڕی نەبینراو: deny any
Every ACL ends with a line you never typed and never see in show access-lists: deny any (in an extended ACL, deny ip any any). A packet that matches nothing is dropped. This is the deny-by-default rule of security. It has two big consequences: an ACL needs at least one permit, or it blocks everything; and if only one host should be blocked, the list must end with permit any.
هەموو بە دێڕێک کۆتایی دێت کە هەرگیز نەتنووسیوە و هەرگیز لە show access-listsـدا نایبینیت: deny any (لە ، deny ip any any). کە لەگەڵ هیچ شتێک نەگونجێت فڕێ دەدرێت. ئەمە یاسای ڕێگری وەک بنەڕەتـی ئاسایشە. دوو دەرئەنجامی گەورەی هەیە: پێویستی بە لانیکەم یەک permit هەیە، ئەگەر نا هەموو شتێک ڕادەگرێت؛ و ئەگەر تەنیا یەک دەبێت ڕابگیرێت، لیستەکە دەبێت بە permit any کۆتایی بێت.
Matching addresses with wildcard masksگونجاندنی ناونیشانەکان بە ماسکە پێچەوانەکان
ACLs describe groups of addresses with a wildcard mask, the same tool you used for OSPF network statements (Configuring OSPF). A 0 bit means “this bit must match”, a 1 bit means “ignore it”. The quick way: wildcard = 255.255.255.255 minus the subnet mask. Two shortcuts save typing: host 192.168.20.25 means 192.168.20.25 0.0.0.0 (exactly one address) and any means 0.0.0.0 255.255.255.255 (every address).
کۆمەڵە ناونیشان بە ماسکی پێچەوانە وەسف دەکەن، هەمان ئامرازی کە بۆ ڕستەکانی networkـی OSPF بەکارت هێنا (ڕێکخستنی OSPF). 0 واتە «ئەم دەبێت وەک یەک بێت»، 1 واتە «گرنگی پێ مەدە». ڕێگای خێرا: = 255.255.255.255 لابردنی . دوو کورتکراوە نووسین کەم دەکەنەوە: host 192.168.20.25 واتە 192.168.20.25 0.0.0.0 (ڕێک یەک ناونیشان) و any واتە 0.0.0.0 255.255.255.255 (هەموو ناونیشانێک).
Standard and extended ACLsACLـی ستاندارد و ACLـی درێژکراوە
IOS has two kinds of IPv4 ACL. A standard ACL checks only the source address. An extended ACL can check the protocol, the source and destination addresses and the source and destination ports. The number you choose tells IOS which kind you mean; a name works for both (later in this lesson).
IOS دوو جۆر ACLـی IPv4ـی هەیە. تەنیا ناونیشانی سەرچاوە دەپشکنێت. دەتوانێت ، ناونیشانی سەرچاوە و مەبەست و سەرچاوە و مەبەست بپشکنێت. ئەو ژمارەیەی هەڵیدەبژێریت بە IOS دەڵێت مەبەستت کام جۆرە؛ ناو بۆ هەردووکیان کار دەکات (دواتر لەم وانەیەدا).
| Kindجۆر | Numbersژمارەکان | Checksدەپشکنێت | Place itلە کوێ دایبنێیت |
|---|---|---|---|
| Standardستاندارد | 1–99, 1300–1999 | source address onlyتەنیا ناونیشانی سەرچاوە | close to the destinationنزیک مەبەست |
| Extendedدرێژکراوە | 100–199, 2000–2699 | protocol, source, destination, ports، سەرچاوە، مەبەست، | close to the sourceنزیک سەرچاوە |
Applying an ACL: interface and directionجێبەجێکردنی ACL: نێوبەستە و ئاڕاستە
An ACL does nothing until you apply it to an interface, in a direction, with ip access-group <number or name> in|out in interface mode. Inbound (in) ACLs check packets as they arrive, before the routing decision; outbound (out) ACLs check packets that have been routed and are about to leave. Each interface takes one ACL per direction per protocol: at most one IPv4 ACL in, one IPv4 ACL out (and the same again for IPv6).
هیچ شتێک ناکات تا لەسەر ، لە ئاڕاستەیەکدا، جێبەجێی دەکەیت بە ip access-group <number or name> in|out لە باری . ACLـی هاتنەژوورەوە (in) لە کاتی گەیشتنیاندا دەپشکنێت، پێش بڕیاری ؛ ACLـی دەرچوون (out) ئەو دەپشکنێت کە بۆ کراوە و خەریکە دەردەچن. هەر بۆ هەر ئاڕاستەیەک و هەر یەک ACL وەردەگرێت: زۆرترین یەک ACLـی IPv4 بۆ in، یەک بۆ out (و هەمان شت دووپاتە بۆ IPv6).
Where to put an ACLACL لە کوێ دابنرێت
The classic Cisco guideline: put extended ACLs as close to the source as possible — they can name the exact destination, so unwanted traffic is dropped before it uses any links. Put standard ACLs as close to the destination as possible — they see only the source, so near the source they would block that source from everything.
ڕێنمایی کلاسیکی Cisco: ACLـی درێژکراوە تا بتوانرێت نزیک سەرچاوە دابنێ — دەتوانێت مەبەستی ڕێک ناو ببات، بۆیە هاتوچۆی نەخوازراو پێش ئەوەی هیچ بەستەرێک بەکار بهێنێت فڕێ دەدرێت. ACLـی ستاندارد تا بتوانرێت نزیک مەبەست دابنێ — تەنیا سەرچاوە دەبینێت، بۆیە لە نزیک سەرچاوە ئەو سەرچاوەیە لە هەموو شتێک دادەبڕێت.
Lab 1: a standard ACLتاقیکردنەوەی 1: ACLـی ستاندارد
PC 192.168.20.25 has been misusing the servers, so it must be kept away from the server LAN, while every other device keeps working. A standard ACL can do it, placed near the destination: outbound on G0/0/2, the server interface. The remark line is a comment for the next administrator.
PCـی 192.168.20.25 بە خراپی بەکار دەهێنێت، بۆیە دەبێت لە دوور بخرێتەوە، لە کاتێکدا هەموو ئامێرەکانی تر بەردەوام کار دەکەن. ستاندارد دەتوانێت ئەوە بکات، لە نزیک مەبەست دابنرێت: out لەسەر G0/0/2، . دێڕی remark تێبینییەکە بۆ بەڕێوەبەری داهاتوو.
R1#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#access-list 10 remark Keep PC 192.168.20.25 away from the server LAN
R1(config)#access-list 10 deny host 192.168.20.25
R1(config)#access-list 10 permit any
R1(config)#interface g0/0/2
R1(config-if)#ip access-group 10 out
R1(config-if)#end
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 4
The specific line first.
دێڕە تایبەتەکە یەکەم.
- Lineدێڕی 5
Without this line the invisible deny any would block everyone else too.
بەبێ ئەم دێڕە deny anyـی نەبینراو هەموو کەسێکی تریش ڕادەگرێت.
- Lineدێڕی 7
Outbound on the server interface: close to the destination.
out لەسەر : نزیک مەبەست.
Checking an ACL: counters and the interfaceپشکنینی ACL: ژمێرەرەکان و نێوبەستەکە
Ping a server from PC .25 and from PC .30, then look on R1. show access-lists prints every list with its sequence numbers and a match counter per line — the fastest proof that traffic really hits the line you expect. The invisible deny any has no counter. show ip interface g0/0/2 tells you which ACL is applied in which direction. clear access-list counters sets the counters back to zero before a new test.
لە PCـی .25 و PCـی .30ـەوە بۆ بکە، پاشان لەسەر R1 سەیر بکە. show access-lists هەموو لیستێک لەگەڵ و ژمێرەرێکی گونجان بۆ هەر دێڕێک چاپ دەکات — خێراترین بەڵگە کە هاتوچۆ بەڕاستی بەو دێڕە دەگات کە چاوەڕێی دەکەیت. deny anyـی نەبینراو ژمێرەری نییە. show ip interface g0/0/2 پێت دەڵێت کام ACL بە کام ئاڕاستە جێبەجێ کراوە. clear access-list counters پێش تاقیکردنەوەیەکی نوێ ژمێرەرەکان دەگەڕێنێتەوە بۆ سفر.
R1#show access-lists
Standard IP access list 10
10 deny 192.168.20.25 (8 matches)
20 permit any (27 matches)Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 3
IOS writes a single host without the word host.
IOS تاک بەبێ وشەی host دەنووسێت.
R1#show ip interface g0/0/2
GigabitEthernet0/0/2 is up, line protocol is up
Internet address is 192.168.30.1/24
Outgoing access list is 10
Inbound access list is not setOn PC .25 the ping fails: R1 drops each echo request and, by default, answers with an ICMP destination unreachable — administratively prohibited message, so the PC reports the destination as unreachable instead of waiting for a timeout. From PC .30 the ping succeeds.
لەسەر PCـی .25 شکست دەهێنێت: R1 هەر echoـێک فڕێ دەدات و بە شێوەی بنەڕەت بە پەیامی destination unreachable — administratively prohibited وەڵام دەداتەوە، بۆیە PCـەکە ڕادەگەیەنێت کە مەبەستەکە ناگاتێ لە جیاتی چاوەڕوانیی تەواوبوونی کات. لە PCـی .30ـەوە سەرکەوتوو دەبێت.
Writing an extended ACL lineنووسینی دێڕێکی ACLـی درێژکراوە
An extended line reads like a sentence: number – action – protocol – source – destination – (port). The protocol is ip (any IP packet), tcp, udp or icmp. Each address takes a wildcard, or host / any. A port test follows the address it belongs to, with an operator: eq (equal), neq, lt, gt or range. IOS shows well-known ports by name, for example port 80 as www.
دێڕێکی درێژکراوە وەک ڕستەیەک دەخوێندرێتەوە: ژمارە – بڕیار – – سەرچاوە – مەبەست – (). ip (هەر IP)، tcp، udp یان icmpـە. هەر ناونیشانێک یان host / any وەردەگرێت. پشکنینی دوای ئەو ناونیشانە دێت کە پێیەوە پەیوەستە، لەگەڵ : eq (یەکسان)، neq، lt، gt یان range. IOS ناسراوەکان بە ناو پیشان دەدات، بۆ نموونە 80 وەک www.
Lab 2: an extended ACL near the sourceتاقیکردنەوەی 2: ACLـێکی درێژکراوە نزیک سەرچاوە
Now the real policy: students may use the web server (HTTP 80 and HTTPS 443) and may ping the servers, but nothing else may go from the student LAN to the server LAN; everything else (for example to the staff LAN) stays allowed. An extended ACL, inbound on the student interface G0/0/1:
ئێستا سیاسەتە ڕاستەقینەکە: قوتابیان دەتوانن بەکار بهێنن (HTTP 80 و HTTPS 443) و دەتوانن بۆ بکەن، بەڵام هیچ شتێکی تر نابێت لە قوتابیانەوە بڕوات بۆ ؛ هەموو شتێکی تر (بۆ نموونە بۆ کارمەندان) ڕێگەپێدراو دەمێنێتەوە. درێژکراوە، بە in لەسەر قوتابیان G0/0/1:
R1(config)#access-list 110 remark Students: web and ping to the server LAN only
R1(config)#access-list 110 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq 80
R1(config)#access-list 110 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq 443
R1(config)#access-list 110 permit icmp 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255
R1(config)#access-list 110 deny ip 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255
R1(config)#access-list 110 permit ip any any
R1(config)#interface g0/0/1
R1(config-if)#ip access-group 110 in
R1(config-if)#end
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 2-4
The allowed traffic, most specific first.
هاتوچۆی ڕێگەپێدراو، تایبەتترین یەکەم.
- Lineدێڕی 5
Everything else from students to the server LAN — including the exam server — is denied.
هەموو شتێکی تر لە قوتابیانەوە بۆ — لەگەڵ تاقیکردنەوە — ڕێگری لێ دەکرێت.
- Lineدێڕی 6
Without this line the students could reach nothing else (implicit deny).
بەبێ ئەم دێڕە قوتابیان ناگەنە هیچ شتێکی تر (deny anyـی نەبینراو).
- Lineدێڕی 8
Inbound on the students’ interface: close to the source.
in لەسەر قوتابیان: نزیک سەرچاوە.
R1#show access-lists 110
Extended IP access list 110
10 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq www (25 matches)
20 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq 443 (12 matches)
30 permit icmp 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255 (8 matches)
40 deny ip 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255 (3 matches)
50 permit ip any any (40 matches)Named ACLsACLـی ناودار
Numbers are hard to remember. A named ACL does the same job with a name you choose, and it has its own sub-mode where each line is typed without repeating access-list 110: the prompt changes to (config-std-nacl)# for standard and (config-ext-nacl)# for extended lists. Here is Lab 2 as a named list:
ژمارەکان بە ئاسانی لە بیر نامێنن. ناودار هەمان کار بە ناوێک دەکات کە خۆت هەڵیدەبژێریت و باری لاوەکیی خۆی هەیە کە هەر دێڕێک تێیدا بەبێ دووپاتەکردنەوەی access-list 110 دەنووسرێت: بۆ لیستی ستاندارد دەبێت بە (config-std-nacl)# و بۆ درێژکراوە بە (config-ext-nacl)#. ئەمە تاقیکردنەوەی 2یە وەک لیستێکی ناودار:
R1(config)#ip access-list extended STUDENTS-IN
R1(config-ext-nacl)#remark Students: web and ping to the server LAN only
R1(config-ext-nacl)#permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq 80
R1(config-ext-nacl)#permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq 443
R1(config-ext-nacl)#permit icmp 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255
R1(config-ext-nacl)#deny ip 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255
R1(config-ext-nacl)#permit ip any any
R1(config-ext-nacl)#exit
R1(config)#interface g0/0/1
R1(config-if)#no ip access-group 110 in
R1(config-if)#ip access-group STUDENTS-IN in
R1(config-if)#end
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 1
standard or extended, then the name (capitals make it easy to spot in the configuration).
standard یان extended، پاشان ناوەکە (پیتی گەورە دۆزینەوەی لە ئاسان دەکات).
- Lineدێڕی 10-11
Swap the old numbered list for the named one: still one IPv4 ACL per direction.
لیستە ژمارەکراوە کۆنەکە بە ناودارەکە بگۆڕەوە: هێشتا یەک ACLـی IPv4 بۆ هەر ئاڕاستەیەک.
The capstone project protects its servers with a named extended ACL: Step 8: an ACL in front of the servers.
پڕۆژەی کۆتایی بە ناودار دەپارێزێت: هەنگاوی 8: ACLـێک لە بەردەم ڕاژەکارەکان.
Editing an ACL with sequence numbersدەستکاریکردنی ACL بە ژمارەکانی زنجیرە
Lines get sequence numbers 10, 20, 30… and a new line without a number goes to the end. To put a line in the middle, give it a number in between; to remove one line, type no and its number. This works for named lists and also for numbered ones opened with ip access-list extended 110. (Later the exam app on EXAM, TCP 8443, must be opened during exams, and pings are no longer needed.)
دێڕەکان 10، 20، 30… وەردەگرن و دێڕێکی نوێ بەبێ ژمارە دەچێتە کۆتایی. بۆ دانانی دێڕێک لە ناوەڕاستدا، ژمارەیەکی نێوانی پێ بدە؛ بۆ لابردنی یەک دێڕ، no و ژمارەکەی بنووسە. ئەمە بۆ لیستە ناودارەکان کار دەکات و بۆ ژمارەکراوەکانیش کاتێک بە ip access-list extended 110 دەکرێنەوە. (دواتر ئەپی تاقیکردنەوە لەسەر EXAM، TCP 8443، دەبێت لە کاتی تاقیکردنەوەکاندا بکرێتەوە و ئیتر پێویست بە نییە.)
R1(config)#ip access-list extended STUDENTS-IN
R1(config-ext-nacl)#35 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.20 eq 8443
R1(config-ext-nacl)#no 30
R1(config-ext-nacl)#end
R1#show access-lists STUDENTS-IN
Extended IP access list STUDENTS-IN
10 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq www
20 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq 443
35 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.20 eq 8443
40 deny ip 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255
50 permit ip any anyProtecting the VTY lines with access-classپاراستنی هێڵەکانی VTY بە access-class
You already lock the VTY lines with SSH, a user name and a secret (Lock the VTY lines). An ACL adds a second lock: who may even try. On a line, the command is access-class, not ip access-group. Apply it to all VTY lines — a remote session can land on any of them.
پێشتر بە SSH، و نهێنییەک دادەخەیت (داخستنی هێڵەکانی VTY). قوفڵێکی دووەم زیاد دەکات: کێ تەنانەت دەتوانێت هەوڵ بدات. لەسەر هێڵێک access-classـە، نەک ip access-group. لەسەر هەموو جێبەجێی بکە — دانیشتنێکی دوور دەتوانێت لەسەر هەر کامیان بنیشێتەوە.
R1(config)#access-list 5 remark Only the admin PC may log in remotely
R1(config)#access-list 5 permit host 192.168.10.5
R1(config)#line vty 0 4
R1(config-line)#access-class 5 in
R1(config-line)#end
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]Explain the codeڕوونکردنەوەی کۆدەکە
- Lineدێڕی 2
A standard ACL: only the source address matters here. The implicit deny refuses everyone else.
ستاندارد: لێرەدا تەنیا ناونیشانی سەرچاوە گرنگە. deny anyـی نەبینراو هەموو کەسێکی تر ڕەت دەکاتەوە.
- Lineدێڕی 4
in = sessions coming into the router.
in = ئەو دانیشتنانەی دێنە ناو .
ACLs that select instead of filterACLـی کە هەڵدەبژێرێت لە جیاتی فلتەرکردن
The same list syntax is used in many places where nothing is dropped. With NAT, ip nat inside source list 1 … uses ACL 1 only to decide who is translated: a permitted source is translated, a denied (or unmatched) source is simply forwarded untranslated (Dynamic NAT). Other IOS features — route filtering, QoS, debug filters — reuse ACLs the same way. Always ask: is this list applied to an interface, or referenced by a feature?
هەمان ڕێزمانی لیست لە زۆر شوێندا بەکار دێت کە هیچ شتێک فڕێ نادرێت. لەگەڵ NAT، ip nat inside source list 1 … ACL 1 تەنیا بۆ بڕیاردان بەکار دەهێنێت کە کێ وەردەگێڕدرێت: سەرچاوەیەکی ڕێگەپێدراو وەردەگێڕدرێت، سەرچاوەیەکی ڕێگرتوو (یان نەگونجاو) تەنیا بەبێ وەرگێڕان دەنێردرێت (وەرگێڕانی بزۆکی ناونیشانی ڕایەڵە). تایبەتمەندییەکانی تری IOS — فلتەرکردنی ڕێگەکان، QoS، فلتەری debug — بە هەمان شێوە ACL بەکار دەهێننەوە. هەمیشە بپرسە: ئەم لیستە لەسەر جێبەجێ کراوە، یان تایبەتمەندییەک ئاماژەی پێ دەکات؟
ACLs and stateful firewallsACL و ئاگرەدیوارەکانی دۆخدار
A classic ACL is a stateless packet filter: it judges each packet alone and remembers nothing. That matters for replies. If an inbound ACL on the Internet-facing interface allows only what the company wants in, the replies to the staff’s own web requests are blocked too — unless a line lets them in, such as permit tcp any 192.168.10.0 0.0.0.255 established, which matches TCP segments with the ACK or RST flag set (packets that belong to a connection already under way). It is a rough tool: it works only for TCP, and a forged flag passes.
کلاسیکی بە شێوەیەکی دەکات: هەر بە تەنیا هەڵدەسەنگێنێت و هیچ شتێک لە بیر ناگرێت. ئەمە بۆ وەڵامەکان گرنگە. ئەگەر ACLـێکی in لەسەر ڕووەو تەنیا ڕێگە بەوە بدات کە کۆمپانیاکە دەیەوێت بێتە ژوورەوە، وەڵامی ئەو کارمەندان خۆیان بۆ دەینێرن ڕادەگیرێن — مەگەر دێڕێک ڕێگەیان پێ بدات، وەک permit tcp any 192.168.10.0 0.0.0.255 established، کە ئەو TCP دەگرێتەوە کە ئاڵای ACK یان RSTـیان لەسەرە (ئەو سەر بە پەیوەندییەکن کە پێشتر دەستی پێکردووە). ئامرازێکی زبرە: تەنیا بۆ TCP کار دەکات و ئاڵایەکی ساختە تێدەپەڕێت.
A stateful firewall keeps a table of the conversations started inside and lets in exactly their replies — for TCP, UDP and ICMP alike — and modern next-generation firewalls look much deeper (Kinds of firewall). ACLs remain the everyday tool on routers and switches: for simple filters between internal networks, for protecting the device itself, and for selecting traffic for other features.
دۆخدار خشتەیەک لە گفتوگۆکانی ناوەوە ڕادەگرێت و ڕێک ڕێگە بە وەڵامەکانیان دەدات — بۆ TCP، UDP و ICMP وەک یەک — و زۆر قووڵتر سەیر دەکەن (جۆرەکانی ئاگرەدیوار). ئامرازی ڕۆژانەی و دەمێننەوە: بۆ فلتەری سادە لە نێوان ناوخۆدا، بۆ پاراستنی خودی ئامێرەکە و بۆ هەڵبژاردنی هاتوچۆ بۆ تایبەتمەندییەکانی تر.
Common mistakesهەڵە باوەکان
Exercisesڕاهێنانەکان
Write a standard ACL that stops the whole student LAN from reaching the staff LAN but lets everything else through. Say where you apply it and why.
ستاندارد بنووسە کە هەموو قوتابیان لە گەیشتن بە کارمەندان ڕابگرێت بەڵام ڕێگە بە هەموو شتێکی تر بدات. بڵێ لە کوێ جێبەجێی دەکەیت و بۆچی.
Show answerوەڵامەکە پیشان بدە
R1(config)#access-list 20 deny 192.168.20.0 0.0.0.255
R1(config)#access-list 20 permit any
R1(config)#interface g0/0/0
R1(config-if)#ip access-group 20 out
R1(config-if)#end
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]A standard ACL sees only the source, so it belongs near the destination: there it affects only traffic going to the staff LAN. Inbound on G0/0/1 it would cut the students off from the servers too.
تەنیا سەرچاوە دەبینێت، بۆیە شوێنی نزیک مەبەستە: لەوێ تەنیا کار لە هاتوچۆ بۆ کارمەندان دەکات. بە in لەسەر G0/0/1 قوتابیان لە دادەبڕێت.
Only the admin PC (192.168.10.5) may reach the exam server (192.168.30.20), by any protocol; nobody else may reach it; all other traffic is allowed. Write one extended ACL for R1 and choose the interface.
تەنیا PCـی بەڕێوەبەر (192.168.10.5) دەتوانێت بگاتە تاقیکردنەوە (192.168.30.20)، بە هەر ؛ کەسی تر ناتوانێت بیگاتێ؛ هەموو هاتوچۆیەکی تر ڕێگەپێدراوە. یەک بۆ R1 بنووسە و هەڵبژێرە.
Show answerوەڵامەکە پیشان بدە
R1(config)#access-list 120 permit ip host 192.168.10.5 host 192.168.30.20
R1(config)#access-list 120 deny ip any host 192.168.30.20
R1(config)#access-list 120 permit ip any any
R1(config)#interface g0/0/2
R1(config-if)#ip access-group 120 out
R1(config-if)#end
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]The traffic comes from two LANs, so “near the source” would need two lists. With one router, a single extended list outbound on G0/0/2 is simpler and still exact, because it names the destination.
هاتوچۆکە لە دوو دێت، بۆیە «نزیک سەرچاوە» پێویستی بە دوو لیست دەبێت. بە یەک ، یەک لیستی درێژکراوە بە out لەسەر G0/0/2 سادەترە و هێشتا ورددە، چونکە مەبەستەکە ناو دەبات.
Students say the web server does not load. show access-lists STUDENTS-IN shows 10 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq www (0 matches) and 40 deny ip 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255 (52 matches), and the list has no line 20. What is happening, and how do you fix it without retyping the list?
قوتابیان دەڵێن بار نابێت. show access-lists STUDENTS-IN 10 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq www (0 matches) و 40 deny ip 192.168.20.0 0.0.0.255 192.168.30.0 0.0.0.255 (52 matches) پیشان دەدات و لیستەکە دێڕی 20ـی نییە. چی ڕوو دەدات و چۆن بەبێ دووپاتە نووسینەوەی لیستەکە چاکی دەکەیتەوە؟
Show answerوەڵامەکە پیشان بدە
The site uses HTTPS (TCP 443), not port 80: line 10 never matches and line 40 drops the requests. Insert the missing line with a sequence number:
ماڵپەڕەکە بەکار دەهێنێت (TCP 443)، نەک 80: دێڕی 10 هەرگیز ناگونجێت و دێڕی 40 فڕێ دەدات. دێڕە ونەکە بە زیاد بکە:
R1(config)#ip access-list extended STUDENTS-IN
R1(config-ext-nacl)#20 permit tcp 192.168.20.0 0.0.0.255 host 192.168.30.10 eq 443
R1(config-ext-nacl)#end
R1#copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]Write the address and wildcard that match (a) 172.16.32.0/20, (b) only the host 10.1.1.9, (c) 192.168.20.128/25.
ناونیشان و بنووسە کە ئەمانە بگرنەوە: (a) 172.16.32.0/20، (b) تەنیا 10.1.1.9، (c) 192.168.20.128/25.
Show answerوەڵامەکە پیشان بدە
- (a) /20 = 255.255.240.0 →
172.16.32.0 0.0.15.255(172.16.32.0 – 172.16.47.255). - (b)
host 10.1.1.9=10.1.1.9 0.0.0.0. - (c) /25 = 255.255.255.128 →
192.168.20.128 0.0.0.127.
- (a)
/20 = 255.255.240.0، بۆیە172.16.32.0 0.0.15.255(172.16.32.0 – 172.16.47.255). - (b)
host 10.1.1.9هەمان10.1.1.9 0.0.0.0ـە. - (c)
/25 = 255.255.255.128، بۆیە192.168.20.128 0.0.0.127.
A colleague wrote access-list 15 permit 192.168.20.0 0.0.0.255, then access-list 15 deny host 192.168.20.25, then access-list 15 permit any. What happens when the second line is typed, what does PC .25 experience, and what is the corrected order?
هاوکارێک نووسیویەتی access-list 15 permit 192.168.20.0 0.0.0.255، پاشان access-list 15 deny host 192.168.20.25، پاشان access-list 15 permit any. کاتێک دێڕی دووەم دەنووسرێت چی ڕوو دەدات، PCـی .25 چی دەبینێت و ڕیزبەندیی ڕاستکراوە چییە؟
Show answerوەڵامەکە پیشان بدە
On a real router IOS refuses the second line at once: % Access rule can't be configured at higher sequence num as it is part of the existing rule at sequence num 10. ACL 15 keeps only the two permit lines, so PC .25 is permitted. Put the host line first: deny host 192.168.20.25, then permit any (the /24 line is then not needed). With a numbered list in global mode, remove it with no access-list 15 and type it again, or edit it with ip access-list standard 15 and sequence numbers.
لەسەر ڕاستەقینە IOS دەستبەجێ دێڕی دووەم ڕەت دەکاتەوە: % Access rule can't be configured at higher sequence num as it is part of the existing rule at sequence num 10. ACL 15 تەنیا دوو دێڕە permitـەکە دەهێڵێتەوە، بۆیە ڕێگە بە PCـی .25 دەدرێت. دێڕی یەکەم دابنێ: deny host 192.168.20.25، پاشان permit any (ئیتر دێڕی /24 پێویست نییە). لە لیستێکی ژمارەکراو لە ، بە no access-list 15 لای ببە و دووپاتە بینووسەوە، یان بە ip access-list standard 15 و دەستکاری بکە.
Summaryپوختە
- An ACL is an ordered list of permit/deny lines, checked top down; the first match decides; an invisible deny any ends every list, so a list needs at least one permit.
- Standard (1–99, 1300–1999): source only, near the destination. Extended (100–199, 2000–2699): protocol, addresses and ports, near the source. Names work for both.
- Addresses use wildcard masks: 0 = match, 1 = ignore;
hostandanyare shortcuts. - Apply with
ip access-group … in|out: one IPv4 ACL per interface per direction; VTY lines useaccess-class … in. - Verify with
show access-lists(match counters) andshow ip interface; edit with sequence numbers, never withno access-list N …. - ACLs also select traffic (NAT); they are stateless — stateful firewalls track conversations.
- لیستێکی ڕیزکراوی دێڕەکانی permit/denyـە، لە سەرەوە بۆ خوارەوە دەپشکنرێت؛ یەکەم گونجان بڕیار دەدات؛ deny anyـیەکی نەبینراو کۆتایی بە هەموو لیستێک دەهێنێت، بۆیە لیست پێویستی بە لانیکەم یەک permit هەیە.
- ستاندارد (1–99، 1300–1999): تەنیا سەرچاوە، نزیک مەبەست. درێژکراوە (100–199، 2000–2699): ، ناونیشانەکان و ، نزیک سەرچاوە. ناو بۆ هەردووکیان کار دەکات.
- ناونیشانەکان بەکار دەهێنن: 0 = گونجان، 1 = گرنگ نییە؛
hostوanyکورتکراوەن. - بە
ip access-group … in|outجێبەجێی بکە: یەک ACLـی IPv4 بۆ هەر و هەر ئاڕاستەیەک؛access-class … inبەکار دەهێنن. - بە
show access-lists(ژمێرەری گونجان) وshow ip interfaceبپشکنە؛ بە دەستکاری بکە، هەرگیز بەno access-list N …. - هاتوچۆش هەڵدەبژێرن (NAT)؛ — دۆخدار بەدواداچوون بۆ گفتوگۆکان دەکەن.
When an ACL blocks more than you meant, troubleshooting starts with show access-lists and a ping — that is the next lesson, Troubleshooting with IOS.
کاتێک زیاتر لەوەی مەبەستت بوو ڕادەگرێت، بە show access-lists و دەست پێ دەکات — ئەوە وانەی داهاتووە، چارەسەرکردنی کێشە بە IOS.
Lesson complete!وانەکە تەواو بوو!
Well done. Review the key terms, then go on to the next lesson.دەستخۆش. سەیرێکی زاراوە سەرەکییەکان بکەرەوە، پاشان بڕۆ بۆ وانەی داهاتوو.
Key termsزاراوە سەرەکییەکان
Troubleshooting with IOS: show, ping, traceroute and debugچارەسەرکردنی کێشە بە IOS: show، پینگ، بەدواداچوونی ڕێگە و debug
Related lecturesوانە پەیوەندیدارەکان
- Configuring OSPF: Wildcard Masks, Networks and Passive Interfacesڕێکخستنی OSPF: ماسکە پێچەوانەکان، ڕایەڵەکان و نێوبەستە ناچالاکەکان
- Troubleshooting with IOS: show, ping, traceroute and debugچارەسەرکردنی کێشە بە IOS: show، پینگ، بەدواداچوونی ڕێگە و debug
- Network Defences: Firewalls, Segmentation, Monitoring and SIEMبەرگرییەکانی ڕایەڵە: ئاگرەدیوار، بەشبەشکردنی ڕایەڵە، چاودێریی ئاسایش و SIEM
- Port Numbers and Socketsژمارەی پۆرت و سۆکێتەکان
- TCP and UDPTCP و UDP
- Inside a TCP Connection: Handshake, Windows and Reliabilityناو پەیوەندییەکی TCP: سێ ڕێی تەوقەکردن، پەنجەرەکان و پشتپێبەستراوی
- Securing a Cisco Device: Passwords, Users and Bannersپاراستنی ئامێرێکی Cisco: تێپەڕەوشەکان، بەکارهێنەران و بانەر
- Switch Port Securityئاسایشی دەرچەی سویچ
- Project: Subnet, Route and NAT a Company Networkپڕۆژە: ژێرڕایەڵەسازی، ڕێدۆزی و NATـی ڕایەڵەی کۆمپانیایەک
References and further readingسەرچاوەکان و خوێندنەوەی زیاتر
- Cisco: Configure and Filter IP Access Lists (numbers 1–99, 1300–1999, 100–199, 2000–2699; in/out; wildcard, host and any; implicit deny; remark; show access-lists)
- Cisco IOS XE Security Configuration Guide: IP Access List Overview (one list per interface, protocol and direction; missing or empty lists permit all; router-originated traffic; order and first match; wildcard bits)
- Cisco IOS XE Security Configuration Guide: IP Access List Entry Sequence Numbering (10/20/30, inserting, deleting, resequence; numbered-list caution)
- Cisco: Configure Commonly Used IP ACLs (deny one host, permit web traffic, the established keyword)
- Cisco IOS Security Command Reference: access-class (line configuration; identical restrictions on all VTY lines)
- Cisco IOS command reference: show access-lists (match counters)
- Cisco Press: Enterprise Networking, Security, and Automation Companion Guide (CCNAv7) — ACL concepts and configuration, placement guidelines
This lecture is a first edition. The Kurdish text and terminology are waiting for review by Kurdish IT teachers.ئەم وانەیە چاپی یەکەمە. دەقە کوردییەکە و زاراوەکانی چاوەڕێی پێداچوونەوەی مامۆستایانی کوردی بواری IT ن.