Tuesday, January 24, 2012

Configure a GRE tunnel in JUNOS.


How to: Configure a GRE tunnel in JUNOS.


SUMMARY:
How to: Configure a GRE tunnel in JUNOS.
PROBLEM OR GOAL:
How do I configure a GRE tunnel on a JUNOS router.
SOLUTION:
Items to consider when creating a GRE tunnel.
  1. Configure a GR interface and make sure it is up.
  2. Check that the tunnel end-point is in the route table and is reachable.
  3. Make sure that there is a route for the destination subnet that will make use of the GRE-Tunnel. This is accomplished in our example via the static definition using the gr-interface as the next-hop.
Example:
interfaces {
    fe-0/0/0 {
        unit 0 {
            family inet {
                address 10.1.1.1/30;
            }
        }
    }
    gr-0/0/0 {
        unit 0 {
            tunnel {
                source 10.1.1.1;
                destination 10.1.1.2;
            }
            family inet {
                address 100.1.1.1/32;
            }
        }
    }
}
routing-options {
    static {
        route 2.2.2.0/24 next-hop gr-0/0/0.0;
    }
}


Testing: 
1. Verify the GR interfaces are up.
[edit]
[email protected]run show interfaces terse |match gr 
gr-0/0/0 up up 
gr-0/0/0.0 up up inet 100.1.1.1 --> 0/0
gre up up 
2. Verify tunnel destinations are in local route table:
[edit]
[email protected]run show route 10.1.1.2 
inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.1.1.0/30 *[Direct/0] 01:04:33
> via fe-0/0/0.0
3. Verify the route for the destination network that is reachable through the gre-tunnel:
[edit]
[email protected]run show route 2.2.2.0/24 
inet.0: 11 destinations, 11 routes (11 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

2.2.2.0/24 *[Static/5] 00:22:32
> via gr-0/0/0.0
4. Ping a destination address through the tunnel
[edit]
[email protected]run clear interfaces statistics all 
[email protected]# ... 1.1.1.2 rapid count 100 
PING 2.2.2.2 (2.2.2.2): 56 data bytes
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--- 2.2.2.2 ping statistics ---
100 packets transmitted, 100 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.831/1.033/10.033/1.286 ms

[edit]
[email protected]run show interfaces gr-0/0/0 extensive 
Physical interface: gr-0/0/0, Enabled, Physical link is Up
Interface index: 134, SNMP ifIndex: 40, Generation: 17
Type: GRE, Link-level type: GRE, MTU: Unlimited, Speed: 800mbps
Hold-times : Up 0 ms, Down 0 ms
Device flags : Present Running
Interface flags: Point-To-Point SNMP-Traps
Statistics last cleared: 2005-08-05 21:39:41 UTC (00:00:47 ago)
Traffic statistics:
Input bytes : 8400 0 bps
Output bytes : 8400 0 bps
Input packets: 100 0 pps
Output packets: 100 0 pps

Logical interface gr-0/0/0.0 (Index 72) (SNMP ifIndex 28) (Generation 17)
Flags: Point-To-Point SNMP-Traps 16384
IP-Header 10.1.1.2:10.1.1.1:47:df:64:0000000000000000
Encapsulation: GRE-NULL
Traffic statistics:
Input bytes : 8400
Output bytes : 8400
Input packets: 100
Output packets: 100
Local statistics:
Input bytes : 0
Output bytes : 0
Input packets: 0
Output packets: 0
Transit statistics:
Input bytes : 8400 0 bps
Output bytes : 8400 0 bps
Input packets: 100 0 pps
Output packets: 100 0 pps
Protocol inet, MTU: 1476, Generation: 25, Route table: 0
Flags: None
Addresses, Flags: Is-Primary
Destination: Unspecified, Local: 100.1.1.1, Broadcast: Unspecified,
Generation: 30
RELATED LINKS: 

No comments: