All pastes #1487610 Raw Edit

wireddd

public text v1 · immutable
#1487610 ·published 2009-07-08 01:46 UTC
rendered paste body
#server lan is 192.168.1.0, client lan is 10.0.1.0

#do this stuff first
opkg update
opkg install openvpn
mkdir /etc/openvpn
openvpn --genkey --secret /etc/openvpn/static.key

#add this to /etc/config/openvpn on the server
config openvpn ptp_config
        option enable 1
        option config /etc/openvpn/server.conf

#add this to /etc/config/openvpn on the client
config openvpn ptp_config
        option enable 1
        option config /etc/openvpn/client.conf

#put this in /etc/openvpn/server.conf on the server
dev tun
ifconfig 10.0.254.1 10.0.254.2
secret /etc/openvpn/static.key
status /tmp/openvpn-status.log
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
route 10.0.1.0 255.255.255.0

#put this in /etc/openvpn/client.conf on the client

remote whereeveryourseveris.org
dev tun
ifconfig 10.0.254.2 10.0.254.1
secret /etc/openvpn/static.key
status /tmp/openvpn-status.log
keepalive 10 60
ping-timer-rem
persist-tun
persist-key
route 192.168.1.0 255.255.255.0

#add this to server /etc/config/network
config interface vpn
  option ifname tun0
  option proto static
  option ipaddr 10.0.254.1
  option netmask 255.255.255.0

#add this to client /etc/config/network
config interface vpn
  option ifname tun0
  option proto static
  option ipaddr 10.0.254.2
  option netmask 255.255.255.0

#add this to client and server /etc/config/firewall

config zone
  option name vpn
  option input ACCEPT
  option output ACCEPT
  option forward ACCEPT
  # if you use masquerading:
  option masq 1

config forwarding
  option src lan
  option dest vpn

#add this to /etc/firewall.user on the server
iptables -A input_wan -p udp --dport 1194 -j ACCEPT 

#do this on the server and then the client and you should be all done.
/etc/init.d/firewall restart
/etc/init.d/network restart
/etc/init.d/openvpn restart