0

I have an issue with my vpn server setup. After 2 days, I ditched the gui on dd-wrt and made a config for bridget connection that worked, but not on iPhone (they do not support it). So I decided to switch to the TUN. Sever is running, I can connect, but there two problems -

  1. Cannot access lan
  2. Cannot access internet / unless I remove dhcp-option from the server

My LAN is 192.168.1.0/24 and VPN net 192.168.2.0/24 This is my server setup

push "route 192.168.1.0 255.255.255.0"
push "dhcp-option DNS 192.168.1.1" 
server 192.168.2.0 255.255.255.0
push "redirect-gateway def1" 

mode server
proto udp4
port 1194 
dev tun0 
cipher AES-256-CBC
tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA256
auth SHA256
comp-lzo yes
script-security 2
keepalive 10 120 
daemon 
verb 5 

dh /tmp/openvpn/dh.pem 
ca /tmp/openvpn/ca.crt 
cert /tmp/openvpn/cert.pem 
key /tmp/openvpn/key.pem

Firewall script

iptables -I INPUT -p udp --dport 1194 -j ACCEPT
iptables -I FORWARD 1 --source 192.168.2.0/24 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j MASQUERADE

And client settings

remote router-ip 1194

client 
dev tun0
proto udp 
resolv-retry infinite 
nobind 
persist-key 
persist-tun 
float
cipher AES-256-CBC
auth SHA256
tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA256
comp-lzo yes
verb 5

ca ca.crt 
cert client1.crt 
key client1.key 

remote-cert-tls server

Route table

default via XX.XXX.XXX.XXX dev vlan2
XXX.XXX.XXX.XXX/26 dev vlan2  proto kernel  scope link  src XXX.XXX.XXX.XXX
127.0.0.0/8 dev lo  scope link
169.254.0.0/16 dev br0  proto kernel  scope link  src 169.254.255.1
192.168.1.0/24 dev br0  proto kernel  scope link  src 192.168.1.1
192.168.2.0/24 via 192.168.2.2 dev tun0
192.168.2.2 dev tun0  proto kernel  scope link  src 192.168.2.1

My phone droping accessing the LAN

Sep 16 14:46:03 DD-WRT kern.warn kernel: DROP IN=tun0 OUT= MAC= SRC=192.168.2.6 DST=192.168.1.1 LEN=60 TOS=0x00 PREC=0x00 TTL=255 ID=9878 PROTO=UDP SPT=64708 DPT=53 LEN=40
Sep 16 14:46:03 DD-WRT kern.warn kernel: DROP IN=tun0 OUT= MAC= SRC=192.168.2.6 DST=192.168.1.1 LEN=76 TOS=0x00 PREC=0x00 TTL=255 ID=35922 PROTO=UDP SPT=49210 DPT=53 LEN=56
Sep 16 14:46:05 DD-WRT kern.warn kernel: DROP IN=tun0 OUT= MAC= SRC=192.168.2.6 DST=192.168.1.1 LEN=76 TOS=0x00 PREC=0x00 TTL=255 ID=1652 PROTO=UDP SPT=49210 DPT=53 LEN=56

Any idea whaty might be the issue here? :/ My guess is that the 2.0 cannon talk to the 1.0 network, but I have no clue how to edit the iptables to make it work :/.

0

So after 2 days, I found a working solution :D

VPN Server config

push "route 192.168.1.0 255.255.255.0"
push "dhcp-option DNS 5.135.183.146" 
push "dhcp-option DNS 151.80.147.153" 
server 192.168.2.0 255.255.255.0
push "redirect-gateway def1" 

management localhost 5001
mode server
proto udp4
port 1194 
dev tun0 
cipher AES-256-CBC
tls-cipher TLS-DHE-RSA-WITH-AES-256-CBC-SHA256
auth SHA256
comp-lzo yes
script-security 2
keepalive 10 120 
daemon 
verb 5 

dh /tmp/openvpn/dh.pem 
ca /tmp/openvpn/ca.crt 
cert /tmp/openvpn/cert.pem 
key /tmp/openvpn/key.pem 

Firewall script

iptables -I INPUT 1 -p udp --dport 1194 -j ACCEPT
iptables -I INPUT 2 -i tun0 -j ACCEPT
iptables -I FORWARD -i br0 -o tun0 -j ACCEPT
iptables -I FORWARD -i tun0 -o br0 -j ACCEPT 
iptables -I FORWARD 1 --source 192.168.2.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -j MASQUERADE
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.