DES-3526 - решил переписать все ACL на PCF. Как оно и полагается в таких случаях, начинаем с "простого" - DHCP. Соответственно сначала читаем
инструкцию, конкретно - вот это:
Код:
Пример №3
Задача:
Необходимо заблокировать Broadcast-трафик на клиентских портах (для спасения Ваших радиоканалов или еще из каких либо административных или иных побуждений).
Решение:
Решить подобную задачу можно вот таким образом:
create access_profile ethernet destination_mac ff-ff-ff-ff-ff-ff ethernet_type profile_id 1
config access_profile profile_id 1 add access_id 1 ethernet destination_mac ff-ff-ff-ff-ff-ff ethernet_type 0x806 port 1 permit
config access_profile profile_id 1 add access_id 2 ethernet destination_mac ff-ff-ff-ff-ff-ff ethernet_type 0x800 port 1 deny
Тут, как Вы можете видеть, разрешается ARP Broadcast (это необходимо сделать для функционирования данного протокола!) и запрещается IP Broadacst. Кто-то может заметить: „Я использую DHCP для раздачи адресов и когда я воспользовался этим правилом все перестало работать!“, на что можно привести вот такой пример:
create access_profile packet_content_mask offset_16-31 0x0 0x0 0x000000ff 0x0 offset_32-47 0x0 0x0000ffff 0x0 0x0 profile_id 1
config access_profile profile_id 1 add access_id 1 packet_content_mask offset_16-31 0x0 0x0 0x00000011 0x0 offset_32-47 0x0 0x00000044 0x0 0x0 port 1 permit
config access_profile profile_id 1 add access_id 2 packet_content_mask offset_16-31 0x0 0x0 0x00000011 0x0 offset_32-47 0x0 0x00000043 0x0 0x0 port 1 deny
create access_profile ethernet destination_mac ff-ff-ff-ff-ff-ff ethernet_type profile_id 2
config access_profile profile_id 2 add access_id 1 ethernet destination_mac ff-ff-ff-ff-ff-ff ethernet_type 0x806 port 1 permit
config access_profile profile_id 2 add access_id 2 ethernet destination_mac ff-ff-ff-ff-ff-ff ethernet_type 0x800 port 1 deny
Т.е. необходимо разрешить на клиентских портах прохождение пакетов DHCP запросов (src port 68 UDP) и запретить прохождение DHCP ответов (src port 67 UDP) до блокирования Broadcast-трафика. Это очень важное замечание, т.к. порядок следования правил определяет очередность их действия и соответственно надо сначала разрешить нужный Вам Broadcast- трафик, а потом уже его запрещать. Profile_id 1 данного примера аналогичен примеру из FAQ. Если же Вам хочется фильтровать не по src, а по dst порту, то вспомнив, что DHCP пакеты ходят по схеме:
src port dst port
запрос:
67 -> 68
ответ: 68 -> 67
достаточно изменить access_profile 1 следующим образом:
create access_profile packet_content_mask offset_16-31 0xffff0000 0x0 0x000000ff 0x0 offset_32-47 0x0 0x0 0xffff0000 0x0 profile_id 1
config access_profile profile_id 1 add access_id 1 packet_content_mask offset_16-31 0x08000000 0x0 0x00000011 0x0 offset_32-47 0x0 0x0 0x00430000 0x0 port 1 permit
config access_profile profile_id 1 add access_id 2 packet_content_mask offset_16-31 0x08000000 0x0 0x00000011 0x0 offset_32-47 0x0 0x0 0x00440000 0x0 port 1 deny
где так же разрешается прохождение DHCP запросов (dst port 67 UDP) и запрещается прохождение DHCP ответов (dst port 68 UDP). Сюда же Вы можете вписать блокировку ненужных Вам как TCP так и UDP dst портов.
А вот так может выглядеть profile_id 2, на основе packet_content_mask, а не Ethernet заголовков:
create access_profile packet_content_mask offset_0-15 0xffffffff 0xffff0000 0x0 0x0 offset_16-31 0xffff0000 0x0 0x0 0x0 profile_id 2
config access_profile profile_id 2 add access_id 1 packet_content_mask offset_0-15 0xffffffff 0xffff0000 0x0 0x0 offset_16-31 0x08060000 0x0 0x0 0x0 port 1 permit
config access_profile profile_id 2 add access_id 2 packet_content_mask offset_0-15 0xffffffff 0xffff0000 0x0 0x0 offset_16-31 0x08000000 0x0 0x0 0x0 port 1 deny
Пытаюсь чуток "рационализировать" (объединить два профиля в один), но не тут-то было..
При первой же задаче (запретить броадкаст, не нарушив получение клиентом IP от DHCP) конкретно споткнулся...

