All Clients Showing the Same IP Address

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
User avatar
ynagy
OpenVpn Newbie
Posts: 9
Joined: Mon Apr 04, 2016 8:33 pm
Location: Toronto, ON Canada

All Clients Showing the Same IP Address

Post by ynagy » Mon Apr 04, 2016 9:52 pm

I just wondering if someone can help and I apologies if I posted on the wrong place.

I have OpenVPN working great for the last number of months with no single issue. I have configured the OpenVPN server as a routed configuration connected to 3 branches for varies usage and IP phones. It seems everything working fine but the issue now on the PBX all connection showing from the same IP address which is the OpenVPN server.
The question, how can I show the branches IP addresses instead of the OpenVPN server?

User avatar
ynagy
OpenVpn Newbie
Posts: 9
Joined: Mon Apr 04, 2016 8:33 pm
Location: Toronto, ON Canada

Re: All Clients Showing the Same IP Address

Post by ynagy » Tue Apr 05, 2016 10:40 am

Shall I change the configuration from routed to bridging configuration?

User avatar
Traffic
OpenVPN Protagonist
Posts: 4081
Joined: Sat Aug 09, 2014 11:24 am

Re: All Clients Showing the Same IP Address

Post by Traffic » Tue Apr 05, 2016 11:06 am

Please see the Forum rules (top of page)

User avatar
ynagy
OpenVpn Newbie
Posts: 9
Joined: Mon Apr 04, 2016 8:33 pm
Location: Toronto, ON Canada

Re: All Clients Showing the Same IP Address

Post by ynagy » Tue Apr 05, 2016 12:26 pm

Sorry I forget to include server and client configuration with the initial post.

Server configuration:

Code: Select all

local 172.16.71.202
port 1194
proto udp
dev tun
ca /etc/openvpn/easy-rsa/keys/ca.crt
cert /etc/openvpn/easy-rsa/keys/OpenVPN-Server.crt
key /etc/openvpn/easy-rsa/keys/OpenVPN-Server.key
dh /etc/openvpn/easy-rsa/keys/dh2048.pem
server 172.16.171.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "route 172.16.71.0 255.255.255.0"
push "route 172.16.171.0 255.255.255.0"
push "route 172.16.172.0 255.255.255.0"
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS xxx.xxx.xxx.xxx"
push "dhcp-option DNS xxx.xxx.xxx.xxx"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
client-to-client
keepalive 10 120
tls-auth /etc/openvpn/easy-rsa/keys/ta.key 0
cipher AES-128-CBC
comp-lzo
max-clients 10
user nobody
group nogroup
persist-key
persist-tun
status /var/log/openvpn/serverUDP1194-status.log 20
log-append  /var/log/openvpn/serverUDP1194.log
verb 1
push "explicit-exit-notify 3"
Client Configuration:

Code: Select all

client
dev tun
proto udp
remote openvpn.mydomain.com 1194
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun
<ca>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</ca>

<cert>
-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----
</cert>

<key>
-----BEGIN PRIVATE KEY-----
-----END PRIVATE KEY-----
</key>

<tls-auth>
-----BEGIN OpenVPN Static key V1-----
-----END OpenVPN Static key V1-----
</tls-auth>
ns-cert-type server
key-direction 1
cipher AES-128-CBC
comp-lzo
verb 1

User avatar
Traffic
OpenVPN Protagonist
Posts: 4081
Joined: Sat Aug 09, 2014 11:24 am

Re: All Clients Showing the Same IP Address

Post by Traffic » Tue Apr 05, 2016 12:34 pm

Have you enabled iptables NAT on your server ?

User avatar
ynagy
OpenVpn Newbie
Posts: 9
Joined: Mon Apr 04, 2016 8:33 pm
Location: Toronto, ON Canada

Re: All Clients Showing the Same IP Address

Post by ynagy » Tue Apr 05, 2016 1:57 pm

Yes, I have enabled the net.ipv4.ip_forward=1 on /etc/sysctl.conf

I also created a script with the following:

