Score:0

SSH Ethernet Forwarding Does Not Seem to be Working

at flag

I have Ubuntu 22.04 on both the client and server. I have set PermitTunnel yes in sshd_config in both the client (I might not need it on the client) and the server. I have also set Tunnel yes and TunnelDevice any:any in the ssh_config in both the client and the server (I might not need it in the server), and ensured that the server is restarted after the configuration has been applied. I have setup a TAP device on both ends, named tap0, using the following command ran in both ends:

ip tuntap add dev tap0 mode tap

Then, on the root account in my client machine, I SSH'd into the root account of my server machine using the following command:

ssh -w 0:0 root@<my server> -p <ssh port>

However, I do not seem to be able to get any of the TAP adapters to be UP (i.e. it doesn't seem that SSH is using the TAP adapters in any of the ends). I have ran the following command in both ends, and found that the state of the TAP adapters are still DOWN:

ip link show tap0

output:

30: tap0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether 6e:ff:d7:19:ee:b2 brd ff:ff:ff:ff:ff:ff

This means I cannot also ping any of the devices on any of the ends (I tried setting a static IP on both ends and no luck).

I have also tried the latest Fedora for the server side as well, and found the same output.

I am not sure what am I missing here, and would love some help.

P.S. The server is is server ISO VirtualBox VM, and I am SSHing into it using NAT port forwarding of the guest's 22 port to some host port.

Score:1
cn flag

You need to explicitly set the Tunnel argument to ethernet not just yes to get layer 2 tunneling.

From the ssh_config man page.

Tunnel

Request tun(4) device forwarding between the client and the
server. The argument must be yes, point-to-point (layer 3),
ethernet (layer 2), or no (the default). Specifying yes requests the default tunnel mode, which is point-to-point

user7484496 avatar
at flag
This seem to have worked: `ssh -o Tunnel=ethernet -o TunnelDevice=0:0 -w 0:0 -p <server port> root@<server host>`. Thank you very much. You are awesome!
user7484496 avatar
at flag
I want to clarify part of the root cause I have discovered, though. It seems that `-o` arguments must exist before `-w` argument for it to work. Can you please add it as part of the answer to have a complete answer for everyone who stumbles upon the same problem? Your original answer is part of the full answer, but it is also missing the ordering of the commands.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.