Koozali.org: home of the SME Server

help with configuration on vpn tunnel site to site by (hancees.com)

Offline nefkho

  • *****
  • 183
  • +0/-0
    • http://www.cagothonglines.com
hi good day,

any one tried and successfully implemented the VPN Tunnel (Site-to-Site) by Hancees.com? please help me correct the LAN IP's and gateway setup configuration below, also for the tunnel layer IP? i have no idea how i get them.
my remote gateway have dynamic ip too.
and i have 2 remote site.
i have the the keys made already.

i have the ff:

--------- main office ------
sme server      gateway & server mode
internet ip      xxx.xxx.xxx.xxx (static)
gateway      192.168.1.1
network      192.168.1.0
tunnel layer   (what should be my tunnel layer ip)
*add to local network in sme manager
network      subnet mask      router
192.168.110.0   255.255.255.0   192.168.1.1
192.168.120.0   255.255.255.0   192.168.1.1
192.168.130.0   255.255.255.0   192.168.1.1

----- remote office A -------------
sme client a   gateway & server mode
internet ip      xxx.xxx.xxx.xxx (dynamic IP)
gateway      192.168.110.1
network      192.168.110.0
tunnel layer   (what should be my tunnel layer ip)
*add to local network in sme manager
network      subnet mask      router
192.168.1.0           255.255.255.0   192.168.110.1

----- remote office B -------------
sme client b    gateway & server mode
internet ip      xxx.xxx.xxx.xxx (dynamic IP)
gateway      192.168.120.1
network      192.168.120.0
tunnel layer   (what should be my tunnel layer ip)
*add to local network in sme manager
network      subnet mask      router
192.168.1.0      255.255.255.0   192.168.120.1

------- configuration file ------------

## for Server

###########server.conf##################
# server.conf see http://openvpn.net/howto.html
#either use remote, or use mode server
##remote
#remote 213.4.3.2
#ifconfig 10.4.0.1 10.4.0.2
##mode server
mode server
server ???.???.???.??? 255.255.255.0
proto udp
port 1194
#optional what address to listen to
#local 213.4.3.1
dev tun
tls-server
dh dh1024.pem
ca ca.crt
cert server.crt
key server.key #should be kept secret
#secret static.key #you could do without certificates, please don't
comp-lzo # Enable compression on the VPN link.
user nobody
group nobody
daemon
keepalive 10 60
ping-timer-rem
up ./openvpn.up
persist-tun
persist-key
status-version 2
status /var/log/openvpn/openvpn-status.log
verb 3
#########################################

The openvpn.up script in the same directory of the server should look like this:
###########################
#!/bin/sh
#on server route network to the other side's tun-ip
#you should add this route in sme7 server-manager or it will dissappear
route add -net 192.168.110.0 netmask 255.255.255.0 gw ???.???.???.???
# added for the 2 client
route add -net 192.168.120.0 netmask 255.255.255.0 gw ???.???.???.???
# -- how can i add route for the second client??? --
#let openvpn traffic in and out (not needed on sme due to service)
#iptables -A INPUT -p udp --dport 1194 -j ACCEPT
#iptables -A OUTPUT -p udp --sport 1194 -j ACCEPT
#traffic over the tunnel to the server itsself (only icmp for ping)
iptables -A INPUT -i tun+ -p icmp -j ACCEPT
iptables -A OUTPUT -o tun+ -p icmp -j ACCEPT
#allow a network over the tun devices
iptables -A FORWARD -i tun+ -j ACCEPT
logger "openvpn is up"
##################################

## For Client A ##

