Forward wake on lan using zerotier - portforwarding

I have a linux computer (super small low powered, similar to raspberry pi) that is running zerotier. I can ping this from the outside and this computer has access to an internal server. What I am trying to do is to send wake on lan packets to the zerotier computer and have this forward the packet to 192.168.1.5.
The purpose of this is that the server is also running zerotier and I can access it from the outside, but when the server is shut down there is no way to reach it from the outside. I am therefore trying to use this linux computer to forward the wake on lan packets so that I can boot the server remotely.
For my case it would be enough to simply ssh into the linux computer and send the wake on lan from there, but sometimes my wife need to boot the server and I doubt I can teach her any time soon how to ssh into the linux computer and send a WoL from command line. Therefore I need the linux computer to forward the wake on lan to the internal ip. How can I do this?

Related

How find correct Ip for connection Client/Server Qt?

I created two Qt apps: one client and one server.
I use them to send some data for handle a remote device.
If I am in localhost I haven't issues about them, but when i search to connect them by internet i don't know how to find correct Ip server to connect Socket Client.
How i can find this ip node?
Is there a class to find It?
you cannot find it automatically, if this is what you're asking about.
In real life you would deploy your server on some publicly accessible host, give it a domain name (important part as your host can change the IP address at any time) and connect the client via the DNS domain.
However if you're just playing around and you want to show to the world that your app works, specifying the IP address of the server in your client code would be perfectly fine (assuming you're running both the server and the client in the same network).
In that case, if you're running mac/linux run the command ifconfig (or just ip depending on the distribution). On Windows you can run the command ipconfig. Both windows and linux will give you a similar output resembling this:
Pay attention to the network adapters. There can potentially be many of them. You may have some emulated adapters if you have docker or VMWare, you may have the wireless adapters if you have a WiFi card, and then the ethernet adapters if your computer can connect to the the internet with an ethernet cable. Each of these adapters specifies a different IPv4 address. You want to pick the one that is connected to the same network as your client. So for instance if both your server machine and your client running machine are connected to the same wifi, you pick the address from the Wireless LAN adapter

How to access an IP in a subnet of another NC card?

I searched and could not find an answer for this.. not even a discussion about it...
I need to develop an application to talk to a robot in our shop floor... no big deal about the code... The issue is as follows:
This robot is connected to an industrial PC that is connected to our production network. This industrial PC has two NICs, NIC #1 has TCP/IP settings set to connect to our production network (IP something like 10.9.100.100), and the NIC #2 is configured to have its IP on a subnet address (Something like 192.168.127.10).
The robot has an IP address too, which is in the subnet of the NIC #2 of the industrial PC. The robot´s IP is something like 192.168.127.20
There´s an application running on the industrial PC that keeps polling data from the robot, like its status, cycle time, etc. This application then sends the data collected from the robot to a server in our production network.
Simply put, it´s like grab data via NIC #2 and send it to a server in the production network via NIC #1.
In order to test my application from within the IDE and debug it, I´d like to connect to the robot from my desktop (Which is in the production network (10.9.100.200)...), to that IP in the subnet the robot is, that is, the IP subnet set in the NIC #2 from the industrial PC.
I have access to the industrial PC and I could install Visual Studio on it and code via remote desktop. Then for sure I could access that robot. But that would not be cool...
Is there any way, setting or application that allows me to reach that robot from my production network?
What you're looking for is port forwarding. You can set up the industrial PC to listen on a certain port number x on NIC 1 and forward all connections to the robot's IP address on port number y (where y may be equal to x if port x is not used by another application on the industrial PC, otherwise you set it to a different value).
This would be trivial to set up on most Unixes, but since you're running Windows it's a bit more complicated. If your traffic is TCP, Windows supports port forwarding via netsh. If your traffic is UDP, you need to use some third-party application. With some Googling I found this one
(look for "Simple UDP proxy/pipe"). Note that I have no experience with this program and you should be careful when downloading executables from unknown sources; but AFAICT the source code is also provided, so you could compile it yourself if needed.
On the same page you can also find a TCP forwarder if the native Windows one doesn't work for you.

