Создание аксес листа:
Router(config)# access-list {access-list-number} {permit | deny}
{test-conditions}
Ex: Router(config)# access-list 1 permit 0.0.0.0 255.255.255.255
{access-list-number - может принимать значения от 1 до 99}
Test-conditions: {ip-addres} {wildcard-mask}
ip-addres - соответственно адрес
Wildcard Mask Bits - простая таблица по 1 октету
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 0 - проверка всех битов
0 0 1 1 1 1 1 1 - не проверяет последние 6 бит
0 0 0 0 1 1 1 1 - не проверяет последние 4 бит
1 1 1 1 1 1 0 0 - проверка последних 2 бит
1 1 1 1 1 1 1 1 - игнорирование всего октета
Существуют замены:
0.0.0.0 - any
255.255.255.255 - host
т.е.:
вместо - Router(config)# access-list 1 permit 172.30.16.29 0.0.0.0
пишем - Router(config)# access-list 1 permit host 172.30.16.29
или
Вместо - Router(config)# access-list 1 permit 0.0.0.0 255.255.255.255
пишем - Router(config)# access-list 1 permit any any
ЗЫ. впринципе такие замены подойдут также и для IP
Привязка его к порту
Router(config-if)# {protocol} access-group {access-list-number} {in | out}
{protocol : - какие могут быть
IP - 1-99
E IP - 100-199
AppleTalk - 600-699
IPX - 800-899
E IPX - 900-999
IPX SAP - 1000-1099 }
{in | out - входящий и исходящий трафик соответственно
если ничего не поставить, то на то и другое}
Пример:
You use the show access-lists EXEC command to display the contents of all ACLs.
In addition, you use the show access-lists EXEC command followed by the name or
number of an ACL to display the contents of one ACL. The following example of a
standard ACL allows access for hosts on the three specified networks:
access-list 1 permit 192.5.34.0 0.0.0.255
access-list 1 permit 128.88.0.0 0.0.255.255
access-list 1 permit 36.0.0.0 0.255.255.255
!(Note:all other access implicitly denied) - по умолчанию все запрещено!
In the example, the wildcard bits apply to the host portions of the network
addresses. Any host with a source address that does not match the ACL statements
will be rejected. To specify a large number of individual addresses more easily,
you can omit the wildcard if it is all zeros. Thus, the following two
configuration commands have the same effect:
access-list 2 permit 36.48.0.3
access-list 2 permit 36.48.0.3 0.0.0.0
The ip access-group command groups an existing ACL to an interface. Remember that
only one ACL per port per protocol per direction is allowed. The format of the
command is:
Router(config-if)#ip access-group access-list-number {in | out}
Если нужно заденайдить кого, то:
access-list 1 deny host 172.16.4.13 0.0.0.0 - блокирует хоста
access-list 1 permit 0.0.0.0 255.255.255.255 - но разрешает всем остальным
interface ethernet 0
ip access-group 1 out - атачим лист к интерфейсу.
Есть еще и расширенные аксес листы:
Они круче :)
Router(config)# access-list {access-list-number} {permit | deny}
{protocol} {source} {source-mask} {destination} {destination-mask}
{operator} {operand} {established}
{access-list-number - может принимать значения от 100 до 199}
{permit | deny} - тоже самое
{protocol} - IP , TCP , UDP , ICMP , GRE , IGRP
{source} - IP адрес отправителя
{source-mask} - Wildcard Mask отправителя
{destination} - IP адрес получателя
{destination-mask} - Wildcard Mask получателя
{operator} - lt, gt, eq, neq (меньше, больше, равно, не равно - соотв.)
{operand} - номер порта (типа 80 = http, не буду все перечислять,
в нете есть полный список)
{established} - необязательно, типа проверяет устойчивый ли коннект...
Пример:
The example in Figure denies Telnet traffic (eq 23) from 172.16.4.0 being sent
out interface E0. All traffic from any other source to any destination is
permitted, as indicated by the keyword any. Interface E0 is configured with the
access-group 101 out command; that is, ACL 101 is linked to outgoing interface E0.
Denying Only Telnet out of E0, and Permitting All Other Traffic
access-list 101 deny tcp 172.16.4.0 0.0.0.255 any eq 23
access-list 101 permit ip any any
interface ethernet 0
ip access-group 101 out
Еще их можно обзывать и собирать в группы, но это уже совсем Extended!