Raspberry PI VPN Gateway

Installation

  • Mittels dd das Image “2013-09-25-wheezy-raspbian.img” auf die SD-Karte schreiben
  • Mittels rasp-config (startet das erste Mal automatisch) Einstellungen vornehmen (Passwort, SD-Karte vergroessern, Sprache, Locale, etc.)

Systemupdate

  • apt-get update
  • apt-get upgrade

Anpassen interfaces

vi /etc/network/interfaces
auto lo

iface lo inet loopback
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.1.150
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 195.186.4.162

auto eth0:1
iface eth0:1 inet static
address 192.168.1.254
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Installation OpenVPN

  • apt-get install openvpn openssl
  • Die Zertifikate des VPN-Hosters auf den Raspberry kopieren und dann:
    sudo cp -r /home/pi/expressvpn/* /etc/openvpn
  • cd /etc/openvpn
  • sudo cp 11-Switzerland.ovpn standard.conf
  • Dienst starten
    openvpn --conf /etc/openvpn/standard.com
  • Automatisch standard.conf beim Booten starten
    echo 'AUTOSTART="standard"' >> /etc/default/openvpn

IP-Tables Roules

  • touch /etc/network/if-pre-up.d/iptables
  • echo "#!/bin/bash" >> /etc/network/if-pre-up.d/iptables
  • echo "/sbin/iptables-restore < /etc/rulesiptables" >> /etc/network/if-pre-up.d/iptables
  • chmod +x /etc/network/if-pre-up.d/iptables
  •  vi /etc/sysctl.conf

    und in der Zeile

    net.ipv4.ip_forward = 1

    das # entfernen.