I believe I took this a bit further than I needed. Right now I have two public IP's on a VPS. I have a single openvpn client that I wish to connect. I want this client to get the secondary IP.
On Thu, Feb 25, 2016 at 3:49 AM, Jan Just Keijser <[email protected]> wrote: > Samuel Seidel wrote: > >> I have purchased OpenVPN 2 Cookbook, was only able to find information to >> do this if you had access to a block of IP's. Mine our non-contiguous. >> >> handing out non-contiguous IPs is definitely possible, but you are right > in the sense that no info is given in the book on this - it depends too > much on your particular situation. > > Let's say you have N clients and X public IPs. > If N <= X then you can assign IPs to each client and hand them out using a > client-connect script (or using a custom --ifconfig-pool-persist file) > if N > X then you must rotate the assignment of public IPs. This is doable > using a client-connect + client-disconnect script. I'd abuse a directory as > a poor-man's database in this case: > 1) list all public IPs as zer0-length files, i.e. > IP1 > IP2 > IP3 > etc > 2) whenever a client connects, check if an IP was already assigned by > looking for a file "<client-name>-IPn" ; if found, return the IP > 3) if not found, the search for an available public IP and rename that > file to <client-name>-IPn > 4) on disconnect, rename the file "<client-name>-IPn" back to IPn > > Also, make sure to use --explicit-exit-notify to ensure that clients > signal a disconnect in time. This can be pushed from the server using > push "explicit-exit-notify 3" > > It'll take some hacking to get it right, but the above idea should > definitely work . > > HTH, > > JJK > > > On Wed, Feb 17, 2016 at 4:52 AM, Jan Just Keijser <[email protected] >> <mailto:[email protected]>> wrote: >> >> Hi Samuel, >> >> Samuel Seidel wrote: >> >> A: Server - A server with non-contiguous IP's, which each may >> have separate gateways, from any substandard vps hosting provider >> Two static public IP addresses, for example: 203.0.113.101 >> 203.0.114.202 >> >> B: Client - Pfsense and/or Openwrt, has a dynamic IP, for example: >> 203.0.115.1 >> >> Premise: A person wants to host a web server, and some other >> services, through a home router (B). He wishes to benefit from >> having a dedicated, non-changing, IP from which people can >> access his servers from, and he also wishes to benefit from >> having a better backbone connection, then his Comcast >> connection can provide, and additionally the benefit of >> compression. >> How can he assign one of the IP's from Server A, to a client, >> like a router for example, or maybe just a windows computer? >> How can one accomplish this using openvpn? >> >> My Goal: >> My goal today is to be able to setup an openvpn server and for >> a device to then connect and then be IPv4 publicly accessible >> from the internet. I know I could accomplish this by handing >> out a private address and 1:1 natting a public IP to it with >> IPTables, but the goal is to make it transparent to the host, >> and allow for applications to bind directly to the IP without >> throwing errors. >> >> ------------------------------------------------------------------------ >> >> this is explained in detail in both my OpenVPN 2 Cookbook and the >> book "Mastering OpenVPN". It is perfectly possible to do this in >> both TUN and TAP mode. >> >> HTH, >> >> JJK >> >> Hints: "topology subnet" + use proxy arp >> >> >> >
------------------------------------------------------------------------------
_______________________________________________ Openvpn-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-users
