How to access Rpi via ssh to WSL2 in window 10 - wsl-2

I tried to access WSL2 from raspberry pi by ssh
I watch this video clip however I can not
https://www.youtube.com/watch?v=yCK3easuYm4&t=727s
First in Rpi to wsl2
ssh user#192.168.0.1 -p 3000
and wsl2 to Rpi
in PowerShell
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=3000 connectaddress=192.168.240.40(wsl2) connectport=3000
and I fix the /etc/ssh/sshd_config
Port 3000
ListenAddress 0.0.0.0
However, I got an error in Rpi
--> ssh_exchange_identification: read: Connection reset by peer
Do I have something wrong!

Add a rule to allow the port in Windows Firewall
inbound rule > +new rule > port > {tcp or udp, 3000}

Related

How to mount Azure File Share in an environment where port 445 is blocked

I'm trying to mount an Azure File Share in an environment where the Proxy settings block port 445 for the global IP address.
As shown in the figure below, port forwarding is done with Azure Virtual Matchine (Linux), connecting to localhost: 1445, and 445 communication to Azure File Share is possible.
However, the mount command cannot use any port other than 445.
I have set the netsh interface portproxy to forward communication on port 445 to localhost: 1445, but the port on 445 does not listen.
$ netsh interface portproxy add v4tov4 listenport = 445 listenaddr = xxx-storage.file.core.windows.net connectport = 1445 connectaddress = 127.0.0.1
$ netstat -ano | findstr: 445
How to mount Azure File Share in an environment where port 445 is blocked?
Also, File Sync cannot be used in my environment.
I have not tried this scenario but you might be able to accomplish this with SSH local port forwarding. The key is if your proxy is blocky localhost connections to port 445.
ssh -L 127.0.0.1:445:FILE_SHARE_URL:445 YOUR_LINUX_BOX_IP
Forwarding (AllowTcpForwarding) needs to be enabled on the Linux SSH server (the jump host).
Server-Side Configuration
I think you also will need to enable the Linux VM IP forwarding but I am not sure.
Since the software will be connecting to port 445 on localhost (127.0.0.1) most firewalls ignore that connection. Then the connection on port 445 is forwarded over SSH which the firewall cannot see. The Linux jump host then opens a connection to the FILE_SHARE_URL.
Local Forwarding

How to enable inbound connection for a particular port in windows 10?

in windows 10 IoT i want to accept TCP packets on a port (eg:- 49856) from a remote machine.
You can have a try the following command:
netsh advfirewall firewall add rule name="Open mongod port 49856" dir=in action=allow protocol=TCP localport=49856

cannot open up port using iptables to use rstudio server

I am currently trying to open port 8787 for rstudio server. I have set this up on an ubuntu host, and want to point my browser at the ip address of the ubuntu host, using port 8787 to direct it to rstudio. I can do this from the host machine, but no such luck using a different computer.
When I do
netstat - peantl | grep ":8787"
I get nothing returned, unlike when checking port 22 which is confirmed as listening. I can there ssh from external machines into the ubuntu host.
So I tried to open up port 8787 with iptables:
sudo iptables -A INPUT -p tcp --dport 8787 -j ACCEPT
command runs fine, but then re-checking with netstat I still do not get any output (I was expecting similar output to port 22 as mentioned previously)
I also allowed port 8787 on ufw:
sudo ufw allow 8787
using gufw it confirms port 8787 is open.
What could be the issue? If my network has restricted port 8787 how can I tell? Am I allowing port 8787 correctly with iptables?
Thanks.
All your iptables and ufw commands are doing is opening ports in the firewall itself. The fact that there is no output from the netstat|grep line means that the rstudio software does not actually have the port open for anyone to connect to. This is the issue you need to fix first.

SSH Permission denied for Mininet

I am new to SDN and was trying to learn Mininet. I have installed debian(64-bit) and Mininet on Virtual Box. When I try to connect Mininet Vm from Debian I have to run the following comamnd :
ssh -X mininet#10.0.2.15
It asks for mininet password, but after entering the default mininet password it shows an error
Permission denied please try again
Both my debian and Mininet VM have same IP address. Kindly guide how to eliminate the SSHerror. Also is it fine having same ip address for two different VM, is the SSH error a result of this ?
Thanks
In the VirtualBox settings under the tab Network click on Advanced then Port Forwarding and add a rule with name: ssh, protocol: tcp, host port: 3022 and guest port: 22. Then execute:
sudo ssh -p 3022 mininet#10.0.2.15

Cannot connect to google compute engine virtual machine by vnc

I have created a debian wheezy virtual machine in google compute engine but I am unable to connect to it with vnc.
Here is what I have done
Installed gnome and the rebooted the VM
install tightvncserver and started it
I have tried to connect using the static ip that I've attached to the VM but I'm getting the error: "the connection was refused by the host computer".
I thought it was the firewall that was the issue so I disabled iptable using the following commands
$ sudo iptables-save > /root/firewall.rules
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
and I have created rules in google firewall to allow ports 0-65535 for tcp and udp but it still does not work.
Anyone knows how to do it?
Thanks in advance
By default, all incoming traffic from outside a network is blocked and no packet is allowed into an instance without an appropriate firewall rule. To allow incoming network traffic, you need to set up firewall rules to permit these connections:
start the VNC service
look at VNC server settings or netstat -nap to find out the listening port of vnc server
under Google Developer console -> Compute Engine -> Networks -> default -> Firewall rules
create a new rule and open appropriate ports for incoming vnc connections.
VNC uses by default port 5901. In the 'VNC server' field, specify the ip address and the port 5901.
Example: VNC ***Server: 123.123.123.123:5901
Encryption: let VNC Server choose***
Be aware that the free edition of VNC doesn't support encryption, it only encrypts your user name and password. One thing also to configure is /etc/sysconfig/vncservers file where you have to specify the user and the port that VNC server should listen to, and make sure it's not commented
Example:
VNCSERVERS="1:USERNAME"
VNCSERVERAR0GS[1]="-geometry 800x600 -listen tcp -5901"

Resources