3

My linux desktop machine is running Kubuntu 16.04 Desktop LTS (Debian based linux); running a the KDE Plasma Desktop. To connect to the LAN I've simply configured the WiFi GUI (cable is not an option due to building), pointed it to the router and filled the password. Works just fine without problems.

However, the IP address allocated to my machine is handed via the DHCP server running on the router. Currently it's 192.168.0.34 but from day to day it changes depending on if I've switched off my machine, the router gets power cycled etc.

There are some options in the router under 'DHCP Reservation' which allows me to reserve a fixed IP address based on the MAC address of my WiFi card.

I have a MacBook and I like to SSH to the Linux machine so I can work anywhere in the house and garden. Usually I alter the /etc/hosts file on the MacBook and make an association mylinuxbox 192.168.0.34.

Without using DHCP Reservation, I would have to continuously change the /etc/hosts file to match the current DHCP Allocated IP Address.

Is there a way for the Linux machine to broadcast its IP address on the LAN?

If so, how is this done and is this a secure and acceptable practice?

Would fixing the IP on the router using DHCP Reservation be a better solution?

4

You can try to install Avahi, which is the Linux implementation of Zeroconf (known as Bonjour in Apple Mac/iOS environments), and set it to advertise your host as <hostname>.local.

All it takes is to install the following packages:

sudo apt-get install avahi-daemon avahi-dnsconfd avahi-discover avahi-utils libnss-mdns

You can find more details at https://askubuntu.com/questions/460371/trouble-using-ssh-and-avahi

3

You can use avahi.

Make sure avahi is running:

sudo service avahi-daemon status

If it's not running start it:

sudo service avahi-daemon start

then you can replace your ip with host-name.local while using ssh.

host-name is your host name

0

First of all, setting a static IP address for your main devices is a smart idea, and a must if you are running servers that need to be port forwarded. Second, you should just be able to fill in the IP address with the hostname on most Linux/Unix OSes out of the box (without using /etc/hosts). Try just using ssh mylinuxbox when mylinuxbox is the remote computers hostname.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.