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

Материал из gptel_wiki
Перейти к: навигация, поиск
(q-in-q)
Строка 103: Строка 103:
 
<pre>
 
<pre>
 
Interface Description
 
Interface Description
ge-0/0/11.0
 
  
 +
ge-0/0/11.0
 
Tagged S-VLAN trunk port
 
Tagged S-VLAN trunk port
  
 
ge-0/0/12.0
 
ge-0/0/12.0
 
 
Untagged customer-facing access port
 
Untagged customer-facing access port
  
 
ge-0/0/13.0
 
ge-0/0/13.0
 
 
Untagged customer-facing access port
 
Untagged customer-facing access port
  
 
ge-0/0/14.0
 
ge-0/0/14.0
 
 
Tagged S-VLAN trunk port
 
Tagged S-VLAN trunk port
 
</pre>
 
</pre>
Строка 122: Строка 119:
 
Configuration
 
Configuration
  
CLI Quick Configuration
+
<pre>
To quickly create and configure Q-in-Q tunneling, copy the following commands and paste them into the switch terminal window:
+
 
+
 
+
 
[edit]
 
[edit]
 
  
 
set vlans qinqvlan vlan-id 4001
 
set vlans qinqvlan vlan-id 4001
 
 
 
set vlans qinqvlan dot1q-tunneling customer-vlans 1-100
 
set vlans qinqvlan dot1q-tunneling customer-vlans 1-100
 
 
 
set vlans qinqvlan dot1q-tunneling customer-vlans 201-300
 
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 port-mode trunk
 
 
 
set interfaces ge-0/0/11 unit 0 family ethernet-switching vlan members 4001
 
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 port-mode access
 
 
 
set interfaces ge-0/0/12 unit 0 family ethernet-switching vlan members 4001
 
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 port-mode access
 
 
 
set interfaces ge-0/0/13 unit 0 family ethernet-switching vlan members 4001
 
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 port-mode trunk
 
 
 
set interfaces ge-0/0/14 unit 0 family ethernet-switching vlan members 4001
 
set interfaces ge-0/0/14 unit 0 family ethernet-switching vlan members 4001
 
 
 
set ethernet-switching-options dot1q-tunneling ether-type 0x9100
 
set ethernet-switching-options dot1q-tunneling ether-type 0x9100
 
+
</pre>
 
Step-by-Step Procedure
 
Step-by-Step Procedure
 
To configure Q-in-Q tunneling:
 
To configure Q-in-Q tunneling:

Версия 17:17, 28 июля 2015

Как в каком порядке работают 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;
  }
 }
}

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

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

Step-by-Step Procedure To configure Q-in-Q tunneling:

Set the VLAN ID for the S-VLAN:

[edit vlans] user@switch# set qinqvlan vlan-id 4001 Enable Q-in-Q tuennling and specify the customer VLAN ranges:

[edit vlans] user@switch# set qinqvlan dot1q-tunneling customer-vlans 1-100 user@switch# set qinqvlan dot1q-tunneling customer-vlans 201-300 Set the port mode and VLAN information for the interfaces:

[edit interfaces] user@switch# set ge-0/0/11 unit 0 family ethernet-switching port-mode trunk user@switch# set ge-0/0/11 unit 0 family ethernet-switching vlan members 4001 user@switch# set ge-0/0/12 unit 0 family ethernet-switching port-mode access user@switch# set ge-0/0/12 unit 0 family ethernet-switching vlan members 4001 user@switch# set ge-0/0/13 unit 0 family ethernet-switching port-mode access user@switch# set ge-0/0/13 unit 0 family ethernet-switching vlan members 4001 user@switch# set ge-0/0/14 unit 0 family ethernet-switching port-mode trunk user@switch# set ge-0/0/14 unit 0 family ethernet-switching vlan members 4001 Set the Q-in-Q Ethertype value:

[edit] user@switch# set ethernet-switching-options dot1q-tunneling ether-type 0x9100 Results Check the results of the configuration:

user@switch> show configuration vlans qinqvlan vlan-id 4001; dot1q-tunneling { customer-vlans [ 1-100 201-300 ]; } Verification

To confirm that the configuration is working properly, perform these tasks:

Verifying That Q-in-Q Tunneling Was Enabled Verifying That Q-in-Q Tunneling Was Enabled Purpose Verify that Q-in-Q tunneling was properly enabled on the switch.

Action Use the show vlans command:


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

Meaning The output indicates that Q-in-Q tunneling is enabled and that the VLAN is tagged and shows the associated customer VLANs.

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

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