OpenVPN working properly in Router mode, but not in Gateway

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
stunsm
DD-WRT Novice


Joined: 17 Mar 2017
Posts: 3

PostPosted: Fri Mar 17, 2017 22:43    Post subject: OpenVPN working properly in Router mode, but not in Gateway Reply with quote
I'm running a Netgear R6300 v1, build v3.0-r31690 giga. When running in Router mode behind my ISP provided gateway, I'm able to connect to OpenVPN with full functionality. When I switch to Gateway mode and take my ISP provided gateway out of the equation, I'm able to connect to OpenVPN from an outside network, I receive what looks like an appropriate IP address, but I'm not able to communicate with any other devices or subnets, the assigned DHCP server, or the VPN router. The client does not receive a default gateway, or DNS server, and has a netmask of 255.255.255.252, which seems strange to me. My LAN is 192.168.7.0, VPN is 192.168.6.0.

I feel like this is a NAT issue, as I'm able to ping 192.168.6.1 when connected in Router mode, but not when connected in Gateway mode. I've spent a few hours trying to find a solution but find myself stumped. Thanks for any help!

Server Config:
push "route 192.168.7.0 255.255.255.0"
push "dhcp-option DNS 192.168.6.1"
server 192.168.6.0 255.255.255.0

dev tun0
proto udp
keepalive 10 120

dh /tmp/openvpn/dh.pem
ca /tmp/openvpn/ca.crt
cert /tmp/openvpn/cert.pem
key /tmp/openvpn/key.pem
tls-auth /tmp/openvpn/ta.key 0
cipher AES-256-CBC
script-security 2


Client Config:
client
dev tun
proto udp
remote x.x.x.x 1194
resolv-retry infinite
nobind
persist-key
persist-tun
ca "ca.crt"
cert "cert.crt"
key "key.key"
tls-auth "ta.key" 1
cipher AES-256-CBC
verb 5
float


Firewall Commands:

iptables -I INPUT 1 -p udp --dport 1194 -j ACCEPT
iptables -I FORWARD 1 --source 192.168.6.0/24 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.6.0/24 -j MASQUERADE


Routing Table:
default 0.0.0.0 x.x.x.x UG 0 WAN
x.x.x.0 255.255.255.0 * U 0 WAN
169.254.0.0 255.255.0.0 * U 0 LAN & WLAN
192.168.6.0 255.255.255.0 192.168.6.2 UG 0 tun0
192.168.6.2 255.255.255.255 * UH 0 tun0
192.168.7.0 255.255.255.0 * U 0 LAN & WLAN
192.168.8.0 255.255.255.0 192.168.7.249 UG 0 LAN & WLAN
192.168.9.0 255.255.255.0 192.168.7.250 UG 0 LAN & WLAN
192.168.10.0 255.255.255.0 192.168.7.251 UG 0 LAN & WLAN


Ipconfig Results from Client:
IPv4 Address. . . . . . . . . . . : 192.168.6.6(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.252
Default Gateway . . . . . . . . . :
DHCP Server . . . . . . . . . . . : 192.168.6.5
Sponsor
stunsm
DD-WRT Novice


Joined: 17 Mar 2017
Posts: 3

PostPosted: Sat Mar 18, 2017 2:31    Post subject: Reply with quote
Adding the following lines to the firewall seems to have solved the issue:
iptables -I INPUT -i tun+ -j ACCEPT
iptables -I FORWARD -i tun+ -j ACCEPT
stunsm
DD-WRT Novice


Joined: 17 Mar 2017
Posts: 3

PostPosted: Sat Mar 18, 2017 13:37    Post subject: Reply with quote
Initially, it was configured as a router:
ISP Gateway -> (Lan to WAN) Router with OpenVPN -> (LAN to WAN) Routers for other subnets.
When I took the ISP gateway out, and switched the router with OpenVPN to gateway, I started having these issues.

Thanks for the advice about Server configuration, I had initially tried to configure that way but ran into the same issue I was having, where OpenVPN would connect, but could not communicate. Now that I have a working (although not ideal) configuration, I'll put some time into getting it running properly in server mode. Thanks!
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum