You are not logged in.

#1 2013-01-11 06:27:36

boblitz13
Member
Registered: 2012-08-14
Posts: 19

[SOLVED] dhcp host names

I'm trying to set a host name for myself when using dhcpcd. I have tried both hostnamectl and the hostname variable in dhcpcd.conf. Still, when I try to open an ssh session from another computer, it does not recognize the hostname that I've designated. It looks like DDNS is required for dhcp host names if I'm not mistaken. Would setting DDNS up for my public IP address allow dhcp host names for the router connected to it?

Last edited by boblitz13 (2013-01-16 22:10:51)

Offline

#2 2013-01-11 07:17:11

chris_l
Member
Registered: 2010-12-01
Posts: 387

Re: [SOLVED] dhcp host names

I'm not sure if I understood.
You have a server, lets say its hostname is myserver
and that server has a dhcp server installed. And when you try to ssh to the remote machine, from a machine that got its ip from the server (in another words, on the same lan), by doing ssh myserver, it fails.

To be able to do it you have to do ssh <ip of your server> instead, and you would prefer to be able to do it using the hostname, and without requiring to link the server name using the local /etc/hosts from your client pc?

If something like that is the case, then install dnsmasq on the server. Then add the desired names to the /etc/hosts on your server.
That way, you could add names to every single machine on your lan, and every machine would be able to use those names without having to edit the local /etc/hosts of each one.

Am I right? thats what you meant?


"open source is about choice"
No.
Open source is about opening the source code complying with this conditions, period. The ability to choose among several packages is just a nice side effect.

Offline

#3 2013-01-11 07:53:49

boblitz13
Member
Registered: 2012-08-14
Posts: 19

Re: [SOLVED] dhcp host names

No, I looked back at my original post, and I didn't explain that very well. I am behind a wireless router that is configured to act as a dhcp server. Currently the router lists my laptop by its host name in the list of devices connected wirelessly but when I log onto another computer on the network and try to connect to this first computer through ssh using the host name, the host name is not recognized. I was wondering what I need to configure either in Arch or on my router to get my dhcp host name recognized on my network.

Offline

#4 2013-01-11 08:11:43

chris_l
Member
Registered: 2010-12-01
Posts: 387

Re: [SOLVED] dhcp host names

Oh I see. Well, is not exactly what I though, but sill can be solved by using dnsmasq.

If your router has DNS, then you only need it to resolve your hostname by the ip. Normally, in my experience, just because the router can detect your hostname, does not pass it to the machines on the lan, You need to specify it using a DNS.
Again, if your router has DNS, just add your laptops ip and its hostname there. (using the router is the easiest way)

If your router does not have DNS, you can configure a DNS server. And thats what dnsmasq is. install dnsmasq on a machine on your lan, and that machine will become your dns server, and add your laptop ip and hostname on the /etc/hosts there.

Now, you'll need that the other machines use your DNS server.
If they run linux, add the ip of the server to /etc/resolv.conf.head of each machine, or, if your router allows it, change the parameters of dhcp, so it assigns the ip of your server as default DNS.

Read the wiki article Dnsmasq, for more information. And, read your router manual to see if it has DNS service.

(A less perfect, but more simple aproach is to add the ip and hostname of your laptop on the /etc/hosts of the  machine where you are trying to use ssh; it will work only on that machine, but is faster and easier)


"open source is about choice"
No.
Open source is about opening the source code complying with this conditions, period. The ability to choose among several packages is just a nice side effect.

Offline

#5 2013-01-13 16:52:24

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: [SOLVED] dhcp host names

If the machine running sshd always gets the same ip, you can also just configure an alias in /etc/ssh/ssh_config on the machine from which you are connecting. That is, if you just don't want to have to type/remember the ip address. This isn't the same as getting the machine to recognise the hostname so whether it counts as a solution will depend on what particular problem you are trying to solve.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#6 2013-01-16 22:10:33

boblitz13
Member
Registered: 2012-08-14
Posts: 19

Re: [SOLVED] dhcp host names

Thanks for the help. I think DNS on the router is the way for my setup. Marking as solved.

Offline

Board footer

Powered by FluxBB