Code: Select all

#!/bin/sh
iptables -t nat -A POSTROUTING -s 172.16.171.0/24 -o eth0 -j SNAT --to-source 172.16.71.202
iptables -t nat -A POSTROUTING -s 172.16.172.0/24 -o eth0 -j SNAT --to-source 172.16.71.202
to run in /etc/network/interfaces

Code: Select all

auto eth0
allow-hotplug eth0
iface eth0 inet static
        pre-up /etc/firewall-openvpn-rules.sh
address 172.16.71.202
netmask 255.255.255.0
network 172.16.71.0
broadcast 172.16.71.255
gateway 172.16.71.1
Is this what do you you mean? or you mean something different? Am I missing anything?

User avatar
Traffic
OpenVPN Protagonist
Posts: 4081
Joined: Sat Aug 09, 2014 11:24 am

Re: All Clients Showing the Same IP Address

Post by Traffic » Tue Apr 05, 2016 2:23 pm

This is NAT (Read about it):
ynagy wrote:

Code: Select all

#!/bin/sh
iptables -t nat -A POSTROUTING -s 172.16.171.0/24 -o eth0 -j SNAT --to-source 172.16.71.202
iptables -t nat -A POSTROUTING -s 172.16.172.0/24 -o eth0 -j SNAT --to-source 172.16.71.202
It is also the reason all your clients appear to be the server.

You must configure a fully routed network .. This is the openvpn HOWTO:
HOWTO: Expanding the scope of the VPN to include additional machines

User avatar
ynagy
OpenVpn Newbie
Posts: 9
Joined: Mon Apr 04, 2016 8:33 pm
Location: Toronto, ON Canada

Re: All Clients Showing the Same IP Address

Post by ynagy » Tue Apr 05, 2016 2:39 pm

Thank you so much for the quick reply but I am not that technical person ... I am covering additional role added to me since they fired the network guy.

Would you mind to explain a bit more in what I should do ...

User avatar
Traffic
OpenVPN Protagonist
Posts: 4081
Joined: Sat Aug 09, 2014 11:24 am

Re: All Clients Showing the Same IP Address

Post by Traffic » Tue Apr 05, 2016 7:47 pm

If you give me remote access I can do it for you .. for a fee.

User avatar
ynagy
OpenVpn Newbie
Posts: 9
Joined: Mon Apr 04, 2016 8:33 pm
Location: Toronto, ON Canada

Re: All Clients Showing the Same IP Address

Post by ynagy » Tue Apr 05, 2016 11:13 pm

How much would you charge? and how long do you need?

User avatar
Traffic
OpenVPN Protagonist
Posts: 4081
Joined: Sat Aug 09, 2014 11:24 am

Re: All Clients Showing the Same IP Address

Post by Traffic » Tue Apr 05, 2016 11:35 pm

See my profile 8-)

User avatar
ynagy
OpenVpn Newbie
Posts: 9
Joined: Mon Apr 04, 2016 8:33 pm
Location: Toronto, ON Canada

Re: All Clients Showing the Same IP Address

Post by ynagy » Wed Apr 06, 2016 5:40 pm

I have applied the changes as per your recommendation with no luck ... All clients still showing the server "OpenVPN" IP address. Would could be other suggestion(s)?

DemonRok
OpenVpn Newbie
Posts: 1
Joined: Tue May 12, 2020 8:20 pm

Re: All Clients Showing the Same IP Address

Post by DemonRok » Tue May 12, 2020 8:22 pm

Traffic wrote:
Tue Apr 05, 2016 7:47 pm
If you give me remote access I can do it for you .. for a fee.
Can you share the solution, i'have the same problem.

Thanks!

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 7145
Joined: Fri Jun 03, 2016 1:17 pm

Re: All Clients Showing the Same IP Address

Post by TinCanTech » Tue May 12, 2020 8:41 pm

DemonRok wrote:
Tue May 12, 2020 8:22 pm
Can you share the solution
See posting.php?mode=reply&f=4&t=21452#pr60564

Post Reply