I’ve got :
A local network A with:
- Offline Linux device 192.168.0.1
- Offline Windows device 192.168.0.2 that connects to port 4444 in Linux 192.168.0.1
- Raspberry Pi with two ethernet ports, 192.168.0.3 and DHCP that connects to a reverse SSH AWS server
A local network B with:
- Offline Windows device 192.168.0.4
- Raspberry Pi with two ethernet ports, 192.168.0.5 and DHCP that connects to a reverse SSH AWS server
How can I have my Windows PC in network B connect to 192.168.0.5:4444 and use port forwarding to get the data coming from network A, 192.168.0.1:4444 device?
Ideally as a configuration instead of commands that I have to run everytime they reboot.
I have read ssh forwarding and tunneling information but what I want to acomplish is more complex than what I understand.
In the AWS server, edit ~/.ssh/config to add the hostname 192.168.0.1
Host networkApi Hostname 127.0.0.1 User pi Port 52566 #Port used to ssh to the pi using reverse ssh IdentityFile ~/.ssh/networkApi-id_rsa LocalForward 4444 192.168.0.1:4444
This makes the information in 192.168.0.1 port 4444 available in AWS port 4444
In the same AWS ~/.ssh/config file, edit the second Pi information
Host networkBpi Hostname 127.0.0.1 User pi Port 52587 #Port used to ssh to the pi using reverse ssh IdentityFile ~/.ssh/networkBpi-id_rsa GatewayPorts yes RemoteForward 4444 127.0.0.1:4444
This makes AWS port 4444 available in the network B Raspberry Pi.
In the network B Raspberry Pi, edit the file /etc/ssh/sshd_config to set “GatewayPorts yes” and restart the ssh daemon with
sudo service sshd restart
Now from AWS, ssh into one Pi and from a different console, ssh into the other Pi. You should be able to access the information in 192.168.0.1:4444 by telnet 10.10.5.84 4444 where 10.10.5.84 is the IP address given by DHCP to the Raspberry Pi in network B.