wangyu- / udp2raw

A Tunnel which Turns UDP Traffic into Encrypted UDP/FakeTCP/ICMP Traffic by using Raw Socket,helps you Bypass UDP FireWalls(or Unstable UDP Environment)
MIT License
7.17k stars 1.16k forks source link

It's possible to create a VXLAN interface via udp2raw ? #526

Open Wyk72 opened 4 months ago

Wyk72 commented 4 months ago

I have a VPS that has crippled UDP connectivity (i.e. speed limited), but gets full-band on TCP (nobody seem to know why - not even the ISP).

I'd like to use udp2raw for TCP tunneling, but I don't really need L3, I need L2 connectivity.

I've seen examples of wireguard, but I'd like to know if it's possible to use VXLAN directly instead.

I've tried, but I get the "RTNETLINK answers: File exists" error on setting the VXLAN up.

My setup:

server side:

udp2raw -s -l :8443 -r 127.0.0.1:50001 -k "shared secret" -a --raw-mode faketcp

client side:

udp2raw -c -l 127.0.0.1:50002 -r :8443 -k "shared secret" -a --raw-mode faketcp

The tunnel goes up.

But when I create the vxlan with the usual commends, I do not get any link:

Server side:

ip link add nxc0 type vxlan remote 127.0.0.1 id 12 dstport 50001 ip link set dev nxc0 mtu 1300; ip link set nxc0 up ip addr add 192.168.33.1/24 dev nxc0

Client side: ip link add nxc0 type vxlan remote 127.0.0.1 id 12 dstport 50002 ip link set dev nxc0 mtu 1300; ip link set nxc0 up ip addr add 192.168.33.2/24 dev nxc0

But nothing works ....

Any clues ?

wangyu- commented 3 months ago

ip link add nxc0 type vxlan remote 127.0.0.1 id 12 dstport 50001

your command is sending to port 127.0.0.1 50001

udp2raw -s -l :8443 -r 127.0.0.1:50001 -k "shared secret" -a --raw-mode faketcp

but you server is not really listening at 127.0.0.1 50001

it's not suprising if it's not working.

You setup doesn't follow the client-server pattern, nor is it NAT friendly.

I am not familiar with vxlan setup, can not point out a working fix.

But... If you client has public ip as well maybe you can try to setup 2 udp2raw tunnels: one per direction. (not guarenteed to work)

TerenceLiu98 commented 1 month ago

@Wyk72 You may try running the vxlan over some udp-based protocol(e.g. wireguard), then use udp2raw to maintain the wg's connection. I have done this for few years and it works well.