linux poison RSS
linux poison Email

GRE Tunneling How to

Lets say you have 2 networks that you want to connect to each other. These networks are both connected to the Internet.

So we have network A:

network 10.0.1.0
netmask 255.255.255.0
router 10.0.1.1
Internet 172.16.17.18

and network B:

network 10.0.2.0
netmask 255.255.255.0
router 10.0.2.1
Internet 172.19.20.21

On the router of network A, you do the following:

ip tunnel add B mode gre remote 172.19.20.21 local 172.16.17.18 ttl 255
ip addr add 10.0.1.1 dev B
ip link set B up
ip link set B mtu 1514
ip route add 10.0.2.0/24 dev B

let’s go on with the router of the network B

ip tunnel add A mode gre remote 172.16.17.18 local 172.19.20.21 ttl 255
ip addr add 10.0.2.1 dev A
ip link set A up
ip link set A mtu 1514
ip route add 10.0.1.0/24 dev A

If you want to delete the tunnel.

ip link set B down
ip tunnel del B

Of course, you can replace B with A for the A router


3 comments:

Anonymous said...

can you set up a GRE tunnel between 2 machines in the same network?

Anonymous said...

yes, you can, in this case make both the machine as router and at same time clients.

Anonymous said...

How??

Post a Comment

Related Posts with Thumbnails