ISGv2 Control policies: различия между версиями
Материал из noname.com.ua
Перейти к навигацииПерейти к поискуSirmax (обсуждение | вклад) |
Sirmax (обсуждение | вклад) |
||
(не показано 26 промежуточных версий этого же участника) | |||
Строка 20: | Строка 20: | ||
* "Старый" пул адресов <code>192.168.128.0/20</code> |
* "Старый" пул адресов <code>192.168.128.0/20</code> |
||
* Новый пул адресов, на который только планируется миграция <code>100.64.128.0/20</code> |
* Новый пул адресов, на который только планируется миграция <code>100.64.128.0/20</code> |
||
− | * Реальные адреса |
+ | * Реальные адреса заменены на сеть 100.127.252.0/22 |
+ | |||
⚫ | |||
⚫ | |||
<PRE> |
<PRE> |
||
− | no ip access-list extended |
+ | no ip access-list extended FROM_NOT_PAID_CUSTOMERS |
− | ip access-list extended |
+ | ip access-list extended FROM_NOT_PAID_CUSTOMERS |
− | remark From Paid |
+ | remark From Not-Paid Customers |
− | 100 permit ip |
+ | 100 permit ip 10.3.0.0 0.0.255.255 any |
⚫ | |||
10000 deny ip any any |
10000 deny ip any any |
||
exit |
exit |
||
Строка 34: | Строка 36: | ||
<PRE> |
<PRE> |
||
− | no ip access-list extended |
+ | no ip access-list extended TO_NOT_PAID_CUSTOMERS |
− | ip access-list extended |
+ | ip access-list extended TO_NOT_PAID_CUSTOMERS |
⚫ | |||
⚫ | |||
− | + | 100 permit ip any 10.3.0.0 0.0.255.255 |
|
10000 deny ip any any |
10000 deny ip any any |
||
deny ip any any |
deny ip any any |
||
Строка 43: | Строка 45: | ||
</PRE> |
</PRE> |
||
+ | |||
⚫ | |||
+ | |||
⚫ | |||
<PRE> |
<PRE> |
||
− | no ip access-list extended |
+ | no ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_INET |
− | ip access-list extended |
+ | ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_INET |
− | remark From Not-Paid Customers |
+ | remark From Not-Paid Customers to internet except our network |
− | 100 |
+ | 100 deny ip 10.3.0.0 0.0.255.255 10.0.0.0 0.255.255.255 |
⚫ | |||
+ | 300 deny ip 10.3.0.0 0.0.255.255 172.16.0.0 0.15.255.255 |
||
+ | 400 deny ip 10.3.0.0 0.0.255.255 100.64.128.0 0.0.15.255 |
||
⚫ | |||
⚫ | |||
10000 deny ip any any |
10000 deny ip any any |
||
exit |
exit |
||
Строка 57: | Строка 64: | ||
<PRE> |
<PRE> |
||
− | no ip access-list extended |
+ | no ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_LOCAL |
− | ip access-list extended |
+ | ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_LOCAL |
− | remark |
+ | remark From Not-Paid Customers to internet except our network |
− | 100 permit ip |
+ | 100 permit ip 10.3.0.0 0.0.255.255 10.0.0.0 0.255.255.255 |
+ | 200 permit ip 10.3.0.0 0.0.255.255 192.168.0.0 0.0.255.255 |
||
+ | 300 permit ip 10.3.0.0 0.0.255.255 172.16.0.0 0.15.255.255 |
||
⚫ | |||
+ | 500 permit ip 10.3.0.0 0.0.255.255 100.127.252.0 0.0.3.255 |
||
10000 deny ip any any |
10000 deny ip any any |
||
⚫ | |||
exit |
exit |
||
</PRE> |
</PRE> |
||
+ | |||
+ | <PRE> |
||
⚫ | |||
⚫ | |||
⚫ | |||
+ | 100 permit ip 10.0.0.0 0.255.255.255 10.3.0.0 0.0.255.255 |
||
+ | 200 permit ip 192.168.0.0 0.0.255.255 10.3.0.0 0.0.255.255 |
||
+ | 300 permit ip 172.16.0.0 0.15.255.255 10.3.0.0 0.0.255.255 |
||
+ | 400 permit ip 100.64.128.0 0.0.15.255 10.3.0.0 0.0.255.255 |
||
+ | 500 permit ip 100.127.252.0 0.0.3.255 10.3.0.0 0.0.255.255 |
||
⚫ | |||
+ | exit |
||
+ | </PRE> |
||
+ | |||
+ | |||
<PRE> |
<PRE> |
||
+ | no class-map type control match-all CLASS_MAP_NOT_PAID_CUSTOMERS |
||
class-map type control match-all CLASS_MAP_NOT_PAID_CUSTOMERS |
class-map type control match-all CLASS_MAP_NOT_PAID_CUSTOMERS |
||
match source-ip-address 10.3.0.0 255.255.0.0 |
match source-ip-address 10.3.0.0 255.255.0.0 |
||
+ | exit |
||
</PRE> |
</PRE> |
||
⚫ | |||
⚫ | |||
<PRE> |
<PRE> |
||
+ | no class-map type traffic match-any CLASS_MAP_NOT_PAID_CUSTOMERS_TO_LOCAL |
||
⚫ | |||
+ | class-map type traffic match-any CLASS_MAP_NOT_PAID_CUSTOMERS_TO_LOCAL |
||
⚫ | |||
+ | match access-group input name FROM_NOT_PAID_CUSTOMERS_TO_LOCAL |
||
⚫ | |||
+ | match access-group output name FROM_LOCAL_TO_NOT_PAID_CUSTOMERS |
||
⚫ | |||
− | 10000 deny ip any any |
||
exit |
exit |
||
</PRE> |
</PRE> |
||
+ | |||
⚫ | |||
⚫ | |||
+ | |||
+ | =Тестовый сервис= |
||
<PRE> |
<PRE> |
||
+ | no policy-map type service POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL |
||
− | no ip access-list extended TO_NOT_AUTH_CUSTOMERS |
||
+ | policy-map type service POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL |
||
− | ip access-list extended TO_NOT_AUTH_CUSTOMERS |
||
+ | 100 class type traffic CLASS_MAP_NOT_PAID_CUSTOMERS_TO_LOCAL |
||
⚫ | |||
+ | police input 8000 |
||
⚫ | |||
+ | police output 8000 |
||
− | 10000 deny ip any any |
||
− | deny ip any any |
||
exit |
exit |
||
</PRE> |
</PRE> |
||
+ | |||
+ | |||
+ | no policy-map type service POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL1 |
||
+ | policy-map type service POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL1 |
||
+ | class type traffic CLASS_MAP_NOT_PAID_CUSTOMERS_TO_LOCAL |
||
+ | police input 8000 |
||
+ | police output 8000 |
||
+ | exit |
||
+ | exit |
||
+ | |||
⚫ | |||
<PRE> |
<PRE> |
||
− | class-map type control match-all |
+ | no class-map type control match-all CLASS_MAP_CONTROL_TIMER_FOR_NOT_PAID |
+ | class-map type control match-all CLASS_MAP_CONTROL_TIMER_FOR_NOT_PAID |
||
+ | match authen-status unauthenticated |
||
+ | match timer TIMER_NOT_PAID |
||
match source-ip-address 10.3.0.0 255.255.0.0 |
match source-ip-address 10.3.0.0 255.255.0.0 |
||
+ | exit |
||
+ | ! |
||
</PRE> |
</PRE> |
||
+ | <PRE> |
||
+ | policy-map type control ISG-CUSTOMERS-POLICY |
||
⚫ | |||
+ | class type control CLASS_MAP_CONTROL_TIMER_FOR_NOT_PAID event timed-policy-expiry |
||
+ | 10 service disconnect |
||
+ | ! |
||
+ | class type control CLASS_MAP_NOT_PAID_CUSTOMERS event session-start |
||
+ | 20 set-timer TIMER_NOT_PAID 5 |
||
+ | 30 service-policy type service name POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL |
||
+ | exit |
||
+ | exit |
||
+ | ! |
||
+ | </PRE> |
||
+ | |||
+ | =999999= |
||
<PRE> |
<PRE> |
||
policy-map type control ISG-CUSTOMERS-POLICY |
policy-map type control ISG-CUSTOMERS-POLICY |
Текущая версия на 08:59, 10 мая 2023
Control policies
Политики управляют всей логикой
1
Что хочется получить
- Для всех пользователей проверять скорость из радиуса и выставлять соответвующую скорость
- Скорость пользователя в биллинге произвольна и нет заранее предопределенных тарифов
- Если радиус не ответил (тайм-аут) то для пользователей из разрешенного диапазона адресов разрешать доступ в интернет (без ограничения скорости)
- Если радиус ответил Reject то для разрешенного диапазона разрешать работу а для запрещенного диапазона - делать редирект
Определить диапазона адресов
"Нормальные" платящие абоненты
Три диапазона (в примере только два)
- "Старый" пул адресов
192.168.128.0/20
- Новый пул адресов, на который только планируется миграция
100.64.128.0/20
- Реальные адреса заменены на сеть 100.127.252.0/22
Диапазон "неплатильщиков"
Абонентам у которых образовалась задолженность, выдаются адреса из диапазона 10.3.0.0/16
no ip access-list extended FROM_NOT_PAID_CUSTOMERS ip access-list extended FROM_NOT_PAID_CUSTOMERS remark From Not-Paid Customers 100 permit ip 10.3.0.0 0.0.255.255 any 10000 deny ip any any exit
no ip access-list extended TO_NOT_PAID_CUSTOMERS ip access-list extended TO_NOT_PAID_CUSTOMERS remark TO Not-Paid Customers 100 permit ip any 10.3.0.0 0.0.255.255 10000 deny ip any any deny ip any any exit
no ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_INET ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_INET remark From Not-Paid Customers to internet except our network 100 deny ip 10.3.0.0 0.0.255.255 10.0.0.0 0.255.255.255 200 deny ip 10.3.0.0 0.0.255.255 192.168.0.0 0.0.255.255 300 deny ip 10.3.0.0 0.0.255.255 172.16.0.0 0.15.255.255 400 deny ip 10.3.0.0 0.0.255.255 100.64.128.0 0.0.15.255 500 deny ip 10.3.0.0 0.0.255.255 100.127.252.0 0.0.3.255 600 permit ip 10.3.0.0 0.0.255.255 any 10000 deny ip any any exit
no ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_LOCAL ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_LOCAL remark From Not-Paid Customers to internet except our network 100 permit ip 10.3.0.0 0.0.255.255 10.0.0.0 0.255.255.255 200 permit ip 10.3.0.0 0.0.255.255 192.168.0.0 0.0.255.255 300 permit ip 10.3.0.0 0.0.255.255 172.16.0.0 0.15.255.255 400 permit ip 10.3.0.0 0.0.255.255 100.64.128.0 0.0.15.255 500 permit ip 10.3.0.0 0.0.255.255 100.127.252.0 0.0.3.255 10000 deny ip any any exit
no ip access-list extended FROM_LOCAL_TO_NOT_PAID_CUSTOMERS ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_LOCAL remark From Not-Paid Customers to internet except our network 100 permit ip 10.0.0.0 0.255.255.255 10.3.0.0 0.0.255.255 200 permit ip 192.168.0.0 0.0.255.255 10.3.0.0 0.0.255.255 300 permit ip 172.16.0.0 0.15.255.255 10.3.0.0 0.0.255.255 400 permit ip 100.64.128.0 0.0.15.255 10.3.0.0 0.0.255.255 500 permit ip 100.127.252.0 0.0.3.255 10.3.0.0 0.0.255.255 10000 deny ip any any exit
no class-map type control match-all CLASS_MAP_NOT_PAID_CUSTOMERS class-map type control match-all CLASS_MAP_NOT_PAID_CUSTOMERS match source-ip-address 10.3.0.0 255.255.0.0 exit
no class-map type traffic match-any CLASS_MAP_NOT_PAID_CUSTOMERS_TO_LOCAL class-map type traffic match-any CLASS_MAP_NOT_PAID_CUSTOMERS_TO_LOCAL match access-group input name FROM_NOT_PAID_CUSTOMERS_TO_LOCAL match access-group output name FROM_LOCAL_TO_NOT_PAID_CUSTOMERS exit
Диапазон "неавторизованных"
Те абоненты что только что включились, но еще не ввели свой логин и пароль получают адреса из диапазона 10.2.0.0/16
Тестовый сервис
no policy-map type service POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL policy-map type service POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL 100 class type traffic CLASS_MAP_NOT_PAID_CUSTOMERS_TO_LOCAL police input 8000 police output 8000 exit
no policy-map type service POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL1
policy-map type service POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL1
class type traffic CLASS_MAP_NOT_PAID_CUSTOMERS_TO_LOCAL police input 8000 police output 8000 exit
exit
999
no class-map type control match-all CLASS_MAP_CONTROL_TIMER_FOR_NOT_PAID class-map type control match-all CLASS_MAP_CONTROL_TIMER_FOR_NOT_PAID match authen-status unauthenticated match timer TIMER_NOT_PAID match source-ip-address 10.3.0.0 255.255.0.0 exit !
policy-map type control ISG-CUSTOMERS-POLICY class type control CLASS_MAP_CONTROL_TIMER_FOR_NOT_PAID event timed-policy-expiry 10 service disconnect ! class type control CLASS_MAP_NOT_PAID_CUSTOMERS event session-start 20 set-timer TIMER_NOT_PAID 5 30 service-policy type service name POLICY_MAP_SERVICE_NOT_PAID_CUSTOMERS_TO_LOCAL exit exit !
999999
policy-map type control ISG-CUSTOMERS-POLICY class type control ISG-IP-UNAUTH event timed-policy-expiry 1 service disconnect ! class type control always event session-start 10 authorize aaa list AAA-LIST-ISG-AUTH password secret identifier source-ip-address 20 set-timer UNAUTH-TIMER 5 30 service-policy type service name POLICY_MAP_SERVICE_ON_SESSION_START_ ! class type control always event session-restart 10 authorize aaa list AAA-LIST-ISG-AUTH password secret identifier source-ip-address 20 set-timer UNAUTH-TIMER 5 30 service-policy type service name POLICY_MAP_SERVICE_ON_SESSION_RESTART_ ! class type control always event service-stop 1 service-policy type service unapply identifier service-name 10 service-policy type service unapply identifier service-name 20 log-session-state ! class type control always event radius-timeout 20 set-timer UNAUTH-TIMER 60 30 service-policy type service name POLICY_MAP_SERVICE_ON_SESSION_RADIUS_TIMEOUT_ ! class type control always event access-reject 20 set-timer UNAUTH-TIMER 60 30 service-policy type service name ALLOW_172_31_100_2 40 service-policy type service name ALLOW_172_31_100_3_SPEED_8k 50 service-policy type service name NO_SERVICE !