ISGv2 Control policies: различия между версиями
Материал из noname.com.ua
Перейти к навигацииПерейти к поискуSirmax (обсуждение | вклад) (→11) |
Sirmax (обсуждение | вклад) |
||
(не показаны 24 промежуточные версии этого же участника) | |||
Строка 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> |
||
− | no ip access-list extended FROM_PAID_CUSTOMERS |
||
− | ip access-list extended FROM_PAID_CUSTOMERS |
||
− | remark From Paid customers, old and new IP ranges |
||
− | 100 permit ip 192.168.128.0 0.0.15.255 any |
||
− | 200 permit ip 100.64.128.0 0.0.15.255 any |
||
− | 10000 deny ip any any |
||
− | exit |
||
− | </PRE> |
||
− | |||
− | <PRE> |
||
− | no ip access-list extended TO_PAID_CUSTOMERS |
||
− | ip access-list extended TO_PAID_CUSTOMERS |
||
− | 100 permit ip any 192.168.128.0 0.0.15.255 |
||
− | 200 permit ip any 100.64.128.0 0.0.15.255 |
||
− | 10000 deny ip any any |
||
− | deny ip any any |
||
− | exit |
||
− | </PRE> |
||
==Диапазон "неплатильщиков"== |
==Диапазон "неплатильщиков"== |
||
Строка 65: | Строка 44: | ||
exit |
exit |
||
</PRE> |
</PRE> |
||
+ | |||
+ | |||
+ | |||
<PRE> |
<PRE> |
||
+ | no ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_INET |
||
− | class-map type control match-all CLASS_MAP_NOT_PAID_CUSTOMERS |
||
+ | ip access-list extended FROM_NOT_PAID_CUSTOMERS_TO_INET |
||
− | match source-ip-address 10.3.0.0 255.255.0.0 |
||
+ | 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 |
||
</PRE> |
</PRE> |
||
− | |||
− | ==Диапазон "неавторизованных"== |
||
− | Те абоненты что только что включились, но еще не ввели свой логин и пароль получают адреса из диапазона <code>10.2.0.0/16</code> |
||
<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 From Not- |
+ | remark From Not-Paid Customers to internet except our network |
− | 100 permit ip 10. |
+ | 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 |
10000 deny ip any any |
||
exit |
exit |
||
Строка 85: | Строка 77: | ||
<PRE> |
<PRE> |
||
− | no ip access-list extended |
+ | no ip access-list extended FROM_LOCAL_TO_NOT_PAID_CUSTOMERS |
− | 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.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 |
10000 deny ip any any |
||
− | deny ip any any |
||
exit |
exit |
||
</PRE> |
</PRE> |
||
+ | |||
+ | |||
+ | |||
<PRE> |
<PRE> |
||
− | class-map type control match-all |
+ | 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 |
match source-ip-address 10.3.0.0 255.255.0.0 |
||
+ | exit |
||
</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 |
||
+ | exit |
||
+ | </PRE> |
||
+ | |||
+ | ==Диапазон "неавторизованных"== |
||
+ | Те абоненты что только что включились, но еще не ввели свой логин и пароль получают адреса из диапазона <code>10.2.0.0/16</code> |
||
=Тестовый сервис= |
=Тестовый сервис= |
||
+ | |||
+ | <PRE> |
||
+ | 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 |
||
+ | </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 |
||
=999= |
=999= |
||
+ | |||
+ | <PRE> |
||
+ | 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 |
||
+ | ! |
||
+ | </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 !