description: >- This page describes how to set up the computer hosting Virtual Skynode such that other devices in the network can connect to Virtual Skynode
Connecting from other Computers
The following instructions are a starting point to help users connect a GCS device such as an Android Tablet to a separate host computer that is running Virtual Skynode. Depending on your exact setup the steps below might need to be adopted. The goal of this guide is to provide a minimal starting point.
Overview and Assumptions:
- The Virtual Skynode host is a Linux computer with access to iptables
- No services on the host computer are already listening to port 5790 via TCP
- Virtual Skynode is running with the default settings, in which case it acquires the IPv4 address 10.41.200.2
```mermaid flowchart LR android[Android Tablet] vm[Virtual Skynode 10.41.200.2] port(TCP Port 5790 on eth0)
android <-- mavlink to
hostcomputer:5790 --> port <-- iptables routing --> vm subgraph Host Computer running Virtual Skynode port vm end ```
TCP Packet forwarding via iptables
We are going to configure packet forwarding on the host machine that is running Virtual Skynode. With this method the ground station device will be connecting to the host machine. The ground station is not aware of there being a Virtual Skynode. The ground station also does not need to know anything about the IPV4 address 10.41.200.2, as from its perspective the host machine itself is a Skynode.
The method below uses IP forwarding to get packets from the incoming interface to virtual skynode and back. Network Address Translation (NAT) is required to manipulate the source and destination IPv4 address of packets such that Virtual Skynode is cleanly "hidden" behind the host machine.
{% hint style="info" %} The commands bellow generally require root {% endhint %}
{% hint style="info" %} All changes mentioned below generally reset after a reboot of the host machine. Making iptables persistent after a reboot is outside the scope of this guide. {% endhint %}
Configuring iptables:
```bash
Rule for forwarding packets that arrive on port 5790 via TCP to Virtual Skynode:
iptables -I FORWARD -d 10.41.200.2 -m comment --comment "Accept to forward mavlink traffic" -m tcp -p tcp --dport 5790 -j ACCEPT
iptables -t nat -I PREROUTING -m tcp -p tcp --dport 5790 -j DNAT --to-destination 10.41.200.2:5790
Forward packets coming back from the Virtual Skynode
iptables -I FORWARD -s 10.41.200.2 -m tcp -p tcp --sport 5790 -j ACCEPT
Setup NAT
iptables -t nat -I POSTROUTING -d 10.41.200.2 -o eth0 -j MASQUERADE iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT ```
Enable packet forwarding in the Linux kernel
sysctl -w net.ipv4.ip_forward=1
Comments
0 comments
Please sign in to leave a comment.