Skip to content

Instantly share code, notes, and snippets.

@LinusCDE
Created May 16, 2023 23:08
Show Gist options
  • Save LinusCDE/20e496039cea9ac06340643f58ebf16a to your computer and use it in GitHub Desktop.
Save LinusCDE/20e496039cea9ac06340643f58ebf16a to your computer and use it in GitHub Desktop.
reMarkable: Using Internet over USB (Linux PC)

This is a small writedown of you to use Internet over USB on your reMarkable in cases you can't use WiFi.

Requirements:

  • A Linux PC (mac might work or do with some minor workarounds)
  • Turn a blind eye to the crappy scripts below

Since the PC being connected to the reMarkable over USB connects them in the Network 10.11.99.0/24 which the reMarkable creates, we can use this subnet to route all other traffic of the device over it and essentially treat the PC like an ordinary router.

Step 1: Allow your PC to act like a router

For this I included two simple scripts below. They ensure that your PC is allowed to Forward traffic over it's interfaces, which it usually isn't allowed to.

They also add / remove a firewall rule that allowes traffic that is meant to go to another interface to be NATed, like your home router likely does as well.

Run the nat_create.sh like below. The interfaces will likely differ. The first argument is the interface with Internet access and the 2nd one is the interface which gets created when you plug in your reMarkable (e.g. use ip address show to check).

sudo ~/bin/nat_create.sh enp34s0 enp3s0f0u4

(When disabling, use the nat_destroy.sh script with the same arguments to revert the changes.)

Step 2: Make the reMarkable route all IPv4 traffic over your PC

This consists of two simple commands.

But first note down what IP your PC got from your reMarkable. For that run ip address show enp3s0f0u4 (replace the interface which what you used). It should show you an IP like this 10.11.99.3/24 (we don't care about the /24-Subnet in this case).

Next run this command on your reMarkable: ip route add default via 10.11.99.3 (change the IP to what you just got).

This should already enable you to connect to any IP. Test it by running e.g. ping 1.1.1.1. In case it doesn't work, your PC is likely not allow the traffice to be routed properly. So something went wrong in step 1 or you used the wrong IP.

Step 3: Specify a DNS-Resolver

To allow using domains, you need to make sure that the reMarkable knows of a DNS server it should use.

For you need to edit the file /etc/resolv.conf and make sure the is at least one line like this:

nameserver 1.1.1.1

The IP specified uses Cloudflare for resolving. You can also specify your Router IP in your home network or some other DNS Server.

After saving the file, you should be able to also resolve domains now. E.g. this should work: ping toltec-dev.org.

Done

Now you should have internet access on your reMarkable. All the changes made should be temporary and be gone on the next reboot of your device.

You can also undo the commands (e.g. change add to del in the IP route command and use nat_destroy.sh).

#!/bin/sh
if [ $# -ne 2 ]; then
echo "$0 <Inet> <Target>" >&2
exit 1
fi
if [ $UID -ne 0 ]; then
echo "$0: Root required!" >&2
exit 1
fi
# IPv4:
iptables -A FORWARD -i $2 -j ACCEPT
iptables -A FORWARD -i $1 -j ACCEPT # You might not need this line
iptables -t nat -A POSTROUTING -o $1 -j MASQUERADE
# IPv6:
#ip6tables -A FORWARD -i $2 -j ACCEPT
#ip6tables -A FORWARD -i $1 -j ACCEPT # You might not need this line
#ip6tables -t nat -A POSTROUTING -o $1 -j MASQUERADE
sysctl net/ipv4/ip_forward=1 # IPv4
#sysctl net/ipv6/conf/all/forwarding=1 # IPv6
#!/bin/sh
if [ $# -ne 2 ]; then
echo "$0 <Inet> <Target>" >&2
exit 1
fi
if [ $UID -ne 0 ]; then
echo "$0: Root required!" >&2
exit 1
fi
# IPv4:
iptables -D FORWARD -i $2 -j ACCEPT
iptables -D FORWARD -i $1 -j ACCEPT # You might not need this line
iptables -t nat -D POSTROUTING -o $1 -j MASQUERADE
# IPv6:
#ip6tables -D FORWARD -i $2 -j ACCEPT
#ip6tables -D FORWARD -i $1 -j ACCEPT # You might not need this line
#ip6tables -t nat -D POSTROUTING -o $1 -j MASQUERADE
# This might change it to false even if they were already enabled before running nat_create.sh
sysctl net/ipv4/ip_forward=0 # IPv4
#sysctl net/ipv6/conf/all/forwarding=0 # IPv6
@Eeems
Copy link

Eeems commented Aug 25, 2023

It might be worth turning this into an article here: https://remarkable.guide/tech/index.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment