Determine the current dynamic IP address of a computer through VPN?

0

I have a Linux office desktop at a university, and I have VPN to access it from home (using SSH & VNC). The problem is that the desktop gets assigned a different address every time it is booted, so practically I cannot access it. I have administrator rights on the desktop, but no influence on anything else on the university network, its DHCP and DNS etc.

Is there a way to determine the address currently assigned to the desktop remotely through the VPN?

I have read about Avahi / Zeroconf, but I have to say that I found the documentation basically incomprehensible, and I've read that it does not work via VPN.

I once managed to find it through nmap -p 22 --open -sV, but I imagine the networks admins won't like it if I do that often, and also I just got lucky that the current address was in the same /24 block as the last one I knew.

I know about Dynamic DNS, but I'm not clear about whether that can be used to assign an address that only works within a LAN.

A. Donda

Posted 2020-01-27T20:04:29.113

Reputation: 660

In the case of using dynamic DNS, the university probably already has a DNS server on its intranet for internal-use websites & named servers. If you can connect to the intranet over VPN already, that DNS server probably has a static IP that you may use to query for named hosts on the network. You may need the help of the university IT in order to register your PC's dynamic IP with their internal DNS each time it boots though. It would be much less complicated to just ask them for a static IP. – Romen – 2020-01-27T20:13:37.517

@Romen, I didn't want to burden the question with this detail, but I already have worked with the university IT to get a DNS lookup. It worked for a while and then stopped again. This question is specifically what I could do assuming that I have "no influence on anything else on the university network, its DHCP and DNS etc.". – A. Donda – 2020-01-27T20:26:49.237

Well, any dynamic DNS service like no ip or freedns would not be of any use to you, since the university IP address would be all they could help you find; Which you already have. Dynamic DNS is not an option at all if the university IT cannot provide reliable intranet DNS server for you.

– Romen – 2020-01-27T20:30:29.980

Are you familiar with Javascript & developing with node.js? It would be possible to build your own quick & dirty system to have the desktop report its internal IP to your own server with a HTTP POST on bootup. – Romen – 2020-01-27T20:34:16.620

@Romen, re JS & node, not an expert but I can manage. I also have file sharing via Seafile between the two computers, so I thought about having a script that writes the new IP address to a shared file. – The problem then is that e.g. the Remmina VNC client that I use would not know how to access that information. I researched about a user-local ~/.hosts file (which I could sync) but as far as I can tell, nothing like that exists. – A. Donda – 2020-01-27T20:50:02.563

1@romen No need for JS and Node. Something like a cron job or some startup script doing curl "http://your.external.system)/$(ip address show enpxxxxxx | grep -Po '(?<=inet )[0-9.]+')" to an external server where the OP can watch the logs is enough (replace enpxxxxxx by actual name of the Ethernet link). You can also use a simple mail client to send this info to some external mail address, either on startup or better when the interface connects. – xenoid – 2020-01-27T21:00:17.987

Off-topic: As per https://superuser.com/help What topics can I ask about here?... If you have a question about ... and it is not about... issues specific to corporate IT support and networks...

– K7AAY – 2020-01-27T21:07:03.493

@romen you can use a dynamic dns service for that. At least no-ip does not check for private addresses. Try to resolve sciuro.hopto.org. – Eduardo Trápani – 2020-01-27T21:28:50.540

Answers

1

I can tell you what I have working. Install inadyn and setup a free account with www.noip.com. Then create your host. I don't know if other dynamic DNS services check for private addresses, but no-ip does not.

Install and configure inadyn to work as a daemon and get the public address of the computer (though that is NOT what you want in the end, that will be some university gateway). Check the man page for details.

Again, you could use other updaters, but inadyn is the one I use.

Once you have your updates working you can change the config file to get its address from a specific interface. In Debian Linux you would change the /etc/inadyn.conf file so that it includes a line like this (remove other iface if they are there):

iface your_interface

Restart the service, that's it.

Eduardo Trápani

Posted 2020-01-27T20:04:29.113

Reputation: 541

Thanks! Do I understand correctly that iface your_interface would determine the LAN address of the computer and send that to noip? – A. Donda – 2020-01-28T17:43:08.900

1@A.Donda yes, exactly, that's what happens. Without iface, inadyn tries to figure out your public address, if you tell it which interface to get the address from, it will use that as the address to update in noip. – Eduardo Trápani – 2020-01-28T18:24:32.130