Since an Ubuntu machine needs an smb client to access a smb server, it would have to establish a connection to the server.

What ports does the client open to establish the connection?

Do those ports continue to listen for incoming connections once the connection to the smb server ends?

Note: I am asking about the ports used by a smb client, not a smb server.

share|improve this question
up vote 5 down vote accepted

This is from https://wiki.samba.org/index.php/Samba_port_usage







Identify on which ports and interfaces Samba is listening

You can use "netstat" to identify which ports Samba and related daemons are listening on and on which IPs:

netstat -tulpn | egrep "samba|smbd|nmbd|winbind"

The following is a snippet of an example output:

tcp 0 0 127.0.0.1:139 0.0.0.0:* LISTEN 43270/smbd
tcp 0 0 10.0.0.1:139 0.0.0.0:* LISTEN 43270/smbd
tcp 0 0 10.0.0.1:88 0.0.0.0:* LISTEN 43273/samba
tcp 0 0 127.0.0.1:88 0.0.0.0:* LISTEN 43273/samba
tcp 0 0 127.0.0.1:445 0.0.0.0:* LISTEN 43270/smbd
tcp 0 0 10.0.0.1:445 0.0.0.0:* LISTEN 43270/smbd

..... The above example shows, that the services are listening on localhost (127.0.0.1) and the interface with IP 10.0.0.1 - each on the listed ports (139, 88, 445,...).

Port usage when Samba runs as an Active Directory Domain Controller

Service Port protocol

DNS 53 tcp/udp

Kerberos 88 tcp/udp

End Point Mapper (DCE/RPC Locator Service) 135 tcp

NetBIOS Name Service 137 udp

NetBIOS Datagram 138 udp

NetBIOS Session 139 tcp

LDAP 389 tcp/udp

SMB over TCP 445 tcp

Kerberos kpasswd 464 tcp/udp

LDAPS (only if "tls enabled = yes") 636 tcp

Dynamic RPC Ports* 1024-5000 tcp

Global Cataloge 3268 tcp

Global Cataloge SSL (only if "tls enabled = yes") 3269 tcp

Multicast DNS 5353 tcp/udp

  • Samba, like Windows, supports dynamic RPC services. The range starts at 1024. If something occupies this port for some reason, it will be a different port (literally walked up from 1024). Remember, that there can be other ports too, which are related to your Samba installation but not provided from Samba itself, like if you run a NTP server for time synchronisation as well.

Port usage when Samba runs as an NT4 Primary Domain Controller

Service Port protocol

End Point Mapper (DCE/RPC Locator Service) 135 tcp

NetBIOS Name Service 137 udp

NetBIOS Datagram 138 udp

NetBIOS Session 139 tcp

SMB over TCP 445 tcp

Port usage when Samba runs as a Member Server

Service Port protocol

End Point Mapper (DCE/RPC Locator Service) 135 tcp

NetBIOS Name Service 137 udp

NetBIOS Datagram 138 udp

NetBIOS Session 139 tcp

SMB over TCP 445 tcp

share|improve this answer
    
A ton more information than what I asked for! I was looking for the last part (Samba client as a member server). Thank you! – Raffat Jul 18 '15 at 23:43
    
Also keep in mind that your Samba client will use any of these ports depending on the server it's connecting to, so more than just the last part of the answer is applicable if you want a full answer. – Daniel Jul 19 '15 at 2:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.