SSH Port Forwarding Internal Details

This is more of a theory question for more understanding.
In order to do port forwarding we update sshd_config and provide the information of local port(a) and remote port(b) among which we need to perform forwarding. After this forwarding config is done, ssh tunnel will be used to forward packets between a <-> b.
But internally, how does this work? when I do https://localhost:a, how does packet move from port a to ssh tunnel port 22 and on the other side from port 22 to port b?
If you are interested about the internals, openssh is the most popular implementation of SSH protocol and it is open source with code available on GitHub.
To answer a bit your question, it works as every other network communication. If you are not familiar with it, check how network socket works. Port forwarding is doing just proxy between the ends and sends the data inside the encrypted channel, instead of outside as the direct socket would.
Anyway, it is easier to google a bit. Ubuntu has a nice explanation in their documentation:
To get the most out of port forwarding, it's helpful to know a bit about how the Internet works.
The Internet assigns computers virtual "ports", a bit like the USB ports on the back of your computer:
To let a digital camera share pictures with your PC, you connect the USB port on the camera to any USB port on the PC. The computer then talks to the camera about your photos, and shows you the result.
To let a web server share pages with your PC, you connect the web server port on the server to any Internet port on the PC. The computer then talks to the server about your page, and shows you the result.
Unlike a USB port, there is no physical component to an Internet port. There's no actual wire, or actual hole on the back of your computer. It's all just messages being sent over the Internet. Like other "virtual" computer concepts, Internet ports are just an analogy that help to explain what your computer is doing. Sometimes, that analogy breaks down:
There are two types of Internet port: normal "TCP" ports and strange "UDP" ports (which won't be covered here).
Unlike USB ports, every computer has exactly 65,535 numbered TCP ports, some of which have a special purpose. For example, port number 80 is your web server port, so your web browser knows it should connect to port number 80 in order to download a web page.
Connections between Internet ports can be patched together, so a connection from computer A to computer B on port 12,345 could be patched through to port number 80 on computer C. This is known as port forwarding.

How to reduce high network accessing time?

What we have
My office network have a new 20mbps dial-up connection. The internet is connected to DLINK 600-L Wifi Router. An LAN port of router is connected to DLINK's gigabyte switch that connects all the PCs in the building. We do have a good traffic in internal network due to the office software activities. Before this new internet connection, we used static IP routing in another router. But now it is using DHCP.
My problem
When we connect to wifi and browse, we are getting only 1mbps to 2mbps instead of 20mbps. Also often the download is broken and fails in middle.
Test I have tried
Opened 2 terminals.
Started a ping to router in terminal 1.
ping 192.168.0.1
Started a download in terminal 2.
wget http://www.dlink.com/-/media/Consumer_Products/DIR/DIR%20600L/Manual/dir600L_manual_100.pdf
Result: The ping was 5ms - 10ms when started. But as the download started at 512kbps - 2mbps, the ping started to rise up to 10000ms and the download speed went down gradually to zero. Thus download failed.
You're suffering from Bufferbloat. In short, some router uses too much buffering under load, which causes extremely high latencies.
The solution would be to replace the DLINK with a debloated router (I recommend a recent version of OpenWRT with fq_codel), and set up traffic shaping to ensure that the congestion happens on that particular router.

Is it possible to connect with remote desktop but not be able to ping to the same machine?

It seems I have this weird issue I can't really understand. I am able to connect to a remote computer (windows machine) with remote desktop perfectly but I am not be able to ping to it. When I ping I get timeout all the time. It is the same ip address and I am using the same computer, so there are no firewall issue I think. From what I know ping is using it own protocol (different than TCP and UDP) so you don't ping to a precific port
Yes it is. The system administrator, and the network administrators (of the several networks you need to use to access the remote machines), are able configure their boxes to disable ICMP. Then ping does not work, but HTTP or ssh (or whatever protocol your remote desktop uses) could work.
ICMP is often disabled for security reasons, and to lower the load on the remote computer. It makes slightly harder to find the remote host.

Resources