> For the complete documentation index, see [llms.txt](https://netlabs.gitbook.io/juniper/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://netlabs.gitbook.io/juniper/13-tunneling-technologies-ipip-gre/konfiguracii-ustroistv.md).

# Конфигурации устройств

## IPIP

{% tabs %}
{% tab title="Router-1" %}

```
system {
    host-name Router-1;
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 192.168.5.1/24;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.1.0/31;
            }
        }
    }
}                                       
routing-options {
    router-id 1.1.1.1;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface ge-0/0/0.0 {
                passive;
            }
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
        }
    }
}
```

{% endtab %}

{% tab title="Site-1" %}

```
system {
    host-name Site-1;
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
}
chassis {
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 2.2.2.1/30;
            }
        }
    }                                   
    ip-0/0/0 {
        unit 0 {
            tunnel {
                source 2.2.2.1;
                destination 4.4.4.1;
            }
            family inet {
                address 10.10.10.1/24;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.1.1/31;
            }
        }
    }
}
routing-options {
    static {
        route 0.0.0.0/0 next-hop 10.10.10.2;
        route 4.4.4.1/32 next-hop 2.2.2.2;
    }
    router-id 1.1.1.2;
}
protocols {
    ospf {
        export static-in-ospf;
        area 0.0.0.0 {
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
            interface ge-0/0/0.0 {
                passive;
            }
        }
    }
}
policy-options {
    policy-statement static-in-ospf {
        from {
            protocol static;
            route-filter 0.0.0.0/0 exact;
        }
        then accept;                    
    }
}
```

{% endtab %}

{% tab title="Internet" %}

```
hostname Internet
interface Ethernet0/0
 ip address 2.2.2.2 255.255.255.252
 !
interface Ethernet0/1
 ip address 4.4.4.2 255.255.255.252
 !
```

{% endtab %}

{% tab title="Site-2" %}

```
system {
    host-name Site-2;
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
}
chassis {
    aggregated-devices {
        ethernet {
            device-count 1;
        }
    }
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {                        
            family inet {
                address 4.4.4.1/30;
            }
        }
    }
    ip-0/0/0 {
        unit 0 {
            tunnel {
                source 4.4.4.1;
                destination 2.2.2.1;
            }
            family inet {
                address 10.10.10.2/24;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.2.1/31;
            }
        }
    }                                   
}
routing-options {
    static {
        route 0.0.0.0/0 next-hop 10.10.10.1;
        route 2.2.2.1/32 next-hop 4.4.4.2;
    }
    router-id 2.2.2.22;
}
protocols {
    ospf {
        export static-in-ospf;
        area 0.0.0.0 {
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
            interface ge-0/0/0.0 {
                passive;
            }
        }
    }
}
policy-options {
    policy-statement static-in-ospf {   
        from {
            protocol static;
            route-filter 0.0.0.0/0 exact;
        }
        then accept;
    }
}
```

{% endtab %}

{% tab title="Router-2" %}

```
system {
    host-name Router-2;
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 192.168.6.1/24;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.2.0/31;
            }
        }
    }
}                                       
routing-options {
    router-id 2.2.2.2;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface ge-0/0/0.0 {
                passive;
            }
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
Далее будут приводится только настройки тех устройств, конфигурация которых изменилась, относительно предыдущего пункта.
{% endhint %}

## IGP Over GRE

{% tabs %}
{% tab title="Site-1" %}

```
system {
    host-name Site-1;
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
}
chassis {
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 2.2.2.1/30;
            }
        }
    }                                   
    gr-0/0/0 {
        unit 0 {
            tunnel {
                source 2.2.2.1;
                destination 4.4.4.1;
            }
            family inet {
                address 10.10.10.1/24;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.1.1/31;
            }
        }
    }
}
routing-options {
    static {
        route 4.4.4.1/32 next-hop 2.2.2.2;
    }                                   
    router-id 1.1.1.2;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
            interface ge-0/0/0.0 {
                passive;
            }
            interface gr-0/0/0.0 {
                interface-type p2p;
            }
        }
    }
}
```

{% endtab %}

{% tab title="Site-2" %}

```
system {
    host-name Site-2;
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
}
chassis {
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {                        
            family inet {
                address 4.4.4.1/30;
            }
        }
    }
    gr-0/0/0 {
        unit 0 {
            tunnel {
                source 4.4.4.1;
                destination 2.2.2.1;
            }
            family inet {
                address 10.10.10.2/24;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.2.1/31;
            }
        }
    }                                   
}
routing-options {
    static {
        route 2.2.2.1/32 next-hop 4.4.4.2;
    }
    router-id 2.2.2.22;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
            interface ge-0/0/0.0 {
                passive;
            }
            interface gr-0/0/0.0 {
                interface-type p2p;
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

## IPv6 Over IPv4

{% tabs %}
{% tab title="Site-1" %}

```
system {
    root-authentication {
        encrypted-password "$1$PpJTV8Ab$qCsraT99bfEvcqaypRFFw."; ## SECRET-DATA
    }
    host-name Site-1;
}
chassis {
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 2.2.2.1/30;
            }
        }
    }                                   
    gr-0/0/0 {
        unit 0 {
            tunnel {
                source 2.2.2.1;
                destination 4.4.4.1;
            }
            family inet6 {
                address 2000::1/64;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet6 {
                address 2001::1/64;
            }                           
        }
    }
}
routing-options {
    static {
        route 4.4.4.1/32 next-hop 2.2.2.2;
    }
    router-id 1.1.1.2;
}
protocols {
    ospf3 {
        area 0.0.0.0 {
            interface lo0.0 {
                passive;
            }
            interface gr-0/0/0.0 {
                interface-type p2p;
            }
        }
    }
}
```

{% endtab %}

{% tab title="Site-2" %}

```
system {
    root-authentication {
        encrypted-password "$1$PpJTV8Ab$qCsraT99bfEvcqaypRFFw."; ## SECRET-DATA
    }
    host-name Site-2;
}
chassis {
    aggregated-devices {
        ethernet {
            device-count 1;
        }
    }
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {                        
            family inet {
                address 4.4.4.1/30;
            }
        }
    }
    gr-0/0/0 {
        unit 0 {
            tunnel {
                source 4.4.4.1;
                destination 2.2.2.1;
            }
            family inet6 {
                address 2000::2/64;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet6 {
                address 2002::1/64;
            }
        }
    }
}
routing-options {
    static {
        route 2.2.2.1/32 next-hop 4.4.4.2;
    }
    router-id 2.2.2.22;
}
protocols {
    ospf3 {
        area 0.0.0.0 {
            interface gr-0/0/0.0 {
                interface-type p2p;
            }
            interface lo0.0 {
                passive;
            }
        }
    }
}
```

{% endtab %}
{% endtabs %}

## L2 Over GRE

{% tabs %}
{% tab title="Router-1" %}

```
system {
    host-name Router-1;
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family bridge {
                interface-mode access;
                vlan-id 10;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family bridge {
                interface-mode trunk;
                vlan-id-list 10;
            }
        }                               
    }
}
bridge-domains {
    v10 {
        vlan-id 10;
    }
}
```

{% endtab %}

{% tab title="Site-1" %}

```
system {
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
    host-name Site-1;
}
chassis {
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
    network-services enhanced-ip;
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 2.2.2.1/30;
            }
        }
    }                                   
    gr-0/0/0 {
        unit 0 {
            tunnel {
                source 2.2.2.1;
                destination 4.4.4.1;
            }
            family bridge {
                interface-mode trunk;
                vlan-id-list 10;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family bridge {
                interface-mode trunk;
                vlan-id-list 10;
            }
        }
    }
}
routing-options {
    static {                            
        route 4.4.4.1/32 next-hop 2.2.2.2;
    }
}
routing-instances {
    v10 {
        instance-type virtual-switch;
        interface gr-0/0/0.0;
        interface ge-0/0/1.0;
        bridge-domains {
            v10 {
                vlan-id 10;
            }
        }
    }
}
```

{% endtab %}

{% tab title="Internet" %}

```
hostname Internet
interface Ethernet0/0
 ip address 2.2.2.2 255.255.255.252
 !
interface Ethernet0/1
 ip address 4.4.4.2 255.255.255.252
 !
```

{% endtab %}

{% tab title="Site-2" %}

```
system {
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
    host-name Site-2;
}
chassis {
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
    network-services enhanced-ip;
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 4.4.4.1/30;
            }
        }
    }                                   
    gr-0/0/0 {
        unit 0 {
            tunnel {
                source 4.4.4.1;
                destination 2.2.2.1;
            }
            family bridge {
                interface-mode trunk;
                vlan-id-list 10;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family bridge {
                interface-mode trunk;
                vlan-id-list 10;
            }
        }
    }
}
routing-options {
    static {                            
        route 2.2.2.1/32 next-hop 4.4.4.2;
    }
}
routing-instances {
    v10 {
        instance-type virtual-switch;
        interface gr-0/0/0.0;
        interface ge-0/0/1.0;
        bridge-domains {
            v10 {
                vlan-id 10;
            }
        }
    }
}
```

{% endtab %}

{% tab title="Router-2" %}

```
system {
    host-name Router-2;
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family bridge {
                interface-mode access;
                vlan-id 10;
            }
        }
    }
    ge-0/0/1 {
        unit 0 {
            family bridge {
                interface-mode trunk;
                vlan-id-list 10;
            }
        }                               
    }
}
bridge-domains {
    v10 {
        vlan-id 10;
    }
}
```

{% endtab %}
{% endtabs %}

## MPLS Over GRE

{% tabs %}
{% tab title="Router-1" %}

```
system {
    host-name Router-1;
    root-authentication {
        encrypted-password "$1$PpJTV8Ab$qCsraT99bfEvcqaypRFFw."; ## SECRET-DATA
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 192.168.5.1/24;
            }
            family mpls;
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.1.0/31;
            }
            family mpls;
        }                               
    }
    lo0 {
        unit 0 {
            family inet {
                address 1.1.1.1/32;
            }
            family mpls;
        }
    }
}
routing-options {
    router-id 1.1.1.1;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface ge-0/0/0.0 {
                passive;
            }
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
            interface lo0.0 {           
                passive;
            }
        }
    }
    ldp {
        interface all;
    }
}
```

{% endtab %}

{% tab title="Site-1" %}

```
system {
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
    host-name Site-1;
}
chassis {
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 2.2.2.1/30;
            }
        }
    }
    gr-0/0/0 {                          
        unit 0 {
            tunnel {
                source 2.2.2.1;
                destination 4.4.4.1;
            }
            family inet {
                address 10.10.10.1/24;
            }
            family mpls;
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.1.1/31;
            }
            family mpls;
        }
    }
    lo0 {
        unit 0 {
            family inet {
                address 1.1.1.2/32;     
            }
            family mpls;
        }
    }
}
routing-options {
    static {
        route 4.4.4.1/32 next-hop 2.2.2.2;
    }
    router-id 1.1.1.2;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
            interface ge-0/0/0.0 {
                passive;
            }
            interface gr-0/0/0.0 {
                interface-type p2p;
            }                           
            interface lo0.0 {
                passive;
            }
        }
    }
    ldp {
        interface all;
    }
}
```

{% endtab %}

{% tab title="Internet" %}

```
hostname Internet
interface Ethernet0/0
 ip address 2.2.2.2 255.255.255.252
 !
interface Ethernet0/1
 ip address 4.4.4.2 255.255.255.252
 !
```

{% endtab %}

{% tab title="Site-2" %}

```
system {
    root-authentication {
        encrypted-password "$1$g0.ilY2l$BWxgrwnnTkf5/ZR3HZpVQ1"; ## SECRET-DATA
    }
    host-name Site-2;
}
chassis {
    fpc 0 {
        pic 0 {
            tunnel-services;
        }
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 4.4.4.1/30;
            }
        }
    }
    gr-0/0/0 {                          
        unit 0 {
            tunnel {
                source 4.4.4.1;
                destination 2.2.2.1;
            }
            family inet {
                address 10.10.10.2/24;
            }
            family mpls;
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.2.1/31;
            }
            family mpls;
        }
    }
    lo0 {
        unit 0 {
            family inet {
                address 2.2.2.22/32;    
            }
            family mpls;
        }
    }
}
routing-options {
    static {
        route 2.2.2.1/32 next-hop 4.4.4.2;
    }
    router-id 2.2.2.22;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
            interface ge-0/0/0.0 {
                passive;
            }
            interface gr-0/0/0.0 {
                interface-type p2p;
            }                           
            interface lo0.0 {
                passive;
            }
        }
    }
    ldp {
        interface all;
    }
}
```

{% endtab %}

{% tab title="Router-2" %}

```
system {
    host-name Router-2;
    root-authentication {
        encrypted-password "$1$WWHrtbvC$LheWkevlddegEGfLxNNYi0"; ## SECRET-DATA
    }
}
interfaces {
    ge-0/0/0 {
        unit 0 {
            family inet {
                address 192.168.6.1/24;
            }
            family mpls;
        }
    }
    ge-0/0/1 {
        unit 0 {
            family inet {
                address 172.16.2.0/31;
            }
            family mpls;
        }                               
    }
    lo0 {
        unit 0 {
            family inet {
                address 2.2.2.2/32;
            }
            family mpls;
        }
    }
}
routing-options {
    router-id 2.2.2.2;
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface ge-0/0/0.0 {
                passive;
            }
            interface ge-0/0/1.0 {
                interface-type p2p;
            }
            interface lo0.0 {           
                passive;
            }
        }
    }
    ldp {
        interface all;
    }
}
```

{% endtab %}
{% endtabs %}
