www.linux-noob.com: VPN Routing - www.linux-noob.com

Jump to content

Page 1 of 1

VPN Routing howto with iptables and openvpn

#1 User is offline   Ritter

  • l33t
  • PipPip
  • Group: Members
  • Posts: 66
  • Joined: 18-December 03

Post icon  Posted 20 July 2006 - 07:23 PM

# openvpn --version
OpenVPN 2.0.6 i686-pc-linux-gnu [SSL] [LZO] [EPOLL] built on Apr 21 2006
Developed by James Yonan
Copyright (C) 2002-2005 OpenVPN Solutions LLC <info@openvpn.net>


The first node is also my firewall, it has the following interfaces:
eth0: 192.168.0.10
eth1: public address from dhcp
tun0: 192.168.201.1

Not sure if and how gentoo differs here, but I have a single config file name for the connection, that a symlinked init.d script will call this config.
/etc/openvpn/kiosk.conf:
local 192.168.0.10
port 1194
proto udp
dev tun
ca ca.crt
cert lnx-iprovo1.crt
key lnx-iprovo1.key
dh dh2048.pem
server 192.168.201.0 255.255.255.0
client-config-dir ccd-kiosk
route 10.10.2.0 255.255.255.0
keepalive 10 120
tls-auth ta.key 0
cipher DES-EDE3-CBC
comp-lzo
max-clients 3
user nobody
group nobody
persist-key
persist-tun
status status.log
log openvpn.log
verb 5
mute 20


A few rules to iptables make things play nice.
At first I ran these so I could see better what wa happening with packets:
-A INPUT -i tun0 -j LOG --log-prefix "INPUT (tun0) " --log-level 6
-A INPUT -i tun0 -j ACCEPT
-A FORWARD -i tun0 -j LOG --log-prefix "FORWARD (tun0) " --log-level 6
-A FORWARD -i tun0 -j ACCEPT
-A OUTPUT -o tun0 -j LOG --log-prefix "OUTPUT (tun0) " --log-level 6
-A OUTPUT -o tun0 -j ACCEPT
-A PREROUTING -i tun0 -j LOG --log-prefix "PREROUTING (tun0) " --log-level 6
-A PREROUTING -i tun0 -j ACCEPT
-A POSTROUTING -s 192.168.0.0/255.255.255.0 -o tun0 -j SNAT --to-source 192.168.201.1


All that are needed:
-A INPUT -i tun0 -j ACCEPT
-A FORWARD -i tun0 -j ACCEPT
-A OUTPUT -o tun0 -j ACCEPT
-A PREROUTING -i tun0 -j ACCEPT
-A POSTROUTING -s 192.168.0.0/255.255.255.0 -o tun0 -j SNAT --to-source 192.168.201.1


I'm going to have to finish this later .. as I am putting this together I have realized my kiosk in the mall must have lost power and I can't connect to it. HAHA .. need to get a UPS in there.
Edler Rittersmann
--
build a man a fire and he is warm for a day.
light a man on fire and he is warm for the rest of his life.
0

#2 User is offline   znx

  • Linux-Noob GURU
  • PipPipPipPipPipPipPipPip
  • View blog
  • Group: Members
  • Posts: 1,236
  • Joined: 21-March 05

Posted 21 July 2006 - 08:45 PM

i wonder if i can lick some of your skill from you?
0

#3 User is offline   Ritter

  • l33t
  • PipPip
  • Group: Members
  • Posts: 66
  • Joined: 18-December 03

Posted 21 July 2006 - 10:31 PM

View Postznx, on Jul 21 2006, 01:45 PM, said:

i wonder if i can lick some of your skill from you?

No you cannot, not that others haven't tried .. not to name any names (Flukex!)
Edler Rittersmann
--
build a man a fire and he is warm for a day.
light a man on fire and he is warm for the rest of his life.
0

#4 User is offline   anyweb

  • Administrator
  • PipPipPipPipPipPipPipPip
  • Group: Admin
  • Posts: 3,266
  • Joined: 11-December 03

Posted 22 July 2006 - 08:35 AM

great to see you posting again Ritter ! hope life is treating you well mate

cheers
anyweb
My linkedin profile at > linkedin.com
My personal website is > niallbrady.com
0

Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users





The G2-style Tux and the header images using them are licensed under Creative Commons BY-NC-SA. The G2-style Tux images are all from http://crystalxp.net.
Thanks to users kami23, lilitux, iva, overlord59, whidou, brightknight, emulienfou on the Crystal XP Tux Factory site.