0

Assuming a Linux system has both hostname (/etc/hostname) and NetBIOS (/etc/samba/smb.config) enabled. My questions are:

  1. Are these 2 names synchronized somehow by default settings? (for example, after installing the samba, does the netbios name = something setting get changed in (/etc/samba/smb.config) to the same value of hostname (/etc/hostname)?)

  2. When the Linux system is pinged by its name, Would it be looked up by the name in its /etc/hostname or /etc/samba/smb.config?

DummyBeginner
  • 215
  • 1
  • 9
  • 1
    ping querys the dns server to resolve the given name. That is usually the one in /etc/hostname - but depending on the amount of (mis)configuration it could be either :) – planetmaker Jun 22 '20 at 11:59

1 Answers1

1

'netbios name' is a name used by only some special programs.

Your Linux system is in the network represented by all of its IP addresses (try ifconfig | grep inet), where 127.0.0.1 and ::1 are always your local machine. Pinging one of these IP addresses will reach you system.

If you have a little more complex system, like DHCP via your internet gateway, which may give you a new address on every reboot, you should have a look at this service/router/name server, how it represents your system, what name it gave your system. In general have a look if /etc/resolv.conf shows you a 'nameserver' entry. That name server will be asked by your Linux system if you try to ping other systems by some name, and will decide under which names the other system is available. This may in some rare cases be the same as its Netbios name, if that system has one at all, but mostly it won't. Mostly the other systems name you try to reach, will include its entry of its /etc/hostname file, but may be changed by the name server, resulting in something like e.g. yourcomputer.fritz.box instead of yourcomputer, if you have a FritzBox to reach the internet, which then would often also be used as a name server.

Still you can give all your local computers fixed IPs, and add their names (including an extra entry for the netbios name) to all /etc/hosts files (the most basic network name resolving system) on all computers in your network, so you can ping them by either 'normal' or netbios name, as both will only be an alias for the same fixed IP addresses.

Jaleks
  • 2,499
  • 1
  • 17
  • 34
  • Thanks, By this statement: `Mostly the other systems name you try to reach, will include its entry of its /etc/hostname file`; Do you mean the "name servers" automatically get the first portion of a device's name form the line in `/etc/hostname`? – DummyBeginner Jun 23 '20 at 07:48
  • I am sorry, was thinking of partially manually configured name servers, where this would normally done by the admin like that. In fully automatic mode this does not have to be the case. – Jaleks Jun 24 '20 at 21:41