udp2raw icon indicating copy to clipboard operation
udp2raw copied to clipboard

udp2raw screen on server side keeps terminating!

Open Iman-Sh opened this issue 1 year ago • 6 comments

Hi every one, i'm using udp2raw to tunnel both of my servers using screen command and it works amazing but the tunnel in server side keeps terminating a lot and i have to run the command again to make to tunnel work, so is there a way to automatically restart the server side tunnel when udp2raw screen gets terminated? and how can i figure out what is causing the termination? is there any log?

screen ./udp2raw_amd64 -s -l0.0.0.0:4096 -r127.0.0.1:7777 -k "pass" --raw-mode icmp --log-level 5 -a

screen ./udp2raw_amd64 -c -l0.0.0.0:3333 -r"serverIp":4096 -k "pass" --raw-mode icmp --log-level 5 -a

please let me know if you need more info.

Iman-Sh avatar Jun 17 '24 15:06 Iman-Sh

You can use the docker image: jearton1024/udp2raw

jearton avatar Jun 18 '24 18:06 jearton

You can use the docker image: jearton1024/udp2raw

ty for your comment, i used the container with this command on server side: docker run -d \ --name udp2raw_client \ --cap-add NET_ADMIN \ -p 4096:4096/udp \ -p 7777:7777/udp \ -e LISTEN_PORT=4096 \ jearton1024/udp2raw:latest \ -s -l0.0.0.0:4096 \ -r127.0.0.1:7777\ -k "pswd" \ --raw-mode icmp -a looks ok based on the info that it prints but client cant reach the server and keeps sending handshake and server gets nothing. 1

Iman-Sh avatar Jun 20 '24 15:06 Iman-Sh

@Iman-Sh My best pracetice #531

First start the server-side

Caution: you should use host network on the server-side

use docker compose

services:
  udp2raw_server:
    image: jearton1024/udp2raw:latest
    container_name: udp2raw_server
    restart: unless-stopped
    network_mode: host
    cap_add:
      - NET_ADMIN
    environment:
      - LISTEN_PORT= 4096
    command: >
      -s
      -l0.0.0.0:4096
      -r127.0.0.1:32884
      -k "<password>"
      --raw-mode faketcp
      --fix-gro
      -a

or user docker cli

docker run -d \
  --name udp2raw_server \
  --restart unless-stopped \
  --network host \
  --cap-add NET_ADMIN \
  -e LISTEN_PORT=4096 \
  jearton1024/udp2raw:latest \
  -s \
  -l0.0.0.0:4096 \
  -r127.0.0.1:32884 \
  -k "<password>" \
  --raw-mode faketcp \
  --fix-gro \
  -a

Note that 32884 is the wireguard peer listen port.

Then start the client-side

use docker compose

services:
  udp2raw_client:
    image: jearton1024/udp2raw:latest
    container_name: udp2raw_client
    restart: unless-stopped
    ports: 
      - 51820:51820
    cap_add:
      - NET_ADMIN
    environment:
      - LISTEN_PORT=51820
    command: >
      -c
      -l0.0.0.0:51820
      -r<remote ip>:4096
      -k "<password>"
      --raw-mode faketcp
      -a

or user docker cli

docker run -d \
  --name udp2raw_client \
  --restart unless-stopped \
  -p 51820:51820 \
  --cap-add NET_ADMIN \
  -e LISTEN_PORT=51820 \
  jearton1024/udp2raw:latest \
  -c \
  -l0.0.0.0:51820 \
  -r<remote host>:4096 \
  -k "<password>" \
  --raw-mode faketcp \
  --fix-gro \
  -a

jearton avatar Jun 25 '24 09:06 jearton

well, this is a linux question instead of a udp2raw question. I suggest to google and solve the problem by yourself.

But... As a friendly reminder:

If you want a simpler solution than docker, you can use either:

nohup

nohup ./udp2raw_amd64 -c -l0.0.0.0:3333 -r"serverIp":4096 -k "pass" --raw-mode icmp --log-level 5 -a &

tmux

tmux 
./udp2raw_amd64 -c -l0.0.0.0:3333 -r"serverIp":4096  -k "pass" --raw-mode icmp --log-level 5 -a (run inside tmux)
(then you are safe to close the ssh)

when ever you want to recall the terminal, you can use tmux attach

wangyu- avatar Jun 25 '24 20:06 wangyu-

well, this is a linux question instead of a udp2raw question. I suggest to google and solve the problem by yourself.

But... As a friendly reminder:

If you want a simpler solution than docker, you can use either:

nohup

nohup ./udp2raw_amd64 -c -l0.0.0.0:3333 -r"serverIp":4096 -k "pass" --raw-mode icmp --log-level 5 -a &

tmux

tmux 
./udp2raw_amd64 -c -l0.0.0.0:3333 -r"serverIp":4096  -k "pass" --raw-mode icmp --log-level 5 -a (run inside tmux)
(then you are safe to close the ssh)

when ever you want to recall the terminal, you can use tmux attach

the problem is not the ssh session because i've used the command inside a screen, i've used tmux before as a replacement for screen but tunnel on server side keeps terminating no matter which one i'm using. how can i get a log to see what is causing the termination?

Iman-Sh avatar Jun 27 '24 13:06 Iman-Sh

the problem is not the ssh session because i've used the command inside a screen, i've used tmux before as a replacement for screen but tunnel on server side keeps terminating no matter which one i'm using.

From you description, I cannot tell whether it's your screen quit unexpectly or your udp2raw quit unexpectly.

if you want to debug

if your screen is still alive, only udp2raw quits. You can recover the screen session and see logs if it's the case 1. udp2raw quit itself bc of some error 2. udp2raw crash.

if you want to keep udp2raw alive

check https://github.com/wangyu-/udp2raw/wiki/keep-udp2raw-alive

wangyu- avatar Jun 28 '24 00:06 wangyu-