How to use the command nmblookup (with examples)

How to use the command nmblookup (with examples)

nmblookup is a command-line tool that is used to discover SMB shares in a local network. SMB (Server Message Block) is a network protocol used for sharing files, printers, and other resources between nodes on a network.

Use case 1: Find hosts in the local network with SMB shares

Code:

nmblookup -S '*'

Motivation: Understanding which hosts in a local network have SMB shares can be beneficial for various purposes, including network administration and troubleshooting. By using nmblookup, you can quickly identify the hosts that have shared resources.

Explanation:

  • The “-S” option is used to specify the scope of the lookup.
  • The “*” wildcard character is used to match all hosts in the local network.

Example output:

Looking up status of 192.168.1.1
        HOSTNAME        = MYSERVER
        <00> -         M <ACTIVE>
        <03> -         M <ACTIVE>
        <20> -         M <ACTIVE>
        MAC Address = XX-XX-XX-XX-XX-XX

Looking up status of 192.168.1.10
        HOSTNAME        = MYPC
        <00> -         M <ACTIVE>
        <03> -         M <ACTIVE>
        <20> -         M <ACTIVE>
        MAC Address = YY-YY-YY-YY-YY-YY

... (output continues)

Use case 2: Find hosts in the local network with SMB shares run by SAMBA

Code:

nmblookup --status __SAMBA__

Motivation: If you specifically want to find hosts in the local network that are running SAMBA as their SMB server, this use case allows you to filter the search results accordingly.

Explanation:

  • The “–status” option is used to specify the type of status to search. In this case, it is set to “SAMBA” to look for hosts running SAMBA as their SMB server.

Example output:

Looking up status of 192.168.1.1
        HOSTNAME        = MYSERVER
        <03> -         M <ACTIVE>
        MAC Address = XX-XX-XX-XX-XX-XX

Looking up status of 192.168.1.10
        HOSTNAME        = MYPC
        <03> -         M <ACTIVE>
        MAC Address = YY-YY-YY-YY-YY-YY

... (output continues)

Conclusion:

The nmblookup command is a useful tool for discovering hosts in a local network that have SMB shares. By utilizing its various options, you can easily find and gather information about the hosts running SMB servers. Whether you need to perform network administration tasks or troubleshoot SMB-related issues, nmblookup can provide you with valuable insights into your network’s shared resources.

Related Posts

How to use the command brightnessctl (with examples)

How to use the command brightnessctl (with examples)

Brightnessctl is a utility command for reading and controlling device brightness on GNU/Linux operating systems.

Read More
Bower Command Examples (with examples)

Bower Command Examples (with examples)

1: Installing a project’s dependencies bower install Motivation: This command is used to install all the dependencies listed in the bower.

Read More
How to use the command 'gfortran' (with examples)

How to use the command 'gfortran' (with examples)

The ‘gfortran’ command is a part of the GNU Compiler Collection (GCC) and is used to preprocess and compile Fortran source files, as well as assemble and link them together.

Read More