lars2000
Posts: 7
Joined: Mon Apr 04, 2016 1:44 am

Remote connection using hostname with dynamic IP

Mon Apr 04, 2016 2:15 am

Hello,

I would like to be able to access my raspberry pi 3 from windows via remote desktop connection using a hostname instead of an ip address. My goal is to have a portable solution, where my raspberry pi will attempt to claim it's hostname on any network it is connected to, and I can connect to it from my laptop. I would like to use the most non invasive technique possible. I have searched the internet for other solutions, but Im not sure how they apply directly to my situation. Is there anyway to accomplish this without a third party software or having the rasp pi act as a server?

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Remote connection using hostname with dynamic IP

Mon Apr 04, 2016 9:24 am

I understand that it should be possible with Windows 10, although I haven't got around to testing it myself.

Otherwise you need some third-party software on the Windows PC to implement the Avahi/Bonjour zero-configuration name service. The easiest way to get that is to install iTunes or Apple's printer sharing software.

I understand that Avahi is installed already on the latest Raspbian releases, so you shouldn't need to do anything with the Pi.

vk4tec

Re: Remote connection using hostname with dynamic IP

Mon Apr 04, 2016 10:54 am

It is important to distinguish between

MAC address
TCP/IP address
Host name

I remote into my Pi but it's static

Andrew

User avatar
liudr
Posts: 687
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA
Contact: Website

Re: Remote connection using hostname with dynamic IP

Mon Apr 04, 2016 2:15 pm

What about dynamic DNS? That has been solution for PC's. Some DDNS services are easy to refresh, requiring a simple http get command that might be doable via startup scripts.
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's

lars2000
Posts: 7
Joined: Mon Apr 04, 2016 1:44 am

Re: Remote connection using hostname with dynamic IP

Mon Apr 04, 2016 10:57 pm

liudr wrote:What about dynamic DNS? That has been solution for PC's. Some DDNS services are easy to refresh, requiring a simple http get command that might be doable via startup scripts.
Yeah that's the conclusion I came to before. It just seems like overkill for wanting to access rapsberry pi on a local network. All the ddns solutions I've come across, like the one below, want you to sign up for an account, etc, etc. I think they're are geared toward internet access, im not looking for that, just local network.

http://ip.raspctl.com/

It seems like one should be able to edit a file specifying a name to attach to the current IP address. If I could find out how to do this I could script it to update every time I get a new IP.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Remote connection using hostname with dynamic IP

Mon Apr 04, 2016 11:29 pm

Your problem is that the Windows PC does not know the address of the Pi. So editing anything on the Pi is not going to help.

If the Pi had a static address you could put that into the hosts file on the Windows PC, but I think you said you want to stick with a dynamic address.

User avatar
liudr
Posts: 687
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA
Contact: Website

Re: Remote connection using hostname with dynamic IP

Tue Apr 05, 2016 2:16 am

You never mentioned raspberry pi on a local network. Unless you run some domain server you will not be able to resolve name into ip address.
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: Remote connection using hostname with dynamic IP

Tue Apr 05, 2016 7:18 am

If you are so dead set against putting any third-party software on the Windows PC, then you could write your own solution, but writing network code of that variety is not what I would call a newbie project.

You would need one program for the Pi that ran all the time and broadcast its address and name every thirty seconds or so, and one for the Windows PC that listened for those broadcasts and wrote the contents into the Windows hosts file.

lars2000
Posts: 7
Joined: Mon Apr 04, 2016 1:44 am

Re: Remote connection using hostname with dynamic IP

Wed Apr 06, 2016 1:42 am

Thanks guys, I went with a samba solution, running a samba server boot, the configuration file has options to make the pi visible to Windows. I just get an icky feel about ddns services that make it a point to promote themselves as free and require an account creation... for this project at least.

lars2000
Posts: 7
Joined: Mon Apr 04, 2016 1:44 am

Re: Remote connection using hostname with dynamic IP

Sun Apr 10, 2016 8:18 pm

Just to clarify for anyone who may read this post, I also installed xrdp, I combination of samba and xrdp gets me the results I am looking for. Not sure if both are necessary to get the desire results, because I have not gone back to investigate and probably will not for a while.

Return to “General discussion”