wlanslovenija / tunneldigger

L2TPv3 VPN tunneling solution
http://tunneldigger.readthedocs.org/
Other
72 stars 52 forks source link

Understanding tunneldigger vs ip l2tp #82

Closed bennlich closed 5 years ago

bennlich commented 5 years ago

I'm playing around with the ip l2tp tool, trying to understand how this stuff works. I thought I would do a simple test:

sudo ip l2tp add tunnel tunnel_id 3000 peer_tunnel_id 4000 encap udp local 1.2.3.4 remote 5.6.7.8 udp_sport 5000 udp_dport 6000

And I see:

RTNETLINK answers: Cannot assign requested address

What does this RTNETLINK error mean? It seems like it shows up in a lot of cases (I sometimes see it when using tunneldigger too), but I don't have a good understanding of what it really /means/. In this case, I'm thinking my local and remote ips might be unacceptable?

Looking at how tunneldigger creates a tunnel, it passes a socket into create_tunnel, and does not explicitly pass in any local and remote addresses and ports. I haven't dug in any deeper yet, but my hunch is that this socket already describes the those addresses and ports. Is that right?

If there's a better place to post questions like this, please let me know! Thanks.

xbrs1 commented 5 years ago

local 1.2.3.4 -> ip addr of the eth remote 5.6.7.8 -> ip addr of the eth remote peer

unless your local peer has an eth with ip 1.2.3.4 and remote peer with 5.6.7.8 it won't work.

I simple bash i use to bring up l2tpv3, you can use it but adjust to fit your needs.

root@vsrv-bicab-2u:/home/VPN# cat L2TPv3.sh

!/bin/bash

YELLOW='\033[93m' GREEN='\033[92m' END='\033[0m'

echo -e "${GREEN}Removing old L2TPv3 tunnel interface${END}" ip link set l2tpeth0 down ip l2tp del session tunnel_id 101 session_id 1001 ip l2tp del tunnel tunnel_id 101 echo -e "${GREEN}Setting up L2TPv3 tunnel interface${END}" ip l2tp add tunnel tunnel_id 101 peer_tunnel_id 100 \ encap udp local 192.168.0.239 remote 100.80.1.252 \ udp_sport 5000 udp_dport 6000

ip l2tp add session tunnel_id 101 session_id 1001 \ peer_session_id 1000

ip link set l2tpeth0 up mtu 1500

ip addr add 192.168.231.2 peer 192.168.231.1 dev l2tpeth0

ip route add 192.168.231.0/24 dev l2tpeth0

ip l2tp show tunnel

RalfJung commented 5 years ago

@bennlich I am afraid this is not a great place for such questions about ip l2tp. I for once have never used manual l2tp tunnels. I'll leave it open a bit more in case someone stumbles upon this, but have you tried StackOverflow? I'd expect more people to be able to help you there.

bennlich commented 5 years ago

Thanks @RalfJung and @xbrs1! I have yet to try @xbrs1's suggestion.

Once I get a better understanding of whats going on under the hood of ip l2tp and tunneldigger, I might post here for posterity, but will close for now. (And will link to an SO post if/when I make one.)