Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Raspberry Pi Jessie Softether configuration
#!/bin/bash
nc -z -w30 8.8.8.8 53 # > /dev/null 2>&1
online=$?
if [ $online -ne 0 ]; then
echo "$(date) - No internet connection, restarting"
systemctl stop vpn.service
sleep 20
systemctl start vpn.service
echo "$(date) - Vpn service restarted!"
fi
# add following line to cron with crontab -e
# */5 * * * * /home/pi/checkInternet.sh >> /var/log/internet-checker.log 2>&1
interface eth0
static ip_address=192.168.101.6/24
static routers=192.168.101.1
static domain_name_servers=192.168.101.1
interface br0
static ip_address=192.168.101.6/24
static routers=192.168.101.1
static domain_name_servers=8.8.8.8 8.8.4.4 192.168.101.1
# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.
# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel
# Inform the DHCP server of our hostname for DDNS.
rpi
# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
#duid
# Persist interface configuration when dhcpcd exits.
persistent
# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit
# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU.
# Some interface drivers reset when changing the MTU so disabled by default.
#option interface_mtu
# A ServerID is required by RFC2131.
require dhcp_server_identifier
# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private
# A hook script is provided to lookup the hostname if not set by the DHCP
# server, but it should not be run by default.
nohook lookup-hostname
# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet manual
#auto br0
iface br0 inet manual
bridge_ports eth0
bridge_stp off
bridge_waitport 0
bridge_maxwait 0
bridge_fd 0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#!/bin/bash
echo "Switching from eth0 to br0"
# set up bridge
ip link add br0 type bridge
ip link set eth0 master br0
# flush eth0 configuration
ip addr flush dev eth0
ip link set dev br0 up
./vpnserver/vpnserver start
while [ -z "`ifconfig | grep tap_soft`" ]
do
echo "Wait for vpn adapter"
sleep 2
done
echo "Found VPN adapter, attaching to bridge."
ip link set dev tap_soft master br0
#Location /etc/systemd/system/
[Unit]
Description=SoftEther VPN Server daemon
After=network-online.target
[Service]
Type=forking
ExecStart=/home/pi/startVPN.sh
ExecStop=/home/pi/vpnserver/vpnserver stop
[Install]
WantedBy=multi-user.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.