###########client.conf for clien A ##################
#client.conf
#remote 213.4.3.1 1194
##either use "ifconfig" or use "client". When remote uses "server",
#client should use "client"
##only use ifconfig if server also uses "remote".
#ifconfig 10.4.0.2 10.4.0.1
client
proto udp
dev tun
tls-client
#ns-cert-type server #todo in cert make step
#remote-cert-tls server
dh dh1024.pem
ca ca.crt
cert client.crt
key client.key
comp-lzo
user nobody
group nobody
daemon
keepalive 10 60
ping-timer-rem
up ./openvpn.up
persist-tun
persist-key
status-version 2
status /var/log/openvpn/openvpn-status.log
verb 3
#########################################
make a openvpn.up on the client:
################# for client A ##########
#!/bin/sh
#on client route network to the other side's tun-ip
#you should add this route in severmanager as well or it will dissappear on sme7 route add -net 192.168.110.0 netmask 255.255.255.0 gw ???.???.???.???
#let openvpn traffic in and out
iptables -A INPUT -p udp --dport 1194 -j ACCEPT
iptables -A OUTPUT -p udp --sport 1194 -j ACCEPT
#traffic over the tunnel to the server itsself (only icmp for ping)
iptables -A INPUT -i tun+ -p icmp -j ACCEPT
iptables -A OUTPUT -o tun+ -p icmp -j ACCEPT
#allow a network over the tun devices
iptables -A FORWARD -i tun+ -j ACCEPT
logger "openvpn is up"
######################################

## For client B ##

###########client.conf for clien B ##################
#client.conf
#remote 213.4.3.1 1194
##either use "ifconfig" or use "client". When remote uses "server",
#client should use "client"
##only use ifconfig if server also uses "remote".
#ifconfig 10.4.0.2 10.4.0.1
client
proto udp
dev tun
tls-client
#ns-cert-type server #todo in cert make step
#remote-cert-tls server
dh dh1024.pem
ca ca.crt
cert client.crt
key client.key
comp-lzo
user nobody
group nobody
daemon
keepalive 10 60
ping-timer-rem
up ./openvpn.up
persist-tun
persist-key
status-version 2
status /var/log/openvpn/openvpn-status.log
verb 3
#########################################

make a openvpn.up on the client:
################# for client B ##########
#!/bin/sh
#on client route network to the other side's tun-ip
#you should add this route in severmanager as well or it will dissappear on sme7 route add -net 192.168.1.0 netmask 255.255.255.0 gw ???.???.???.???
#let openvpn traffic in and out
iptables -A INPUT -p udp --dport 1194 -j ACCEPT
iptables -A OUTPUT -p udp --sport 1194 -j ACCEPT
#traffic over the tunnel to the server itsself (only icmp for ping)
iptables -A INPUT -i tun+ -p icmp -j ACCEPT
iptables -A OUTPUT -o tun+ -p icmp -j ACCEPT
#allow a network over the tun devices
iptables -A FORWARD -i tun+ -j ACCEPT
logger "openvpn is up"
######################################



thanks,

hoping to get this up by july 1....
« Last Edit: June 25, 2010, 11:12:11 AM by nefkho »
Nef Kho  :-) .........

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: help with configuration on vpn tunnel site to site by (hancees.com)
« Reply #1 on: June 25, 2010, 10:29:23 AM »
nefkho

I do not use the VPN tunnel contrib, but I think you need static IP's to get a practical working setup.
With dynamic IPs, once the dynamic IP changes, you will have to change configuration and re-establish the VPN link.
That could be tedious depending how often your dynamic IP changes.
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline soprom

  • *
  • 589
  • +0/-0
    • www.logiciel-libre.org
Re: help with configuration on vpn tunnel site to site by (hancees.com)
« Reply #2 on: June 26, 2010, 01:05:09 AM »
Dynamic IP on both sides has been bad for me. It works at first but it is not stable on the long run. I solved this by having the server side (in my case: smeserver--openwrt) on a fixed ip.
Sophie from Montréal

Offline nefkho

  • *****
  • 183
  • +0/-0
    • http://www.cagothonglines.com
Re: help with configuration on vpn tunnel site to site by (hancees.com)
« Reply #3 on: June 26, 2010, 03:22:41 AM »
thanks for the info,

my main site or server have a static ip its my remote site that have dymamic ip.

anyone can help especially with the tunnel layer ip?

thanks,
« Last Edit: June 26, 2010, 03:28:23 AM by nefkho »
Nef Kho  :-) .........