Assign a public ip to openvpn client

This forum is to discuss and rate service providers of OpenVPN and similar services. THIS IS NOT A FREE ADVERTISEMENT. All posts have a poll with a rating of 1 to 5, with 5 being best, to rate the quality of service, etc.
Forum rules
1) You must create a poll with 5 options, Do Not Recommend (1), Poor (2), Acceptable (3), Would Recommend (4), Strongly Recommend (5).
2) This is not a free advertisement for providers, but a place to review those providers.
3) Polls which are found to be doctored by providers will be locked to a rating of 1 and the source of the spoofing will be revealed to all, including Google.
Elmasry
OpenVpn Newbie
Posts: 7
Joined: Wed Jul 22, 2015 7:10 am

Assign a public ip to openvpn client

Postby Elmasry » Wed Jul 22, 2015 7:13 am

For learning purposes, I'm trying to set up openvpn server, so that each connected client would get a unique public ip address.

I have a vps server and I ordered extra 8 static ips and they are rerouted to the vpn server.

What I have so far: - Ubuntu server 14.04 - Working openvpn server and client in tun mode

Current status: All clients connected to openvpn server get assigned the ip address 37.xxx.xxx.112

Plan: Each connected client (Linux pcs running Ubuntu 14.04 as well) gets assigned one of those 8 static ips. They are in the range 46.38.230.249 to 46.38.230.256, but they could have been also non sequential.

I'm just trying to wrap my head around the whole thing, so please help me out:

First solution:

For each user assign a fixed ip:

Add the following line to client1

Code: Select all

ifconfig-push 46.38.230.249 10.8.0.5


And using iptables nat do a prerouting/postrouting between this public ip and some internal ip in that subnet, for example 10.8.0.6 Drawback: No IP pool. One fixed IP per user

Second Solution:

Use ifconfig-pool to assign a pool to the users, BUT 1. This option seems to be used for specifying an internal ip pool not external one 2. It can not be specified multiple times, but what if I have several pools, subnet masks

So to wrap up my question: How to configure openvpn server to allocate a unique public IP address from ip several pools?

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

Re: Assign a public ip to openvpn client

Postby Traffic » Thu Jul 23, 2015 9:26 am

OpenVPN assigns VPN IP addresses not public IP addresses ..

Elmasry
OpenVpn Newbie
Posts: 7
Joined: Wed Jul 22, 2015 7:10 am

Re: Assign a public ip to openvpn client

Postby Elmasry » Thu Jul 23, 2015 6:21 pm

Ok, but after connecting to the openvpn server and querying my PC public IP, I can see that it is the same as the server's public ip

Is this because the client connected to that server and thus obtained its public IP? or did OpenVPN "pushed" that public IP somehow to the server??

Elmasry
OpenVpn Newbie
Posts: 7
Joined: Wed Jul 22, 2015 7:10 am

Re: Assign a public ip to openvpn client

Postby Elmasry » Thu Jul 23, 2015 8:03 pm

Or maybe I should ask this differently....

OpenVPN is running on eth0

I have a bunch of IPs, each defined as its own network interface eth0:0, eth0:1, etc...
This works fine and I'm able to ping/ssh the server on these interfaces.

The main eth0 IP those of eth0:x are in different subnets, hence I cannot connect to OpenVPN via these IPs
Should I create bridges between the main IP and each of those IPs, or should I route their traffic to the main IP?

This all probably sounds quite noob I know, but I'm clueless here

Thanks

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

Re: Assign a public ip to openvpn client

Postby Traffic » Sat Aug 01, 2015 6:33 pm

please post your server and client configs


Return to “Pay OpenVPN Service Provider Reviews/Comments”

Who is online

Users browsing this forum: No registered users and 2 guests