0

I'm trying to create a SSH tunnel between 2 Raspberry PI's both running Debian Bookworm. I try to establish the connection using the command sudo ssh -w0:0 <user>@<ip> -p<ssh port> true

But it fails with

...
debug1: Requesting tun unit 0 in mode 1
debug1: sys_tun_open: failed to configure tunnel (mode 1): Invalid argument
Tunnel device open failed.
Could not request tunnel forwarding.
debug1: channel 0: new session [client-session] (inactive timeout: 0)
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting [email protected]
debug3: send packet: type 80
debug1: Entering interactive session.
...

I've changed the below config files

/etc/ssh/sshd_config

PermitTunnel yes
/etc/ssh/ssh_config

Tunnel point-to-point
/etc/sysctl.conf

net.ipv4.ip_forward = 1

The tun0 interface is created on both devices using sudo nmtui

tun0: flags=209<UP,POINTOPOINT,RUNNING,NOARP>  mtu 1480
        inet <local ip>  netmask 255.255.255.252  destination <remote ip>
        tunnel   txqueuelen 1000  (IPIP Tunnel)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Can anybody help me getting this error fixed?

4
  • ssh port forwarding is completely different from kernel packet routing - it doesn't need net.ipv4.ip_forward = 1
    – symcbean
    Commented Jun 8 at 9:29
  • I'm not trying to do port forwarding. I'm trying to route 2 networks together through a SSH tunnel, but I can't get the tunnel to work.
    – user613537
    Commented Jun 8 at 9:31
  • Unless there is at least one other host in the desired end-state there is no requirement to set net.ipv4.ip_forward
    – symcbean
    Commented Jun 8 at 10:50
  • As I wrote. I'm trying to route entire networks together, so off course there are multiple hosts on both side of the tunnel, which means port forward will not work and IP forward is required.
    – user613537
    Commented Jun 8 at 11:39

0

You must log in to answer this question.

Browse other questions tagged .