Published on June 6, 2025
Go homeExposing a machine on a local network through SSH with Avahi
Steps to expose a machine on a local network through SSH and Avahi.
- Make sure Avahi is installed on both machines.
sudo pacman -S avahi
- 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
- 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>
- Enable the
avahi-daemon.service
sudo systemctl enable --now avahi-daemon.service
- Ensure
sshd
is running on the guest machine
sudo systemctl enable --now sshd.service
- 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