> For the complete documentation index, see [llms.txt](https://ascend-engineering.gitbook.io/sdgsfdg335-modalai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ascend-engineering.gitbook.io/sdgsfdg335-modalai/sharing-internet-over-adb.md).

# Sharing internet over adb

## Install Openvpn on voxl2

You do need to connect voxl2 to the internet to install openvpn with `sudo apt-get install openvpn`

Technically you can get the deb file, adb push it over, and install it. But, eventually we can figure that out

## Install Openvpn on laptop running Ubuntu

#### On Laptop

```
wget https://git.io/vpn -O openvpn-install.sh
sudo ./openvpn-install.sh
```

* Settings
  * Which IPv4 address should be used? -> Doesn't matter what you select, changing it later
  * his server is behind NAT. What is the public IPv4 address or hostname? -> Hit Enter
  * Which protocol should OpenVPN use? -> Crucial to use TCP (adb reverse does not work over udp)
  * What port should OpenVPN listen to? -> Hit Enter
  * Select a DNS server for the clients: -> Any should work, but I use 2 (Google)
  * Enter a name for the first client: -> Whatever you want (I use voxl2)
  * Hit Enter to continue installation

Now we want to modify openvpn server configuration (since this is not a traditional vpn)

* Open server configuration with `sudo vim /etc/openvpn/server/server.conf`
* Delete this top line ![](/files/xqy5ybiW9n8lqLMlI4AW)
* Or, just copy this content over

{% code overflow="wrap" %}

```
port 1194
proto tcp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh.pem
auth SHA512
tls-crypt tc.key
topology subnet
server 10.8.0.0 255.255.255.0
push "redirect-gateway def1 bypass-dhcp"
ifconfig-pool-persist ipp.txt
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "block-outside-dns"
keepalive 10 120
user nobody
group nogroup
persist-key
persist-tun
verb 3
crl-verify crl.pem
```

{% endcode %}

* Restart the service: `sudo systemctl restart openvpn-server@server`
* Ensure everything loaded correctly with `sudo systemctl status openvpn-server@server`
  * Last line should say "initializtion process complete"

    <figure><img src="/files/61Vsj0JMhq28bZnui393" alt=""><figcaption></figcaption></figure>

## Forward adb using reverse

We want to forward the port that we are VPNing over

`adb reverse tcp:1194 tcp:1194`

## Configure  client

Move over the config that was generated by the setup script

```
sudo cp /root/voxl2.ovpn ~
adb push ~/voxl2.ovpn /home/root
```

Change the remote ip addres in `voxl2.ovpn` to `localhost` (since we want all traffic to go to the adb reverse of localhost 1194)

<figure><img src="/files/KUqGG75b41p6VkkKBUxL" alt=""><figcaption></figcaption></figure>

Start forwarding traffic using `openvpn --config voxl2.ovpn`

It should look something like this

<figure><img src="/files/5NMI2n9V0rwVBmmY3HK5" alt=""><figcaption></figcaption></figure>

## set default route

Now that we have a connection, we have to open a new window, adb in, and set the default path for all traffic to be forwarded to

`sudo ip route add default via 10.8.0.1 dev tun0`

<figure><img src="/files/5x809qpliKNtkhNrHf55" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
tun0 is the interface for the openvpn tunnel
{% endhint %}

## set DNS

So, even though we can ping ip addresses we can not get DNS resolution. OpenVPN should be able to push DNS options, but for some reason this isnt working right now so I set them manually by adding the following to file `/etc/resolv.conf`

```
nameserver 8.8.8.8
nameserver 8.8.4.4
```

<figure><img src="/files/3Al1Wg6QVK7CvGRr5wgo" alt=""><figcaption></figcaption></figure>

## Conclusion

We should now be able to have full internet connetion

<figure><img src="/files/ilCmLjj8g6LgfZBG79vW" alt=""><figcaption></figcaption></figure>

and even access voxl portal

<figure><img src="/files/l9kQsSa2jgLRrZtgQc2q" alt=""><figcaption></figcaption></figure>

## Troubleshooting

#### Error with authenticating

Wed Jul 17 19:37:42 2024 VERIFY ERROR: depth=1, error=certificate is not yet valid: CN=Easy-RSA CA Wed Jul 17 19:37:42 2024 OpenSSL: error:1416F086:SSL routines:tls\_process\_server\_certificate:certificate verify failed \
Wed Jul 17 19:37:42 2024 TLS\_ERROR: BIO read tls\_read\_plaintext error \
Wed Jul 17 19:37:42 2024 TLS Error: TLS object -> incoming plaintext read error \
Wed Jul 17 19:37:42 2024 TLS Error: TLS handshake failed Wed Jul 17 19:37:42 2024 Fatal TLS error (check\_tls\_errors\_co),

Solution: ensure the date is set correctly on the voxl2 with `date` and if it needs to be changed set it with `date -s [insert current date]`


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ascend-engineering.gitbook.io/sdgsfdg335-modalai/sharing-internet-over-adb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
