Gre tunnel between a linux host and Junos Subtitle Summary Contents
http://knol.google.com/k/juniper-hacks/gre-tunnel-between-a-linux-host-and/1xqkuq3r2h459/43
Background
Gre is an industry standard for encapsulating ip traffic within an ip packet. It is often used to send multicast over ipsec tunnels or tunnel ip traffic that is not supported by the transit device. This was tested between a linux host and a Juniper EX 4200T switch, Junos being the same on any device means this config will work regardless of the device running Junos.
Setup
Linux host:
Public Ip: 10.1.1.2/24
Private Ip: 192.168.6.1/24
Gre interface/tunnel endpoint ip: 100.1.1.2/30
Junos device:
Public Ip: 10.1.1.1/24
Private Ip: 192.168.5.1/24
Gre interface/tunnel endpoint ip: 100.1.1.1/30
Configuration
Linux host:
Make sure the gre module is loaded
modprobe ip_gre
Set the ip of the external interface
ifconfig eth0 10.1.1.2/24 up
Set the ip of the internal interface
ifconfig eth1 192.168.6.1/24 up
Create the pseudo interface gretun, you can use any name you want. You define the tunnel endpoints.
iptunnel add gretun mode gre remote 10.1.1.2 remote 10.1.1.1
Set the gretun to be up
ip link set gretun up
Assign gre interface ip
ip addr add 100.1.1.2/30 dev gretun
Set the route to the remote private network, all traffic from behind the linux host destined for the private subnet of the Junos device will be encapsulated in gre.
ip route add 192.168.5.0/24 dev gretun
Junos device:
Set the ip of the external interface
set interfaces ge-0/0/0 unit 0 family inet address 10.1.1.1/30
Set the ip of the internal interface
set interfaces ge-0/0/1 unit 0 family inet address 192.168.5.1/24
Set the local tunnel endpoint
set interfaces gre unit 0 tunnel source 10.1.1.1
Set the remote tunnel endpoint
set interfaces gre unit 0 tunnel destination 10.1.1.2
Set the ip of the gre interface
set interfaces gre unit 0 family inet address 100.1.1.1/32
Set route to the remote private subnet
set routing-options static route 192.168.6.0/24 next-hop gre.0
Commit
commit
You should now be able to ping between hosts behind the linux and junos devices, provided their routing is configured correctly.
Comments Write New Comment ▼ Write New Comment Submit comment to this knol Sorry! This knol's owner(s) have blocked you from editing, making suggestions, or commenting here. Sign in to write a comment Rui Bernardo another config 1st of all, thanks for your config. this is my config (also works with gre): pt101447@oliva:r5# show interfaces lo0 unit 5 | display set set logical-routers r5 interfaces lo0 unit 5 family inet address 10.0.3.5/32 [edit] pt101447@oliva:r5# show interfaces ipip | display set set logical-routers r5 interfaces ipip unit 5 tunnel source 10.0.3.5 set logical-routers r5 interfaces ipip unit 5 tunnel destination 10.0.2.10 set logical-routers r5 interfaces ipip unit 5 family inet address 10.5.0.1/24 [edit] pt101447@oliva:r5# run ping 10.5.0.2 PING 10.5.0.2 (10.5.0.2): 56 data bytes