This is old; check if there's new versions of stuff that you should use.
cd /usr/local/src wget http://openvpn.net/release/openvpn-2.0.tar.gz tar xvfz openvpn-2.0.tar.gz cd openvpn-2.0 apt-get install liblzo-dev ./configure make make install mkdir /etc/openvpn mkdir /etc/openvpn/easy-rsa cp /usr/local/src/easy-rsa/* /etc/openvpn/easy-rsa
/etc/openvpn/server.conf:
dev tap port 5000 proto tcp-server verb 1 mode server tls-server ping 60 ca /etc/openvpn/ca.crt cert /etc/openvpn/server.crt key /etc/openvpn/server.key dh /etc/openvpn/dh1024.pem ifconfig 192.168.222.1 255.255.255.0 ifconfig-pool 192.168.222.100 192.168.222.200 route 192.168.222.0 255.255.255.0 route-gateway 192.168.222.1
client.conf:
dev tap proto tcp-client port 5000 ping 15 ping-restart 120 resolv-retry infinite remote openvpn.wirelesstoronto.ca tls-client ca /etc/openvpn/ca.crt cert /etc/openvpn/client**NODEID**.crt key /etc/openvpn/client**NODEID**.key ifconfig 192.168.222.**NODEID** 255.255.255.0
cd easy-rsa . ./vars
./build-key client[NODEID]
scp wireless@pwd.ca:easy-rsa/keys/client<NODEID>.crt /etc/openvpn scp wireless@pwd.ca:easy-rsa/keys/client<NODEID>.key /etc/openvpn
(it'll prompt you for the wireless@pwd.ca password each time)
Instructions adapted from http://forum.openwrt.org/viewtopic.php?id=1800
### Allow OpenVPN connections iptables -t nat -A prerouting_rule -i $WAN -p udp --dport 1194 -j ACCEPT iptables -A input_rule -i $WAN -p udp --dport 1194 -j ACCEPT
#!/bin/sh #/etc/openvpnbridge # OpenVPN Bridge Config File # Creates TAP devices for use by OpenVPN and bridges them into OpenWRT Bridge # Taken from http://openvpn.net/bridge.html # Make sure module is loaded insmod tun # Define Bridge Interface # Preexisting on OpenWRT br="br0" # Define list of TAP interfaces to be bridged, # for example tap="tap0 tap1 tap2". tap="tap0" # Build tap devices for t in $tap; do openvpn --mktun --dev $t done # Add TAP interfaces to OpenWRT bridge for t in $tap; do brctl addif $br $t done #Configure bridged interfaces for t in $tap; do ifconfig $t 0.0.0.0 promisc up done
chmod +x /etc/openvpnbridge
port 1194 proto udp dev tap keepalive 10 120 status openvpn-status.log verb 3 secret /etc/openvpn/static.key
openvpn --genkey --secret static.key
openvpn /etc/openvpn/server.conf
#!/bin/sh #/etc/init.d/S95openvpnserver /etc/openvpnbridge openvpn /etc/openvpn/server.conf &
chmod +x /etc/init.d/S95openvpnserver
dev tap proto udp remote Your.IP.Goes.Here 1194 resolv-retry infinite nobind mute-replay-warnings secret /etc/openvpn/static.key verb 3