Bradley Kirton's Blog

Published on June 6, 2025

Go home

Exposing a machine on a local network through SSH with Avahi

Steps to expose a machine on a local network through SSH and Avahi.

  1. Make sure Avahi is installed on both machines.
sudo pacman -S avahi
  1. Configure Avahi on the guest machine /etc/avahi/avahi-daemon.conf
[server]
host-name=your-hostname
domain-name=local
use-ipv4=yes
use-ipv6=yes

[publish]
publish-addresses=yes
publish-hinfo=yes
publish-workstation=yes
publish-domain=yes
  1. Create an Avahi SSH service /etc/avahi/services/ssh.service
<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
  <name replace-wildcards="yes">%h SSH</name>
  <service>
    <type>_ssh._tcp</type>
    <port>22</port>
  </service>
</service-group>
  1. Enable the avahi-daemon.service
sudo systemctl enable --now avahi-daemon.service
  1. Ensure sshd is running on the guest machine
sudo systemctl enable --now sshd.service
  1. Test
avahi-browse -t _ssh._tcp

avahi-resolve -n your-hostname.local

It may be worth installing UFW and enabling SSH on the guest machine.

sudo pacman -S ufw
sudo ufw allow ssh