TransWikia.com

How to configure a GRE tunnel for ubuntu?

Unix & Linux Asked by natf2d on December 6, 2020

I am trying to configure a gre tunnel between two Ubuntu PCs: 1st with wlan1 interface 192.168.1.51 and 2nd with wlan2 192.168.1.2.

PC1:

ip link add gre1 type gretap remote 192.168.1.2 local 192.168.1.51
ip link set dev gre1 up

gre1@NONE: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1462 qdisc pfifo_fast state
UNKNOWN mode DEFAULT group default qlen 1000
link/ether 92:d0:28:8b:3e:a6 brd ff:ff:ff:ff:ff:ff promiscuity 0 
gretap remote 192.168.1.2 local 192.168.1.51 ttl inherit 

PC2:

ip link add gre1 type gretap remote 192.168.1.51 local 192.168.1.2
ip link set dev gre1 up

7: gre1@NONE: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1462 qdisc pfifo_fast
state UNKNOWN mode DEFAULT group default qlen 1000
link/ether ba:09:9a:66:85:02 brd ff:ff:ff:ff:ff:ff promiscuity 0 
gretap remote 192.168.1.51 local 192.168.1.2 ttl inherit 

But when I ping from .51 to .2, I don’t see any GRE encapsulation. It is just going over wlan interface.

PC1:

10.1.0.0/16 dev eth0  proto kernel  scope link  src 10.1.0.51  metric 1 
192.168.1.0/24 dev wlan1  proto kernel  scope link  src 192.168.1.51

One Answer

i know this is an old question, but looking for something else, i found this and decided to answer.

Long story short, it doesn't work that way.

bit longer of an answer: both ends need separate IPs: the tunnel endpoints would get a more different IP than the WLAN addresses. So, you have 192.168.1.0/24 as your main (physical) network. you would then have, say, 10.0.0.0/24 as your virtual (GRE) network. if you give the gre1 interfaces an ip in the 10.0.0.0/24 subnet, and ping then, they will go over GRE links then. watching traffic on the wlan connections should then show you the GRE encapsulation.

Answered by TiernanO on December 6, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP