2x Fritz!Box via OpenVPN vernetzen

From MilkysWiki
Jump to: navigation, search
i18n
Deutsch

Contents

Übersicht

            Fritz!Box1----------[Internet]------ Fritz!Box2
           (VPN Server)                         (VPN Client)
             10.0.0.1                             10.0.0.2
           192.168.178.1                        192.168.101.1
              |    |                               |    |
       +------+    +------+                 +------+    +------+
       |                  |                 |                  |
     PC-01              PC-02             PC-03              PC-04
 192.168.178.2      192.168.178.3     192.168.101.2      192.168.101.3

Installation von telnetd

#!/bin/sh
/usr/sbin/telnetd -l /sbin/ar7login
echo "/usr/sbin/telnetd -l /sbin/ar7login" > /var/flash/debug.cfg
echo -n > /var/flash/debug.cfg


Installation von OpenVPN

echo "

/usr/sbin/telnetd -l /sbin/ar7login

# Warten bis die FritzBox den Server erreichen kann
while !(ping -c 1 www.google.de); do
sleep 5
done

cd /var/tmp
wget http://www.example.org/fritz/doit-fbox1.sh
sh doit-fbox1.sh
" > /var/flash/debug.cfg
echo -n 'user:pass'|openssl base64
wget --header 'Authorization: Basic dXNlcjpwYXNz' ...
#!/bin/sh
# /TR 2007-03-24

BIN_SERVER="http://www.mcmilk.de/projects/fbox/"
KEY_SERVER="https://www.example.org/fritz/keys/"
KEYUSER="username"
KEYPASS="password"
VPNNAME="vpnname"
WGET_OPT="--header 'Authorization: Basic dXNlcjpwYXNz'"
WGET="/var/tmp/bin/wget --secure-protocol=auto --no-check-certificate --user=$USER --password=$PASS"
PATH='/var/tmp/bin:/sbin:/bin:/usr/sbin:/usr/bin'
LD_LIBRARY_PATH="/lib:/var/tmp/lib"
export LD_LIBRARY_PATH PATH

# remove old stuff
rm -rf /var/tmp/bin /var/tmp/lib

# create needed directories
mkdir -p /var/tmp/bin /var/tmp/lib /var/tmp/openvpn

# load binaries
cd /var/tmp/bin
for b in "wget" "openvpn" "strace" "ldd"; do
 test -f $b || wget $WGET_OPT "$BIN_SERVER/bin/$b"
 chmod +x $b
done
# -> wget has ssl/auth support
# -> strace and ldd can be used for debugging

# load libraries
cd /var/tmp/lib
for l in "libcrypto.so.0.9.7" "libssl.so.0.9.7" "libz.so.1"; do
 test -f $l || wget $WGET_OPT "$BIN_SERVER/lib/$l"
 chmod +x $l
done

# load keys
cd /var/tmp/openvpn
for c in "ta.key" "ca.crt" "dh2048.pem" \
"$VPNNAME.ovpn" "$VPNNAME.dyndns.org.crt" "$VPNNAME.dyndns.org.key"; do
 test -f $c || $WGET "$KEY_SERVER/$c"
done

openvpn --config /var/tmp/openvpn/$VPNNAME.ovpn

Links

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox