Category Archives: Howto Tutorials (EN)

Howto Tutorials English Contribution Howto’s and Tutorials technical contribution for Professionals

Master Browser Lookup

Windows Master Browser Lookup for NetBIOS Name and Elected Master Browser

The folders and printers shared by Windows clients appear in the client network environment. If the network environment remains empty, it is often the computer browser service. Windows attempts to view all PCs on a Windows network in the network environment.

Windows Workstation Service

First, you need to make sure that a Windows network is working properly at all. The Windows Workstation Service and Server services must be running, and the network connection properties must have file and printer sharing and the Microsoft Network Client active, and TCP/IP over NetBIOS must be enabled.

Note that clients that are not in a domain are in the same workgroup, the WORKGROUP and WORKING GROUP are different groups. If all this does not yet lead to success, one should search for the computer on the network, which has been delegated to the master browser.

NetBIOS Name Information

The NBTscan is a program for scanning IP networks for NetBIOS name information. It sends a NetBIOS status query to any address in the specified range and lists received information in a human-readable form. For each responding host, the IP address, NetBIOS computer name, user name, and MAC address of the computer are displayed.

C:\> nbtscan -s: -h -v 192.168.10.0/24

To discover the master browser on a local network, the following content can be created in a batch file.

@Echo Off
Title Master Browser Lookup & Color 1A
call :IsAdmin

if not [%1]==[] goto lookup
echo use: nbt [ip address range]
echo example: nbt 192.168.10.0/24
goto:eof

:lookup
nbtscan -s: -h -v %1 | find "Master Browser"
for /f "delims=" %%A in ('nbtscan -s"   " -h -v %1 ^| find "Master Browser"') do set "var=%%A"
echo .
echo Elected Master Browser on %var:~0,15%
echo .
nbtstat -A %var:~0,15%
pause

:IsAdmin
Reg.exe query "HKU\S-1-5-19\Environment"
If Not %ERRORLEVEL% EQU 0 (
 cls & echo You must have administrator rights to continue ... 
 pause & exit
)
cls
goto:eof

Using Copy Paste to the batch file .bat save and, when the IP network is committed, run as an administrator in the command prompt, the program nbtscan.exe and cygwin1.dll must be in the same directory, or the path to the program must be in the search path environment.

Download NBTScan

Master Browser Delegation

Often it helps when the PC of this is the master browser on its network to restart, so the choice to delegate another computer is triggered. Microsoft sets priorities here, by regulating the assignment (election) to the master browser is granted. Administrators don’t just want to leave it to random rules about who master browser should be, to do so, you open Regedit and go to the following key.

HKEY_LOCAL_MACHINE-SYSTEM\CurrentControlSet\Services\Browser\Parameters

Edit the REG_SZ MaintainServerList key and set it to FALSE or TRUE, for disable or enable. For Windows XP and Server 2003, the REG_SZ key is IsDomainMaster with value FALSE / TRUE, and MaintainServerList with the value AUTO / NO / YES. The change does not take effect immediately and may take up to 48 minutes.

Linux Samba Master Browser

For Linux, the Samba configuration file smb.conf is responsible, in the following example, a Samba server with the highest priority is chosen as the master browser, suitable on a network without Windows PDC. In networks in these there is a Windows PDC it is not recommended.

[global]
    domain master = yes
    preferred master = yes
    local master = yes
    os level = 255
Computer browser service architecture
Illustration: Computer Browser Service Architecture

NBTStat is a command-line tool for troubleshooting NetBIOS name over TCP/IP (NetBT) resolution issues, it is part of the Windows standard. It shows protocol statistics and current TCP/IP connections with NetBT.

C:\> nbtstat -A 192.168.10.73
LAN connection 1:
Node IP[192.168.10.73] address: Rang[]e ID: 

NetBIOS name table of the remote computer

    Name          Type  Status
    ---------------------------------------------
    AMX3000       <00>  CLEAR  Registered
    WORKGROUP     <00>  GROUP  Registered
    WORKGROUP     <1C>  GROUP  Registered
    AMX3000       <20>  CLEAR  Registered
    WORKGROUP     <1B>  CLEAR  Registered
    WORKGROUP     <1E>  GROUP  Registered
    ADMINISTRATOR <03>  CLEAR  Registered

    MAC Adresse = 00-0B-AB-0B-11-8E

NetBIOS name tables type <00> is output in hex.</00>

<00> specifies the domain to which this computer belongs
<03> Computer name assigned to the messenger service
<20> Computer name assigned to the server service
<1C> Internet group name registered with domain controller
<1B> Identifying a domain master browser name
<1E> Computer can be used as a backup browser in the domain
<03> Username currently logged on to this computer
<1D> Identify segment master browsers without a domain

Computer browser service

How to Set up fetchmail

How to pick up emails and forward with fetchmail

