Skip to content

Instantly share code, notes, and snippets.

@mildred
Last active March 22, 2017 15:08
Show Gist options
  • Save mildred/b24eeedaff9c90bf58e78b571e292167 to your computer and use it in GitHub Desktop.
Save mildred/b24eeedaff9c90bf58e78b571e292167 to your computer and use it in GitHub Desktop.
Raspberry as a 4G router

Hardware

Huawei E3372 HiLink connected on a raspberry running ArchLinux that acts as a bridge.

       ,=======(tunnel for 192.168.8.x)======.
       |       (VLAN or GRE)                 |
       v                                     v
[Home Router] ------- [Raspberry] ----- [LTE Router ]
[192.168.1.x]                           [192.168.8.x]
  |     |
 PC1    |
       PC2

Use the configuration files attached in /etc/systemd/network (systemd-networkd) to configure the network.

On the raspberry:

  • eth0: the interface to the LAN (192.168.1.x)
  • eth1: the interface to the HiLink LTE modem/router (192.168.8.x)
  • eth0.1: VLAN 1 on top of LAN that forwards the 192.168.8.x network
  • uptun0: GRE tunnel that forwads the 192.168.8.x network
  • uplink0: bridge between eth0.1, eth1 and uptun0

On your home router: Configure either the VLAN or the GRE tunnel to access on a virtual interface the 192.168.8.x network, and configure this interface as DHCP client and uplink for your router.

4G network in france: https://www.cartoradio.fr/cartoradio/web/

[NetDev]
Name=eth0.1
Kind=vlan
[VLAN]
Id=1
[NetDev]
Name=eth0.1
Kind=vlan
[VLAN]
Id=1
[root@alarmpi ~]# cat /etc/systemd/network/eth0.1.network
[Match]
Name=eth0.1
[Network]
DHCP=no
Bridge=uplink0
[Match]
Name=eth0
[Network]
DHCP=no
Address=192.168.1.10/24
VLAN=eth0.1
Tunnel=uptun0
[Match]
Name=eth1
[Network]
DHCP=no
Bridge=uplink0
[NetDev]
Name=uplink0
Kind=bridge
[Match]
Name=uplink0
[Network]
DHCP=yes
[NetDev]
Name=uptun0
Kind=gretap
[Tunnel]
Local=192.168.1.10
Remote=192.168.1.1
DiscoverPathMTU=true
[Match]
Name=uptun0
[Network]
DHCP=no
Bridge=uplink0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment