Clients Public IP wrong

This forum is for admins who are looking to build or expand their OpenVPN setup.
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
cacodemon79
OpenVpn Newbie
Posts: 1
Joined: Tue Sep 28, 2021 1:44 pm

Clients Public IP wrong

Post by cacodemon79 » Tue Sep 28, 2021 2:07 pm

Hi, I am trying to set up my openvpn network but I have a problem.

My LAN configuration is as follows:
- main router Zyxel 192.168.1.1 acting as gateway (vdsl connection) and access point
- openwrt router TD-W8970 192.168.1.2 acting as access point and vpn server (10.212.79.1)

What I want to do is to create a VPN network with clients that must send internet requests only through my LAN gateway; in other words, I want that the clients public IP shown on internet is the one of my LAN gateway and not the one assigned to them by their ISP.

Here below my configuration:

server.conf

user nobody
group nogroup
dev tun
port 1194
proto udp
server 10.212.79.0 255.255.255.0
topology subnet
client-to-client
keepalive 10 60
persist-tun
persist-key
verb 3
push "persist-tun"
push "persist-key"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "route 192.168.1.0 255.255.255.0"

ca /etc/easy-rsa/pki/ca.crt
cert /etc/easy-rsa/pki/issued/server.crt
key /etc/easy-rsa/pki/private/server.key
dh /etc/easy-rsa/pki/dh.pem
tls-auth /etc/easy-rsa/pki/ta.key 0


client.conf

dev tun
proto udp
remote myserver_xyz.com 1194 udp
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun

ca ca.crt
cert client1.crt
key client1.key
remote-cert-tls server
tls-auth ta.key 1

cipher AES-256-CBC
verb 3


The openvpn network is established correctly and the client is able to ping vpn server 10.212.79.1 and navigate in Internet.

The problem is that the IP shown on Internet is the one assigned to client by its ISP and not the one of the LAN where the vpn server is located.

I tried to perform some changes in server configuration but with no success.

I also tried to put push "redirect-gateway def1" or push "redirect-gateway autolocal" but in this cases the client stopped to go to internet at all.

Can you please help me?

Thanks in advance :)

Post Reply