fetchmail is a utility for retrieving and forwarding e-mail; the Unix pioneer retrieves e-mail from remote mail servers and forwards them to the delivery system. The mail can then be retrieved using normal e-mail user agents such as mutt, elm, or mail.

What is fetchmail ?

The fetchmail utility can run in daemon mode to repeatedly queries one or more systems at a given interval, it collects emails from servers that support all common email retrieval services, such as POP3 and IMAP, also support the ESMTP-ETRN extension and the ODMR protocols.

This article describes how to use fetchmail on a CentOS smart host with Postfix. The e-mail from external mail service providers is retrieved and the recipient is redirected to the mailbox server that receives e-mail from the smart host. Mail accounts do not require forwarding, and the smart host also scans the e-mail for viruses and SPAM before they are delivered to the user’s mailbox.

fetchmail installation

For installation on CentOS 7, the extras repository is required, if not already available.

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -Uvh epel-release-latest-7*.rpm

The fetchmail utility can be installed from the CentOS Extras repository.

yum -y install fetchmail

We create the fetchmail configuration file for the daemon under /etc/sysconfig.

# This file will be used to declare some vars for fetchmail
#
# Uncomment the following if you dont want localized log messages
# export LC_ALL=C

# Declare here if we want to start fetchmail. 'yes' or 'no'
START_DAEMON=yes

Copy Paste /etc/sysconfig/fetchmail

The Daemon Init script is created, here for a CentOS host on this the Postfix MTA is already running. As root with vi /etc/rc.d/init.d/fetchmaild

#!/bin/sh
# chkconfig: 35 99 00
# description: Start and stop fetchmail

. /etc/init.d/functions

start() {
  echo "Starting fetchmaild..."
  su fetchmail -s /bin/sh -c "fetchmail -vv -d 900 -a -f /etc/fetchmailrc -L /var/log/fetchmail"
  }

stop() {
  echo "Shutting down fetchmaild..."
  su fetchmail -s /bin/sh -c "fetchmail --quit"
  }

case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    stop
    start
    ;;
  *)
    echo "Usage: $0 {start|stop|restart}"
    ;;
esac

exit 0

Copy Paste /etc/rc.d/init.d/fetchmail
Make the init script executable.

chmod 0755 /etc/rc.d/init.d/fetchmaild

Create the global fetchmailrc Recource configuration for operation as a daemon.

set daemon 900
set no syslog
set logfile /var/log/fetchmail
set postmaster "postmaster"
set no bouncemail
set no spambounce
set properties ""

poll mail.foo.org with proto POP3
user 'joe@foo.org' there with password 'secret' is joe.office@foo.com here options fetchall nokeep ssl smtphost localhost

Copy Paste /etc/fetchmailrc

For each mail server retrieved from this email, a poll line is created. The aim is to retrieve the external mailbox from joe@foo.org to the POP3 Server mail.foo.org and to be delivered to the user joe.office@foo.com via the localhost via Postfix to the Mailbox Server. To prevent logging in maillog, log is made in fetchmail instead of it.

Possibilities with fetchmail

fetchmail offers a number of syntactic subtleties to make it easier for fetchmailrc to read files. For example, the words and, with, has, wants, and options are ignored by fetchmail, as well as punctuation marks. While it is possible to provide credentials for a server on a row, common configurations are specified over a number of different lines. fetchmail is insensitive to whitespace unless the argument is in quotation marks and closing characters.

There are several options for the Poll statement (e.B. nofetchall (default), fetchall, keep, nokeep ).The meanings are as follows:

nofetchall: retrieve only new messages (default). Unless otherwise specified (i.e. fetchall, keep ), this means nofetchall.
fetchall: get all messages, seen or not.keep.
keep: do not delete any message on server.
nokeep: delete the read messages on server.

Create the fetchmail user and group and set the rights.

groupadd -r fetchmail
useradd -r -m -g fetchmail -s /sbin/nologin -c "Fetchmail" fetchmail
chown fetchmail /etc/fetchmailrc
chmod 0600 /etc/fetchmailrc

The fetchmail daemon starts.

/etc/rc.d/init.d/fetchmaild start

After changing the fetchmailrc configuration, the systemd daemon have to restart.

systemctl daemon-reload

You can check the fetchmail conversation to server with run the following command:

fetchmail -vv -N --ssl -p pop3 -P 995 -ujoe@foo.org mail.foo.org

Test the fetchmailrc configuration file.

fetchmail -v -a -k -f /etc/fetchmailrc

Check the fetchmail process.

ps -ef | grep -v grep | grep fetchmail

The output may look something like this:

fetchma+ 4126 1 0 19:19 ?        00:00:00 fetchmail -vv -d 900 -a -f /etc/fetchmailrc -L /var/log/fetchmail
root 6488 3985 0 16:25 pts/0 00:00:00 su fetchmail

fetchmail logging now takes place in the fetchmail file.

tail -f /var/log/fetchmail

The fetchmail man page outputs a lot of information.

man fetchmail