Итак:
Код:
create access_profile packet_content_mask offset_0-15 0xFFFFFFFF 0xFFFF0000 0x0 0x0 offset_16-31 0xFFFF0000 0x0 0x000000FF 0x0 offset_32-47 0x0 0x0000FFFF 0x0 0x0 profile_id 2
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0x0 0x0 0x0 0x0 offset_16-31 0x86DD0000 0x0 0x0 0x0 offset_32-47 0x0 0x0 0x0 0x0 port 1-26 deny
#
# Block illegal DHCP
#
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0x0 0x0 0x0 0x0 offset_16-31 0x08000000 0x0 0x00000011 0x0 offset_32-47 0x0 0x00000043 0x0 0x0 port 26 permit
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0x0 0x0 0x0 0x0 offset_16-31 0x08000000 0x0 0x00000011 0x0 offset_32-47 0x0 0x00000044 0x0 0x0 port 1-24 permit
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0x0 0x0 0x0 0x0 offset_16-31 0x08000000 0x0 0x00000011 0x0 offset_32-47 0x0 0x00000043 0x0 0x0 port 1-24 deny
#
#
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0xFFFFFFFF 0xFFFF0000 0x0 0x0 offset_16-31 0x08060000 0x0 0x0 0x0 offset_32-47 0x0 0x0 0x0 0x0 port 1-26 permit
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0xFFFFFFFF 0xFFFF0000 0x0 0x0 offset_16-31 0x08000000 0x0 0x0 0x0 offset_32-47 0x0 0x0 0x0 0x0 port 1-24 deny
.... далее другие profile, никак не влияющие на суть задачи....
ну и последнее...
# Deny all IP
# 9
create access_profile packet_content_mask offset_16-31 0xFFFF0000 0x0 0x0 0x0 profile_id 20
config access_profile profile_id 20 add access_id auto_assign packet_content_mask offset_16-31 0x08000000 0x0 0x0 0x0 port 1-24 deny
- клиент (Win Vista) ни в какую не желает получать IP...
СтОит только после
Код:
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0xFFFFFFFF 0xFFFF0000 0x0 0x0 offset_16-31 0x08000000 0x0 0x0 0x0 offset_32-47 0x0 0x0 0x0 0x0 port 1-24 deny
добавить НЕ_pcf профиль и правило
Код:
# 3
create access_profile ethernet destination_mac FF-FF-FF-FF-FF-FF profile_id 6
config access_profile profile_id 6 add access_id auto_assign ethernet destination_mac FF-FF-FF-FF-FF-FF port 1-26 permit
, все начинает работать, как положено.. НО! Судя по всему, игнорируя тО, что написано выше...
Вот дамп, когда всё работает - клиент получает IP(с добавленным "create access_profile ethernet destination_mac FF-FF-FF-FF-FF-FF profile_id 6".....)
Код:
19:59:05.315992 00:1d:72:04:9b:6c > Broadcast, ethertype IPv4 (0x0800), length 350: 0.0.0.0.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:1d:72:04:9b:6c, length: 308
0x0000: ffff ffff ffff 001d 7204 9b6c 0800 4500 ........r..l..E.
0x0010: 0150 0002 0000 8011 399c 0000 0000 ffff .P......9.......
0x0020: ffff 0044 0043 013c f364 0101 0600 4ccd ...D.C.<.d....L.
0x0030: f819 0400 8000 0000 0000 0000 0000 0000 ................
0x0040: 0000 0000 0000 001d 7204 9b6c 0000 0000 ........r..l....
0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0100: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0110: 0000 0000 0000 6382 5363 3501 033d 0701 ......c.Sc5..=..
0x0120: 001d 7204 9b6c 3204 c0a8 c83d 0c09 6c69 ..r..l2....=..li
0x0130: 6e65 656e 6769 6e51 0c00 0000 6c69 6e65 neenginQ....line
0x0140: 656e 6769 6e3c 084d 5346 5420 352e 3037 engin<.MSFT.5.07
0x0150: 0c01 0f03 062c 2e2f 1f21 79f9 2bff .....,./.!y.+.
19:59:05.364396 00:1d:72:04:9b:6c > Broadcast, ethertype ARP (0x0806), length 60: arp who-has 192.168.200.1 tell 192.168.200.61
0x0000: ffff ffff ffff 001d 7204 9b6c 0806 0001 ........r..l....
0x0010: 0800 0604 0001 001d 7204 9b6c c0a8 c83d ........r..l...=
0x0020: 0000 0000 0000 c0a8 c801 0000 0000 0000 ................
0x0030: 0000 0000 0000 0000 0000 0000 ............
19:59:05.364410 00:02:a5:4e:8d:ca > 00:1d:72:04:9b:6c, ethertype ARP (0x0806), length 42: arp reply 192.168.200.1 is-at 00:02:a5:4e:8d:ca
0x0000: 001d 7204 9b6c 0002 a54e 8dca 0806 0001 ..r..l...N......
0x0010: 0800 0604 0002 0002 a54e 8dca c0a8 c801 .........N......
0x0020: 001d 7204 9b6c c0a8 c83d ..r..l...=
19:59:05.772953 00:1d:72:04:9b:6c > Broadcast, ethertype ARP (0x0806), length 60: arp who-has 192.168.200.61 tell 0.0.0.0
0x0000: ffff ffff ffff 001d 7204 9b6c 0806 0001 ........r..l....
0x0010: 0800 0604 0001 001d 7204 9b6c 0000 0000 ........r..l....
0x0020: 0000 0000 0000 c0a8 c83d 0000 0000 0000 .........=......
0x0030: 0000 0000 0000 0000 0000 0000 ............
19:59:06.802655 00:1d:72:04:9b:6c > Broadcast, ethertype ARP (0x0806), length 60: arp who-has 192.168.200.61 tell 0.0.0.0
0x0000: ffff ffff ffff 001d 7204 9b6c 0806 0001 ........r..l....
0x0010: 0800 0604 0001 001d 7204 9b6c 0000 0000 ........r..l....
0x0020: 0000 0000 0000 c0a8 c83d 0000 0000 0000 .........=......
0x0030: 0000 0000 0000 0000 0000 0000 ............
19:59:07.832148 00:1d:72:04:9b:6c > Broadcast, ethertype ARP (0x0806), length 60: arp who-has 192.168.200.61 tell 0.0.0.0
0x0000: ffff ffff ffff 001d 7204 9b6c 0806 0001 ........r..l....
0x0010: 0800 0604 0001 001d 7204 9b6c 0000 0000 ........r..l....
0x0020: 0000 0000 0000 c0a8 c83d 0000 0000 0000 .........=......
0x0030: 0000 0000 0000 0000 0000 0000 ............
19:59:08.347016 00:1d:72:04:9b:6c > Broadcast, ethertype ARP (0x0806), length 60: arp who-has 169.254.42.153 tell 0.0.0.0
0x0000: ffff ffff ffff 001d 7204 9b6c 0806 0001 ........r..l....
0x0010: 0800 0604 0001 001d 7204 9b6c 0000 0000 ........r..l....
0x0020: 0000 0000 0000 a9fe 2a99 0000 0000 0000 ........*.......
0x0030: 0000 0000 0000 0000 0000 0000 ............
19:59:10.044684 00:1d:72:04:9b:6c > Broadcast, ethertype IPv4 (0x0800), length 342: 192.168.200.61.bootpc > 255.255.255.255.bootps: BOOTP/DHCP, Request from 00:1d:72:04:9b:6c, length: 300
0x0000: ffff ffff ffff 001d 7204 9b6c 0800 4500 ........r..l..E.
0x0010: 0148 0026 0000 8011 b099 c0a8 c83d ffff .H.&.........=..
0x0020: ffff 0044 0043 0134 9027 0101 0600 7a85 ...D.C.4.'....z.
0x0030: f7c6 0000 8000 c0a8 c83d 0000 0000 0000 .........=......
0x0040: 0000 0000 0000 001d 7204 9b6c 0000 0000 ........r..l....
0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0100: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0110: 0000 0000 0000 6382 5363 3501 083d 0701 ......c.Sc5..=..
0x0120: 001d 7204 9b6c 0c09 6c69 6e65 656e 6769 ..r..l..lineengi
0x0130: 6e3c 084d 5346 5420 352e 3037 0d01 0f03 n<.MSFT.5.07....
0x0140: 062c 2e2f 1f21 79f9 2bfc ff00 0000 0000 .,./.!y.+.......
0x0150: 0000 0000 0000 ......
19:59:10.045779 00:02:a5:4e:8d:ca > 00:1d:72:04:9b:6c, ethertype IPv4 (0x0800), length 342: 192.168.200.1.bootps > 192.168.200.61.bootpc: BOOTP/DHCP, Reply, length: 300
0x0000: 001d 7204 9b6c 0002 a54e 8dca 0800 4500 ..r..l...N....E.
0x0010: 0148 0000 4000 4011 2815 c0a8 c801 c0a8 .H..@.@.(.......
0x0020: c83d 0043 0044 0134 12d6 0201 0600 7a85 .=.C.D.4......z.
0x0030: f7c6 0000 8000 c0a8 c83d 0000 0000 0000 .........=......
0x0040: 0000 0000 0000 001d 7204 9b6c 0000 0000 ........r..l....
0x0050: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0060: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0070: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0080: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0090: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00a0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00b0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00c0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00d0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00e0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x00f0: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0100: 0000 0000 0000 0000 0000 0000 0000 0000 ................
0x0110: 0000 0000 0000 6382 5363 3501 0536 040a ......c.Sc5..6..
0x0120: 00c0 0101 04ff ffff c003 04c0 a8c8 0106 ................
0x0130: 043e 2131 212b 0c01 0400 0000 0202 0400 .>!1!+..........
0x0140: 0000 01ff 0000 0000 0000 0000 0000 0000 ................
0x0150: 0000 0000 0000 ......
19:59:15.044774 00:02:a5:4e:8d:ca > 00:1d:72:04:9b:6c, ethertype ARP (0x0806), length 42: arp who-has 192.168.200.61 tell 192.168.200.1
0x0000: 001d 7204 9b6c 0002 a54e 8dca 0806 0001 ..r..l...N......
0x0010: 0800 0604 0001 0002 a54e 8dca c0a8 c801 .........N......
0x0020: 0000 0000 0000 c0a8 c83d .........=
19:59:15.045323 00:1d:72:04:9b:6c > 00:02:a5:4e:8d:ca, ethertype ARP (0x0806), length 60: arp reply 192.168.200.61 is-at 00:1d:72:04:9b:6c
0x0000: 0002 a54e 8dca 001d 7204 9b6c 0806 0001 ...N....r..l....
0x0010: 0800 0604 0002 001d 7204 9b6c c0a8 c83d ........r..l...=
0x0020: 0002 a54e 8dca c0a8 c801 0000 0000 0000 ...N............
0x0030: 0000 0000 0000 0000 0000 0000 ............
Почему первый пакет не попадает в
Код:
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0x0 0x0 0x0 0x0 offset_16-31 0x08000000 0x0 0x00000011 0x0 offset_32-47 0x0 0x00000043 0x0 0x0 port 26 permit
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0x0 0x0 0x0 0x0 offset_16-31 0x08000000 0x0 0x00000011 0x0 offset_32-47 0x0 0x00000044 0x0 0x0 port 1-24 permit
config access_profile profile_id 2 add access_id auto_assign packet_content_mask offset_0-15 0x0 0x0 0x0 0x0 offset_16-31 0x08000000 0x0 0x00000011 0x0 offset_32-47 0x0 0x00000043 0x0 0x0 port 1-24 deny
??
Соответственно банальный вопрос - кто виноват и что делать?