GRE tunnel for public IP

Hello everyone.
I need help for configuring a GRE tunnel that I will use to obtain another public IPv4 and IPv6

I have :

  • The endpoint of the tunnel : a public IPv4 adresse of my provider
  • The IPv4 I'm given by my provider : another public IPv4, and an IPv6 /48
  • The IPv4 for interconnexion for the tunnel : 10.0.1.145 for my provider side and 10.0.1.146 for my side
  • The same for IPv6

I managed to ping 10.0.1.145 (my provider side of the tunnel) with this network configuration :
I have to install "gre", "kmod-gre", "kmod-gre6". But I also have to install "kmod-nathelper-extra" and I don't understand why.

config interface 'tunnel'
        option proto    'gre'
        option zone     'tunnels'
        option peeraddr 'PublicIPv4endpoint'
 
config interface 'provider'
        option proto    'static'
        option ifname   '@tunnel'
        option ipaddr   '10.0.1.146'
        option netmask  '255.255.255.252'

Now I don't know how to integrate/configure my public IPv4 my provider give me.
I tried to configure another static interface with my public IPv4 and with 10.0.1.145 as gataway with the interface "tunnel" as hardware, and also tried with interface "provider" as hardware, but this doesn't work.

Does someone know how to configure this ? (first for IPv4 and after I will try to configure IPv6)
Many thaks

In mygre use the wan IP from your side and the endpoint of your provider.
In mygre_static use the IPs for interconnection.
Add a default route over the GRE.
SNAT outgoing traffic to your public IPv4. Use the /48 as delegated prefix.

2 Likes

Here is my configuration that's working to get a public IPv4 and a /48 IPv6 from my provider via a GRE tunnel :
/etc/config/network :

config interface 'tunnel'
	option proto 'gre'
	option peeraddr 'IPendpoint'
	option mtu '1476' #MTU at 1476 because I'm on a GRE tunnel over IPv4 with a MTU at 1500

config interface 'interco'
	option proto 'static'
	option ifname '@tunnel'
	option ipaddr '10.1.0.246' #IPv4 of interconnexion, client side
	option netmask '255.255.255.252'
	list ip6addr '2a0b:cbc0:x::xxx/126' #IPv6 of interconnexion, client side
	option mtu '1476' #MTU at 1476 because I'm on a GRE tunnel over IPv4 with a MTU at 1500

config interface 'interfacename'
	option proto 'static'
	option ipaddr 'IPv4fromProvider' #if your provider give you a public IPv4
	option netmask '255.255.255.255' #if your provider give you a public IPv4
	option gateway '10.1.0.245' #if your provider give you a public IPv4 : #IPv4 of interconnexion, provider side
	option ifname '@tunnel'
	option ip6prefix '2axx:xxxx:xxx::/48' # IPv6 bloc that is provided for you
	option ip6gw '2a0b:cbc0:x::xxx' #IPv6 of interconnexion, client side
	list ip6addr '2a0e:e70x:xxx::x/64' #one IPv6 from the /48
	option mtu '1476' #MTU at 1476 because I'm on a GRE tunnel over IPv4 with a MTU at 1500

/etc/config/firewall :

config zone
	option forward 'REJECT'
	option name 'interfacename'
	option output 'ACCEPT'
	option input 'REJECT'
	option network 'tunnel interco interfacename'

config forwarding
	option dest 'interfacename'
	option src 'lan'

config nat #if your provider gives you an public IPv4, this SNAT ruler changes the interconnexion IPv4 into the public IPv4
	option src 'interfacename'
	option name 'nameoftherule'
	option target 'SNAT'
	option snat_ip 'IPv4fromProvider'
	list proto 'all'

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.