Hosts

Polytropon freebsd at edvax.de
Sun Feb 28 16:05:45 UTC 2016


On Sun, 28 Feb 2016 10:54:40 +0100, JosC wrote:
> Is there a wayI can link domain names to MAC addresses instead to IP 
> addresses?

No, host names are bound to IP (as MAC addresses are a different layer).



> Used to give some internal harware fixed ip's and described that in my 
> /etc/hosts file, but as for some I use DHCP, I cannot use that anymore.

You can use a "cascaded approach". If you use DHCP to provide IP
addresses, provide them on the basis of MAC addresses. You can
do that with the dhcpd.conf configuration file:

	host domain1 {
		hardware ethernet 00:12:34:56:78:90;
		fixed-address 192.168.1.101;
	}

	host domain2 {
		hardware ethernet aa:bb:cc:dd:ee:ff;
		fixed-address 192.168.1.102;
	}

Then you can use those addresses in the hosts configuration file:

	192.168.1.101	domain1.example.com	domain1
	192.168.1.101	domain1.example.com.

	192.168.1.102	domain2.example.com	domain2
	192.168.1.102	domain2.example.com.

So the MAC 00:12:34:56:78:90 will be associated with domain1.example.com,
and aa:bb:cc:dd:ee:ff with domain2.example.com.

I hope I didn't misinterpret your question. Is that what you were
searching for?




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...


More information about the freebsd-questions mailing list