On Sat, 05 May 2018 20:32:00 +0200, Andreas Neumann wrote:
> The hosts file has nothing to do with setting up networking.
>
It does if you're not using DNS on your LAN - how else is the system
making a connection supposed to translate the hostname into an IP?
Also, the combination of the name on hostname and a matching line in
hosts was the traditional way to tell a system what its IP is.
Another way is to edit /etc/network/interfaces: something like:
auto lo
iface lo inet loopback
iface eth0 inet static
address 192.168.7.101
netmask 255.255.255.0
gateway 192.168.7.1
makes the use of static addressing for eth0 explicit and, as part of its
standard operation, overwrites /etc/hosts
> It only matches host names to IP adresses in a static environment.
>
...static addressing is exactly what said I was describing and did
describe.
Nothing else is needed for a small LAN and, while most routers can assign
anonymous IPs via DHCP, many fewer allow hostnames to be associated with
DHCP-assigned addresses and assigned to specific MACs - something thats
needed if your local machines are to talk to each other.
If your router won't do that but your hosts need to communicate, your
choices are:
a) use static assignment via /etc/hosts
b) set up your own DHCP server on a suitable PC or RPi
c) set up a local DNS on a suitable PC or RPi
and option (a) is a lot easier to install and configure than (b) or (c).
--
Martin | martin at
Gregorie | gregorie dot org
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|