Ports 135–139
Ports 135, 137, 138 and 139: Windows RPC and NetBIOS
Port 135 (TCP) is the Microsoft RPC Endpoint Mapper: it tells clients which dynamic port, between 49152 and 65535, a Windows service is using. Ports 137 (UDP, NetBIOS Name Service), 138 (UDP, NetBIOS Datagram Service) and 139 (TCP, NetBIOS Session Service) carry legacy NetBIOS networking, including file sharing over NetBIOS. Modern Windows file sharing uses SMB directly on port 445. None of these ports should be reachable from the internet.
- 135
- TCP · RPC Endpoint Mapper
- 137
- UDP · NetBIOS Name Service
- 138
- UDP · NetBIOS Datagram
- 139
- TCP · NetBIOS Session (SMB)
- Dynamic RPC
- TCP 49152–65535
Last updated:
What ports 135, 137, 138 and 139 do
| Port | Protocol | Service | Used for |
|---|---|---|---|
| 135 | TCP | RPC Endpoint Mapper (epmap) | Locating DCOM, WMI, Active Directory and remote management services |
| 137 | UDP | NetBIOS Name Service | Resolving computer names on old networks |
| 138 | UDP | NetBIOS Datagram Service | Network browsing and announcements |
| 139 | TCP | NetBIOS Session Service | File and printer sharing over NetBIOS (legacy SMB transport) |
| 445 | TCP | SMB direct | Modern Windows file and printer sharing |
Port 139 vs port 445
Both carry SMB file sharing. Port 139 wraps SMB in a NetBIOS session, which is how Windows shared files before Windows 2000. Port 445 runs SMB directly over TCP and is what current Windows, macOS, Linux (Samba) and NAS devices use. When both are available, Windows prefers 445. You can usually disable NetBIOS over TCP/IP without affecting file sharing, unless very old devices on your network still depend on it.
Should you block ports 135–139?
On the internet side: yes, always. These ports were the entry point for some of the most damaging Windows worms, including Blaster, which spread through RPC on port 135 in 2003, and many ISPs still filter them. On the local network they are part of normal Windows operation, so restrict them with the host firewall instead of disabling the services.
- Never forward 135, 137, 138, 139 or 445 on your router. Use a VPN for remote file access.
- Keep the Windows Firewall rules for File and Printer Sharing limited to the local subnet (the default on private networks).
- Do not try to stop the RPC service to close port 135: Windows depends on it. Block the port at the firewall instead.
- Scan your public IP with the port scanner Common ports preset; 135, 139 and 445 should be filtered or closed.
How to check ports 135–139 on Windows
See which processes listen on these ports
netstat -ano | findstr ":135 :137 :138 :139 :445"Check whether NetBIOS over TCP/IP is enabled
Look for the line NetBIOS over Tcpip in the output. nbtstat -n lists the NetBIOS names the computer has registered.
ipconfig /all
nbtstat -nTest from another computer
Test-NetConnection 192.168.1.20 -Port 135
Test-NetConnection 192.168.1.20 -Port 139How to disable NetBIOS over TCP/IP
- 1
Using network adapter settings
Open the adapter's IPv4 properties, choose Advanced, then the WINS tab, and select Disable NetBIOS over TCP/IP. Repeat for each adapter.
- 2
Using PowerShell (as administrator)
Run
Get-CimInstance Win32_NetworkAdapterConfiguration -Filter "IPEnabled=true" | Invoke-CimMethod -MethodName SetTcpipNetbios -Arguments @{TcpipNetbiosOptions=2}. The value 2 disables NetBIOS, 1 enables it, and 0 follows the DHCP server. - 3
Confirm
Run
ipconfig /allagain. NetBIOS over Tcpip should show Disabled, and ports 137–139 should no longer be listening.
Ports 137–139 on Linux and NAS devices
Samba's nmbd service answers on 137 and 138, and smbd listens on 139 and 445. If only modern clients connect, you can disable nmbd and set disable netbios = yes and smb ports = 445 in smb.conf. Keep all of these ports closed to the internet with the firewall, for example sudo ufw deny 137:139/udp and sudo ufw deny 139,445/tcp on internet-facing interfaces.
Ports 135–139 FAQ
What is port 135 used for?
Port 135 is the Microsoft RPC Endpoint Mapper. Windows uses it to direct clients to services such as DCOM, WMI and Active Directory replication on dynamic ports.
Is it safe to close port 135?
Block it from the internet and untrusted networks, but do not disable the RPC service on Windows: the operating system depends on it. Use the firewall to restrict who can reach it.
Does port 137 use TCP or UDP?
NetBIOS Name Service uses UDP 137. TCP 137 is registered but practically unused.
What is the difference between port 139 and 445?
Both carry SMB file sharing. 139 runs SMB over a NetBIOS session (legacy), while 445 runs SMB directly over TCP and is used by all modern systems.
Why are ports 135 and 139 open on my computer?
They are open by default on Windows for local networking. That is normal inside your network, as long as your router and firewall block them from the internet.
References
- Microsoft Learn: Service overview and network port requirements for Windows — official list of Windows ports.
- RFC 1001 and RFC 1002: NetBIOS over TCP/UDP — the NetBIOS name, datagram and session services.
- IANA Service Name and Port Number Registry — official port assignments.