5

I have a custom/experimental device (D) on my home LAN with a static IP running an HTTP server. For reasons that are not important to this question, (D) cannot run mDNS. I have another full-fledged Ubuntu Server (S) on the same LAN*. I would like the server S to broadcast and respond to mDNS on behalf of D. Can this be done?

I can see that avahi can be configured to advertise arbitrary services but it is not clear if/how this can be done when the services are on another machine altogether.

*(connected to the same Ethernet switch for the moment)

1 Answer 1

8

Yes, any host can respond to any mDNS name with any DNS records it wants.

  1. If you only want to make the plain hostname (foo.local) resolvable through mDNS, define it in the /etc/avahi/hosts file. See avahi.hosts(5).

    192.168.1.37       toaster.local
    2001:db8:108:2::37 toaster.local
    

    The system will now respond to mDNS queries for all names listed in this file, and will provide the corresponding IP addresses.

  2. If you additionally want to publish DNS-SD services on behalf of another system, you can do so using Avahi *.service files. See avahi.service(5) for more details.

    You can specify any hostname you want in the <host-name> tag when defining the service, as long as it's already resolvable by itself (that is, you must do step #1 first in order for this to work).

    <?xml version="1.0"?>
    <service-group>
        <name>Toaster</name>
        <service>
            <type>_sftp-ssh._tcp</type>
            <host-name>toaster.local</host-name>
            <port>22</port>
        </service>
    </service-group>
    

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .