Discussion:
[Openvpn-users] Get tunnel server's IP address on client
s***@keemail.me
2017-03-29 09:26:04 UTC
Permalink
I'm trying to get the tunnel server's IP address on the client, independent of the configuration file. For instance, I don't want to rely on default routes to identify the server's IP address for the tunnel.
I tried to use environmental variables with `--up`, but couldn't identify the server's IP.
ifconfig_local:is the client's IP for the tunnel.
ifconfig_remote:Should be the server's IP for the tunnel - from what I understand, but does not reflect the IP correctly for me.

Server config:
port 443proto udpdev tunserver 172.16.0.0 255.255.255.0ca /etc/openvpn/server/ca.crtcert /etc/openvpn/server/stretch-server.crtkey /etc/openvpn/server/stretch-server.keydh /etc/openvpn/server/dh4096.pemtls-auth /etc/openvpn/server/static.key 1tls-version-min 1.2tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384cipher AES-256-CBCauth SHA512verb 3log-append /etc/openvpn/server/log/stretch-server.logcomp-lzoduplicate-cnncp-disable

Client config:
clientverb 3port 443proto udpdev tunremote 192.168.178.150 443ca /etc/openvpn/client/ca.crtcert /etc/openvpn/client/stretch-client.crtkey /etc/openvpn/client/stretch-client.keytls-auth /etc/openvpn/client/static.key 0remote-cert-tls servertls-version-min 1.2tls-cipher TLS-DHE-RSA-WITH-AES-256-GCM-SHA384cipher AES-256-CBCncp-disableauth SHA512redirect-gateway def1comp-lzonobind
Client IP (`ip address for tun0`):  172.16.0.14Server IP (`ip address for tun0`): 172.16.0.1
echo $ifconfig_remote = 172.16.0.13echo $ifconfig_local  = 172.16.0.14
The ifconfig_remote variable does not reflect the server's tunnel IP address. I don't know what the .13 is supposed to be.

How do I get that IP address on the client?
Selva Nair
2017-03-29 15:54:41 UTC
Permalink
This post might be inappropriate. Click to display it.
s***@keemail.me
2017-03-29 19:07:05 UTC
Permalink
Hello!
I can not alter the configuration on the server, I can add options on the client side, but that's it.Is there no other way?
Kind regards,SaAtomic
Post by Selva Nair
Hi,
Client IP (`ip address for tun0`):  172.16.0.14>> Server IP (`ip address for tun0`): 172.16.0.1
echo $ifconfig_remote = 172.16.0.13>> echo $ifconfig_local  = 172.16.0.14
The ifconfig_remote variable does not reflect the server's tunnel IP address. I don't know what the .13 is supposed to be.
How do I get that IP address on the client?
If possible switch to topology subnet -- its much better.
In topology net30, the remote end is identified by the first address of the /30 network.  If you use topology subnet you will get the actual server address in $route_vpn_gateway and $ifconfig_remote.
That said, to get the server's vpn address in topology net30 you could use $route_network_1. This is a hack as its dependent on the current behaviour that the first route pushed is the one to the server.
Selva
Selva Nair
2017-03-29 21:16:06 UTC
Permalink
Post by s***@keemail.me
Hello!
I can not alter the configuration on the server, I can add options on the
client side, but that's it.
Is there no other way?
Then try $route_network_1 (see my previous email).

Selva

Continue reading on narkive:
Loading...