2

I have an ubuntu server behind a router that I am configuring to have a GRE tunnel to another remote device across the interwebs.

in the config, I add the line:

pre-up iptunnel add tun1 mode gre local [local ip] remote [remote ip] ttl 255

Since the ubuntu server is behind a router, should the [local ip] be the wan ip of the router? or the actual local ip of the ethernet interface i wish the tunnel to connect through?

The router the server sits behind doesn't say anywhere anything about forwarding GRE 47 to lan devices, so I just DMZ'd the server (no ideal in product, but I am just testing using GRE to allow for multicast discovery from 1 subnet to another)

Here is the full script (with local ip set as lan ip of ubuntu server)

auto tun1
iface tun1 inet static
    address 10.0.33.1
    netmask 255.255.255.0
    pre-up iptunnel add tun1 mode gre local 192.168.33.72 remote x.x.x.x ttl 255
    up ifconfig tun1 multicast pointopoint 10.0.33.2
    post-down iptunnel del tun1
Zoredache
  • 128,755
  • 40
  • 271
  • 413
michael
  • 307
  • 1
  • 9
  • Just a thought, but you should probably be using [ip](http://linux.die.net/man/8/ip) to configure your tunnel, not iptunnel. The IP docs are better. – Zoredache May 16 '13 at 21:38
  • @Zoredache Do you have links to good tutorials using IP rather than iptunnel? – michael May 16 '13 at 22:02
  • ip should looks like it is very close to iptunnel. The difference is that iptunnel doesn't appear to have any associated man pages. But ip doesn, and see the link in my previous comment. Also see the examples in the LARTC HOWTO. http://www.lartc.org/lartc.html#LARTC.TUNNEL – Zoredache May 16 '13 at 22:38
  • Ya I read that tutorial. It doesn't answer to my main question though. Wan IP or linux box ip in the local ip field. – michael May 16 '13 at 22:49
  • Just a thought. Why not set up a couple VMs and just try it? Did you see the section of the man page that said `local ADDRESS set the fixed local address for tunneled packets. It must be ...`? – Zoredache May 16 '13 at 22:54

1 Answers1

1

The IP is the IP of the server and not the IP of router.
So let say you have 1.2.3.4/24 configured on eth0, with 1.2.3.1 being the the default gw/router, then the command would be:

iptunnel add tun1 mode gre local 1.2.3.4 remote x.x.x.x ttl y
Sandor Marton
  • 1,544
  • 9
  • 12