Windows Name Server
NetBIOS
The NetBIOS name is 16 ASCII characters, however Microsoft limits the host name to 15 characters and reserves the 16th character as a NetBIOS Suffix. This suffix describes the service or name record type such as host record, master browser record, domain controller record. The host name (or short host name) is specified when Windows networking is installed/configured, the suffixes registered are determined by the individual services supplied by the host. In order to connect to a computer running TCP/IP via its NetBIOS name, the name must be resolved to a network address. Today this is usually an IP address (the NetBIOS name-IP address resolution is often done by either broadcasts or a WINS Server — NetBIOS Name Server). A computer's NetBIOS name is often the same as that computer's host name (see below), although truncated to 15 characters, but it may also be completely different. NetBIOS names can include almost any combination of alphanumeric characters except for spaces and the following characters .
Node types
The node type of a networked computer relates to the way it resolves NetBIOS names to IP addresses. There are four node types.
- B-node: 0x01 Broadcast
- P-node: 0x02 Peer (WINS only)
- M-node: 0x04 Mixed (broadcast, then WINS)
- H-node: 0x08 Hybrid (WINS, then broadcast)
NetBIOS Suffixes
The NetBIOS suffix, alternately called the NetBIOS End Character (endchar) is the 16th character of a NetBIOS name. This character specifies the record or service type for the registered name record. The number of record types is limited to 255, the number that will fit into a single character. However in actual use the number of commonly used NetBIOS Suffixes is substantially smaller. The most common NetBIOS Suffixes:
ASCII Values of 16th characters of NetBIOS "names"
- 00: Workstation Service
- 03: Messenger Service
- 20: File Service (also called Host Record)
- 1B: Domain Master Browser - Primary Domain Controller for a domain
- 1C: Domain Controllers for a domain (group record with up to 25 IP addresses)
- 1D: Master Browser
- 1E: Browser Service Elections
Services
NetBIOS provides three distinct services:
- Name service for name registration and resolution.
- Session service for connection-oriented communication.
- Datagram distribution service for connectionless communication.
(Note: SMB, an upper layer, is a service that runs on top of the Session Service and the Datagram service, and is not to be confused as a necessary and integral part of NetBIOS itself. It can now run atop TCP with a small adaptation layer that adds a packet length to each SMB message; this is necessary because TCP only provides a byte-stream service with no notion of packet boundaries.)
Name service (UDP 137)
In order to start Sessions or distribute Datagrams, an application must register its NetBIOS name using the Name service. NetBIOS names are 16 bytes in length and vary based on the particular implementation. Frequently, the 16th byte is used to designate a "type" similar to the use of ports in TCP/IP. In NBT, the name service operates on UDP port 137 (TCP port 137 can also be used, but it is rarely if ever used).
The name service primitives offered by NetBIOS are:
- Add Name — registers a NetBIOS name.
- Add Group Name — registers a NetBIOS "group" name.
- Delete Name — un-registers a NetBIOS name or group name.
- Find Name — looks up a NetBIOS name on the network.
Session service (TCP 137)
Session mode lets two computers establish a connection for a "conversation", allows larger messages to be handled, and provides error detection and recovery. In NBT, the session service runs on TCP port 139.
The session service primitives offered by NetBIOS are:
- Call — opens a session to a remote NetBIOS name.
- Listen — listen for attempts to open a session to a NetBIOS name.
- Hang Up — close a session.
- Send — sends a packet to the computer on the other end of a session.
- Send No Ack — like Send, but doesn't require an acknowledgment.
- Receive — wait for a packet to arrive from a Send on the other end of a session.
In the original protocol used to implement NetBIOS services on PC-Network, to establish a session, the computer establishing the session sends an Open request which is responded to by an Open acknowledgment. The computer that started the session will then send a Session Request packet which will prompt either a Session Accept or Session Reject packet. Data is transmitted during an established session by data packets which are responded to with either acknowledgment packets (ACK) or negative acknowledgment packets (NACK). Since NetBIOS is handling the error recovery, NACK packets will prompt retransmission of the data packet. Sessions are closed by the non-initiating computer by sending a close request. The computer that started the session will reply with a close response which prompts the final session closed packet.
Datagram distribution service (UDP 138)
Datagram mode is "connectionless". Since each message is sent independently, they must be smaller; the application becomes responsible for error detection and recovery. In NBT, the datagram service runs on UDP port 138.
The datagram service primitives offered by NetBIOS are:
- Send Datagram — send a datagram to a remote NetBIOS name.
- Send Broadcast Datagram — send a datagram to all NetBIOS names on the network.
- Receive Datagram — wait for a packet to arrive from a Send Datagram operation.
- Receive Broadcast Datagram — wait for a packet to arrive from a Send Broadcast Datagram operation.
Following commands are used in netbios:
# netstat -> to check the status of netbios
#nbtstat -> to check protocol statistics and current TCP/IP connections using netbios
#nbtstat – a
#arp -> address resolution protocol