Juniper — различия между версиями

Материал из gptel_wiki
Перейти к: навигация, поиск
(Новая страница: «== Как в каком порядке работают policy == <pre> Начинает работать первый списку term в policy если пр…»)
 
(SNMP OID's)
 
(не показано 11 промежуточных версии 2 участников)
Строка 1: Строка 1:
 +
==prefix-list и prefix-list filter==
 +
 +
 +
prefix-list customer == prefix-list-filter customer exact
 +
 +
prefix-list-filter customers orlonger - совпадение с явно указаным префиксом и префиксами с более высочим значением маски(/24 ->> /32)
 +
 +
prefix-list-filiter customer longer
 +
 
== Как в каком порядке работают policy ==
 
== Как в каком порядке работают policy ==
  
Строка 78: Строка 87:
  
 
</pre>
 
</pre>
 +
 +
== Зеркалирование на EX-3300 ==
 +
 +
<pre>
 +
[edit]
 +
set interfaces xe-0/1/2 unit 0 family ethernet-switching
 +
set ethernet-switching-options analyzer sorm3 input ingress interface xe-0/1/2.0
 +
set ethernet-switching-options analyzer sorm3 input egress interface xe-0/1/2.0
 +
set ethernet-switching-options analyzer sorm3 output interface xe-0/1/0.0
 +
</pre>
 +
  
 
==  Полезные команды ==
 
==  Полезные команды ==
Строка 95: Строка 115:
 
Ввести конфигурацию в форматированном виде
 
Ввести конфигурацию в форматированном виде
 
load merge terminal
 
load merge terminal
 +
</pre>
 +
 +
== q-in-q ==
 +
 +
Table 1: Components of the Topology for Setting Up Q-in-Q Tunneling
 +
 +
<pre>
 +
Interface Description
 +
 +
ge-0/0/11.0
 +
Tagged S-VLAN trunk port
 +
 +
ge-0/0/12.0
 +
Untagged customer-facing access port
 +
 +
ge-0/0/13.0
 +
Untagged customer-facing access port
 +
 +
ge-0/0/14.0
 +
Tagged S-VLAN trunk port
 +
</pre>
 +
 +
Configuration
 +
 +
<pre>
 +
[edit]
 +
 +
set vlans qinqvlan vlan-id 4001
 +
set vlans qinqvlan dot1q-tunneling customer-vlans 1-100
 +
set vlans qinqvlan dot1q-tunneling customer-vlans 201-300
 +
set interfaces ge-0/0/11 unit 0 family ethernet-switching port-mode trunk
 +
set interfaces ge-0/0/11 unit 0 family ethernet-switching vlan members 4001
 +
set interfaces ge-0/0/12 unit 0 family ethernet-switching port-mode access
 +
set interfaces ge-0/0/12 unit 0 family ethernet-switching vlan members 4001
 +
set interfaces ge-0/0/13 unit 0 family ethernet-switching port-mode access
 +
set interfaces ge-0/0/13 unit 0 family ethernet-switching vlan members 4001
 +
set interfaces ge-0/0/14 unit 0 family ethernet-switching port-mode trunk
 +
set interfaces ge-0/0/14 unit 0 family ethernet-switching vlan members 4001
 +
set ethernet-switching-options dot1q-tunneling ether-type 0x9100
 +
</pre>
 +
 +
Verify that Q-in-Q tunneling was properly enabled on the switch.
 +
 +
<pre>
 +
user@switch> show vlans qinqvlan extensive
 +
VLAN: qinqvlan, Created at: Thu Sep 18 07:17:53 2008
 +
802.1Q Tag: 4001, Internal index: 18, Admin State: Enabled, Origin: Static
 +
Dot1q Tunneling Status: Enabled
 +
Customer VLAN ranges:
 +
                    1-100
 +
                    201-300
 +
Protocol: Port Mode
 +
Number of interfaces: Tagged 2 (Active = 0), Untagged  4 (Active = 0)
 +
      ge-0/0/11.0, tagged, trunk
 +
      ge-0/0/14.0, tagged, trunk
 +
      ge-0/0/12.0, untagged, access
 +
      ge-0/0/13.0, untagged, access
 
</pre>
 
</pre>
  
Строка 101: Строка 178:
  
 
[http://www.juniper.net/techpubs/en_US/junos14.1/topics/concept/policy-routing-policies-chain-evaluation-method.html Порядок выполнения полиси]
 
[http://www.juniper.net/techpubs/en_US/junos14.1/topics/concept/policy-routing-policies-chain-evaluation-method.html Порядок выполнения полиси]
 +
 +
 +
== полисеры - шейпер 10м ==
 +
 +
svc-pppoe-policer-10m {
 +
        interfaces {
 +
            pp0 {
 +
                unit "$junos-interface-unit" {
 +
                    family inet {
 +
                        filter {
 +
                            input policer-10m;
 +
                            output policer-10m;
 +
                        }
 +
                    }
 +
                }
 +
            }
 +
        }
 +
    }
 +
 +
firewall {
 +
    family inet {
 +
        filter policer-10m {
 +
            interface-specific;
 +
            term 1 {
 +
                from {
 +
                    destination-address {
 +
                        УУУ.ХХХ.6.38/32;
 +
                        УУУ.ХХХ.6.6/32;
 +
                    }
 +
                    source-prefix-list {
 +
                        NoMoneyHosts;
 +
                    }
 +
                    protocol [ tcp udp ];
 +
                    destination-port [ 80 53 ];
 +
                }
 +
                then accept;
 +
            }
 +
            term 2 {
 +
                from {
 +
                    source-prefix-list {
 +
                        NoMoneyHosts;
 +
                    }
 +
                    protocol [ tcp udp ];
 +
                    destination-port [ 80 53 ];
 +
                }
 +
                then {
 +
                    routing-instance neg_dep;
 +
                }
 +
            }
 +
            term 3 {
 +
                from {
 +
                    source-prefix-list {
 +
                        NoMoneyHosts;
 +
                    }
 +
                }
 +
                then {
 +
                    discard;
 +
                }
 +
            }
 +
            term default {
 +
                then policer 10m;
 +
            }
 +
        }
 +
 +
    policer 10m {
 +
        if-exceeding {
 +
            bandwidth-limit 10m;
 +
            burst-size-limit 640k;
 +
        }
 +
        then discard;
 +
    }
 +
 +
== radius juniper <-> utm ==
 +
 +
Настройки радиуса со стороны Джуна:
 +
 +
Код:
 +
<pre>
 +
set access profile UTM accounting-order radius
 +
set access profile UTM authentication-order radius
 +
set access profile UTM radius authentication-server XX.XX.6.6
 +
set access profile UTM radius accounting-server XX.XX.6.6
 +
set access profile UTM radius options interface-description-format exclude-sub-interface
 +
set access profile UTM radius options interface-description-format exclude-adapter
 +
set access profile UTM radius options calling-station-id-format interface-description
 +
set access profile UTM radius options calling-station-id-format agent-remote-id
 +
set access profile UTM radius options accounting-session-id-format decimal
 +
set access profile UTM radius-server XX.XX.6.6 port 1812
 +
set access profile UTM radius-server XX.XX.6.6 accounting-port 1813
 +
set access profile UTM radius-server XX.XX.6.6 secret "$9$JrZkP9Cf5z6evNbY2UDqmf"
 +
set access profile UTM radius-server XX.XX.6.6 timeout 10
 +
set access profile UTM radius-server XX.XX.6.6 retry 5
 +
set access profile UTM radius-server XX.XX.6.6 max-outstanding-requests 1500
 +
set access profile UTM radius-server XX.XX.6.6 source-address XX.XX.53.128
 +
set access profile UTM accounting order radius
 +
</pre>
 +
 +
Настройки со стороны УТМ радиуса:
 +
 +
Код:
 +
<pre>
 +
core_host=127.0.0.1
 +
core_port=12758
 +
radius_auth_mppe=enable
 +
radius_auth_vap=1
 +
radius_ippool_acct_timeout=0
 +
blocked_pool_name=NoMoney
 +
named_pool_shuffle=yes
 +
#radius_ippool_timeout=700
 +
radius_card_autoadd=no
 +
interim_update_interval=700
 +
radius_default_session_timeout=86400
 +
log_level=3
 +
log_file_main=/dev/null
 +
log_file_debug=/dev/null
 +
rotate_logs=yes
 +
max_logfile_count=0
 +
</pre>
 +
 +
== SNMP OID's ==
 +
 +
IPv6 счетчик на интерфейсе
 +
1.3.6.1.4.1.2636.3.11.1.3.1.1.1.623&1.3.6.1.4.1.2636.3.11.1.3.1.1.2.623:public@7.7.7.7:::::2
 +
 +
В данном примере последнее число это номер интерфейса.
 +
Вычисляется элементарно в дереве MIB в самом начале -
 +
IF-MIB::ifDescr.623 = STRING: xe-1/2/0.1474

Текущая версия на 09:26, 14 января 2020

prefix-list и prefix-list filter

prefix-list customer == prefix-list-filter customer exact

prefix-list-filter customers orlonger - совпадение с явно указаным префиксом и префиксами с более высочим значением маски(/24 ->> /32)

prefix-list-filiter customer longer

Как в каком порядке работают policy

Начинает работать первый списку term в policy
если происходит срабатывание и под него прописано действие accept или reject
policy заканчивает обработку маршрута и начинает обрабатывать следующий маршрут с начального term-а. 

Пример: выставляем низкий приоритет для всех подсетей МТС

show policy-statement retn-in

term 10 {
    from {
        protocol bgp;
        as-path as-mts; ''если маршрут из номера автономки''
    }
    then {
        local-preference 209;  ''присваиваем localpref''
        accept;  ''и заканчиваем обработку этого маршрута''
    }
}
term 20 {
    then {
        local-preference 210;  ''или другой localpref остальным маршрутам''
        accept;
    }
}


Если действие accept-reject не указано обработка произойдет и будет переход с следующему в списке term-у.

Если применен операнд next-term то действие accept-reject будет проигнорировано и произойдет переход к следующему term-у.


community prepends

разрешаем кастомеру использовать community для самостоятельной установки препендов

policy-statement prepend {
 term 10 {
  from community prepend-1;
  then {
   as-path-expand last-as;
   accept;
   }
  }
 term 20 {
  from community prepend-2;
  then {
   as-path-expand last-as count 2;
   accept;
   }
  }
 }

community prepend-1 65000:1;
community prepend-2 65000:2;

community backup

разрешаем кастомеру использовать community backup для полного исключения входящего на него трафика т.е.

устанавливаем минимальный из диапазона используемых local preference

policy-options {
 community comm_backup members 42484:65535;
 policy-statement from-customer {
  from community comm_backup;
  then {
   metric 2;
   preference 10;
   next policy;
  }
 }
}

Зеркалирование на EX-3300

[edit]
set interfaces xe-0/1/2 unit 0 family ethernet-switching
set ethernet-switching-options analyzer sorm3 input ingress interface xe-0/1/2.0
set ethernet-switching-options analyzer sorm3 input egress interface xe-0/1/2.0
set ethernet-switching-options analyzer sorm3 output interface xe-0/1/0.0


Полезные команды

root@jun# run test policy ANNOUNCE-OUT d.d.d.0/21

Откат конфигураций
root@junr# rollback {откат на последнюю конфигурацию}
root@jun# rollback? {просмотр откатов конфигурации}

Просмотр изменений в конфигурации ДО ее применения
root@junr# show | compare 

Просмотр изменений в конфигурации ПОСЛЕ ее применения
root@junr# show | compare rollback 0

Ввести конфигурацию в форматированном виде
load merge terminal

q-in-q

Table 1: Components of the Topology for Setting Up Q-in-Q Tunneling

Interface	Description

ge-0/0/11.0
Tagged S-VLAN trunk port

ge-0/0/12.0
Untagged customer-facing access port

ge-0/0/13.0
Untagged customer-facing access port

ge-0/0/14.0
Tagged S-VLAN trunk port

Configuration

[edit]

set vlans qinqvlan vlan-id 4001
set vlans qinqvlan dot1q-tunneling customer-vlans 1-100
set vlans qinqvlan dot1q-tunneling customer-vlans 201-300
set interfaces ge-0/0/11 unit 0 family ethernet-switching port-mode trunk
set interfaces ge-0/0/11 unit 0 family ethernet-switching vlan members 4001
set interfaces ge-0/0/12 unit 0 family ethernet-switching port-mode access
set interfaces ge-0/0/12 unit 0 family ethernet-switching vlan members 4001
set interfaces ge-0/0/13 unit 0 family ethernet-switching port-mode access
set interfaces ge-0/0/13 unit 0 family ethernet-switching vlan members 4001
set interfaces ge-0/0/14 unit 0 family ethernet-switching port-mode trunk
set interfaces ge-0/0/14 unit 0 family ethernet-switching vlan members 4001
set ethernet-switching-options dot1q-tunneling ether-type 0x9100

Verify that Q-in-Q tunneling was properly enabled on the switch.

user@switch> show vlans qinqvlan extensive
VLAN: qinqvlan, Created at: Thu Sep 18 07:17:53 2008
802.1Q Tag: 4001, Internal index: 18, Admin State: Enabled, Origin: Static
Dot1q Tunneling Status: Enabled
Customer VLAN ranges:
                     1-100
                     201-300
Protocol: Port Mode
Number of interfaces: Tagged 2 (Active = 0), Untagged  4 (Active = 0)
      ge-0/0/11.0, tagged, trunk
      ge-0/0/14.0, tagged, trunk
      ge-0/0/12.0, untagged, access
      ge-0/0/13.0, untagged, access

Полезные ссылки

Порядок выполнения полиси


полисеры - шейпер 10м

svc-pppoe-policer-10m {

       interfaces { 
           pp0 { 
               unit "$junos-interface-unit" { 
                   family inet { 
                       filter { 
                           input policer-10m; 
                           output policer-10m; 
                       } 
                   } 
               } 
           } 
       } 
   } 

firewall {

   family inet { 
       filter policer-10m { 
           interface-specific; 
           term 1 { 
               from { 
                   destination-address { 
                       УУУ.ХХХ.6.38/32; 
                       УУУ.ХХХ.6.6/32; 
                   } 
                   source-prefix-list { 
                       NoMoneyHosts; 
                   } 
                   protocol [ tcp udp ]; 
                   destination-port [ 80 53 ]; 
               } 
               then accept; 
           } 
           term 2 { 
               from { 
                   source-prefix-list { 
                       NoMoneyHosts; 
                   } 
                   protocol [ tcp udp ]; 
                   destination-port [ 80 53 ]; 
               } 
               then { 
                   routing-instance neg_dep; 
               } 
           } 
           term 3 { 
               from { 
                   source-prefix-list { 
                       NoMoneyHosts; 
                   } 
               } 
               then { 
                   discard; 
               } 
           } 
           term default { 
               then policer 10m; 
           } 
       } 
   policer 10m { 
       if-exceeding { 
           bandwidth-limit 10m; 
           burst-size-limit 640k; 
       } 
       then discard; 
   }

radius juniper <-> utm

Настройки радиуса со стороны Джуна:

Код:

set access profile UTM accounting-order radius 
set access profile UTM authentication-order radius 
set access profile UTM radius authentication-server XX.XX.6.6 
set access profile UTM radius accounting-server XX.XX.6.6 
set access profile UTM radius options interface-description-format exclude-sub-interface 
set access profile UTM radius options interface-description-format exclude-adapter 
set access profile UTM radius options calling-station-id-format interface-description 
set access profile UTM radius options calling-station-id-format agent-remote-id 
set access profile UTM radius options accounting-session-id-format decimal 
set access profile UTM radius-server XX.XX.6.6 port 1812 
set access profile UTM radius-server XX.XX.6.6 accounting-port 1813 
set access profile UTM radius-server XX.XX.6.6 secret "$9$JrZkP9Cf5z6evNbY2UDqmf" 
set access profile UTM radius-server XX.XX.6.6 timeout 10 
set access profile UTM radius-server XX.XX.6.6 retry 5 
set access profile UTM radius-server XX.XX.6.6 max-outstanding-requests 1500 
set access profile UTM radius-server XX.XX.6.6 source-address XX.XX.53.128 
set access profile UTM accounting order radius

Настройки со стороны УТМ радиуса:

Код:

core_host=127.0.0.1 
core_port=12758 
radius_auth_mppe=enable 
radius_auth_vap=1 
radius_ippool_acct_timeout=0 
blocked_pool_name=NoMoney 
named_pool_shuffle=yes 
#radius_ippool_timeout=700 
radius_card_autoadd=no 
interim_update_interval=700 
radius_default_session_timeout=86400 
log_level=3 
log_file_main=/dev/null 
log_file_debug=/dev/null 
rotate_logs=yes 
max_logfile_count=0

SNMP OID's

IPv6 счетчик на интерфейсе

1.3.6.1.4.1.2636.3.11.1.3.1.1.1.623&1.3.6.1.4.1.2636.3.11.1.3.1.1.2.623:public@7.7.7.7:::::2

В данном примере последнее число это номер интерфейса. Вычисляется элементарно в дереве MIB в самом начале -

IF-MIB::ifDescr.623 = STRING: xe-1/2/0.1474