По какому протоколу осуществляется доступ к общим папкам?
-
Вопрос
-
Не знал к какому разделу отнести этот вопрос и решил разместить здесь. Меня интересут какой протокол используется в Windows 7 и Windows XP для доступа к общим папкам и принетрам, какие при этом используются порты?
Ответы
-
-
Помечено в качестве ответа
Egor Lukin
26 октября 2010 г. 12:41
-
Помечено в качестве ответа
Все ответы
-
очень просто — запустите встроенный брандмауэр и посмотрите правила для группы «Общий доступ…». Все порты там указаны. Они и используются
А нюансы — в зависимости от того, используется или нет NetBIOS через TCP/IP…
-
пярм сейчас глянуть нет возможности. но меня поразила одна вещь. я всегда думал что это происходит по протоколу NetBIOS. Вот выдержка из Википедии «Клиенты соединяются с сервером, используя протоколы
TCP/IP (а точнее
NetBIOS через
TCP/IP), …» Я защел в свойства TCP/IP и в закладке WINS отключил NetBIOS поерх TCP/IP, но я всерано имел возможность заходить в общие папки. Я конечно займусь дальнейшим расследованием
Но если кто занет точно я буду благодарен за информацию.
-
Порты, насколько я помню:
TCP 135-139, 445.
UDP 135-139.
Через 445 работают MDS (Microsoft Directory Services) или SMB (Server Message Blocks over IP).
In pivo veritas… t.G. — испокон и вовеки. Want to believe… It’s a magic…
-
но меня поразила одна вещь. я всегда думал что это происходит по протоколу NetBIOS.
с этого бы и начинали :-))
Вы правы. Но наполовину.
Происходит. Но — не всегда! более защищенно — через SMB (TCP 445)
(а старые системы по SMB могут и не заработать!… я уж не помню, когда это всё началось… :-))
-
Изменено
Aleksey Tchekmarev
26 октября 2010 г. 7:12
-
Изменено
-
445 порт принадлежит microsoft-ds, а этот пор предназнаен, если я не ошибаюсь, для службы каталогов AD,а не для общих папок и принтеров. SMB — это целый комплекс протоволов, которы включает также netBIOS. попровте, если я не прав.
-
Предложено в качестве ответа
dr4g0nfl7
28 декабря 2018 г. 4:20
-
Предложено в качестве ответа
-
-
Помечено в качестве ответа
Egor Lukin
26 октября 2010 г. 12:41
-
Помечено в качестве ответа
-
445 порт принадлежит microsoft-ds, а этот пор предназнаен, если я не ошибаюсь, для службы каталогов AD
AD данный порт нужен исключительно для работы с sysvol…
-
445 порт принадлежит microsoft-ds, а этот пор предназнаен, если я не ошибаюсь, для службы каталогов AD,а не для общих папок и принтеров. SMB — это целый комплекс протоволов, которы включает также netBIOS. попровте, если я не прав.
Вы бы всё-таки заглянули в правила брандмаэура… меньше бы сомневались :-))
сейчас SMB — это SMB, а NetBIOS — это NetBIOS.
«SMB was originally designed to run on top of the NetBIOS/NetBEUI API (typically implemented with NBF, NetBIOS over IPX/SPX, or NBT).
Since Windows 2000, SMB by default runs directly on top of TCP — a feature known as «direct host SMB» where the server listens on TCP port 445.»«Windows supports file and printer sharing traffic by using the Server Message Block (SMB) protocol directly hosted on TCP. This differs from earlier operating systems, in which SMB traffic requires the NetBIOS
over TCP (NBT) protocol to work on a TCP/IP transport.» (выделения мои)http://support.microsoft.com/kb/204279 -
445 TCP Да Enable SMB поверх TCP / Общий доступ к файлам и принтерам
Пруфлинки:
http://wiki.compowiki.info/SetevyeNeispravnosti
http://www.oszone.net/3962/Troubleshooting_Windows_Firewall
Вот вам про SMB:
http://ru.wikipedia.org/wiki/SMB
«SMB — это протокол, основанный на технологии клиент-сервер, который предоставляет клиентским приложениям простой способ
для чтения и записи файлов, а также запроса служб у серверных программ в различных типах сетевого окружения»
In pivo veritas… t.G. — испокон и вовеки. Want to believe… It’s a magic…
первые 2 ссылки это не пруф линки. пруф линком может быть сайт msdn или technet, а тем сатайтам, на которые вы дали ссылки я доверяю не больше,чем своему соседу. по поводу ссылки на вики, то читайте дальше.
Это откуда «445 TCP Да Enable SMB поверх TCP / Общий доступ к
файлам и принтерам«?У кого нить есть ссылка на msdn или technet, где это описывается?
-
если сосед говорит «на улице дождь», то не нужно бежать за справкой в метеоцентр
надо ж понимать — какая информация общеизвестна до банальности, а какая требует «нотариального подтверждения»
-
если сосед говорит «на улице дождь», то не нужно бежать за справкой в метеоцентр
надо ж понимать — какая информация общеизвестна до банальности, а какая требует «нотариального подтверждения»
Плохой пример. Меня не интересут что-то временное или субъективное. Меня интересует
протокол для доступа к общим папкам и принетрам в сетях microsoft. Как показывает практика, это не общеизвесная информация. Спасибо за ссылку, это пока самое полезное что я видел.
-
хороший пример!
на Ваш вопрос уже давно ответили и не один раз (ответы стоит смотреть тщательнЕЕ ;-))
вот еще http://support.microsoft.com/kb/832017
вообще, такого найти в 5 секунд можно сколько угодно на сайтах Microsoft, с помощью хитрой строки поиска «smb tcp ports»
(брандмауэр — лучший «критерий оценки»! куда достовернее любых ссылок… закройте
все порты — и посмотрите, по какому будет работать ;-)) и всего делов. практика — критерий истины… изучить систему можно руками, а не по статьям… достовернее будет :-)) -
У меня навернео не получается донести основну суть дела… Какие протоколы используют какие порты натйи не проблема. Проблема найти документ, в котором будет написано по каким протоколам в Windows XP или Windows 7 осуществляется доступ к общим папкам. То
что там используется толи NetBIOS толи еще что-то это понятно. Хотелось бы конкретно знать и желатьльно с примерами. Пишите про SMB, а почему не CIFS? -
Парни, из приведённых вами материалов, по-моему даже мёртвый уже должен понять, какие порты и протоколы используются для шар и т.д. Респект вам ребята.
-
«В среде AD RMS TCP-порт 445 используется для подготовки к работе сервера AD RMS,
но он также служит для совместного использования файлов компьютерами, работающими под управлением Microsoft Windows 2000 или более поздних версий. Если нет особой необходимости предоставлять доступ к этому порту для других компьютеров
в сети, необходимо ограничить эту область, чтобы доступ к TCP-порту 445 на сервере базы данных AD RMS имел только кластер AD RMS.»«Системная служба сервера обеспечивает поддержку удаленного вызова процедур, а также совместное использование файлов, принтеров и именованных каналов в сети. Служба сервера позволяет организовать совместное использование локальных ресурсов, например дисков
и принтеров, чтобы к ним могли получать доступ другие пользователи сети, а также обмен данными по именованным каналам между программами на локальном и удаленных компьютерах. Обмен данными по именованному каналу представляет собой память, зарезервированную
для результатов выполнения одного процесса, которые будут использованы в качестве входных данных для другого процесса. Принимающий данные процесс не обязательно должен быть запущен на локальном компьютере.Примечание. Если имя компьютера разрешается в несколько IP-адресов при использовании службы WINS или в результате сбоя этой службы имя компьютера разрешается при помощи DNS, то NetBIOS через TCP/IP (NetBT) будет проверять IP-адреса или адреса
файлового сервера. Обмен данными через порт 130 зависит от эхо-сообщений протокола управляющих сообщений Интернета (ICMP). Если протокол IPv6 (протокол Интернета версии 6) не установлен, то разрешение имен для обмена данными через порт 445 также будет зависеть
от ICMP. Предварительно загруженные записи Lmhosts будут обходить механизм разрешения DNS. Если на компьютере под управлением Windows Server 2003 или Windows XP протокол IPv6 установлен, то обмен данными через порт 445 не вызовет запросов ICMP.»И т.д. это всё из приведённых статей.
-
если сосед говорит «на улице дождь», то не нужно бежать за справкой в метеоцентр
надо ж понимать — какая информация общеизвестна до банальности, а какая требует «нотариального подтверждения»
Плохой пример. Меня не интересут что-то временное или субъективное. Меня интересует
протокол для доступа к общим папкам и принетрам в сетях microsoft. Как показывает практика, это не общеизвесная информация. Спасибо за ссылку, это пока самое полезное что я видел.
Как начальная точка подойдет эта ссылка
http://msdn.microsoft.com/en-us/library/Aa365233Там же можно сделать поиск по слову SMB
http://www.podgoretsky.com
-
Леня что такое AD RMS ?
http://samba.anu.edu.au/cifs/docs/what-is-smb.html там про SMB, а не о том какой протокол используется в Windows Xp или Windows 7. список ос к которым
относится эта статья представлен в конце это не маловважно. меня не интересует windows 98 или samba.Я хочу узнать (внимание еще раз!) — Какой протол используется в Windows XP и Windows 7 для доступа к общим папкам и принтерам? (пруфлинк).
На левом сайте школьника самоучки может быть написанно что угодно. Почитать о CIFS или SMB я знаю где. Мне нужен ответ на мой вопрос.
-
1. Здесь никто не обязан отвечать вам, это не коммерческий форум. Если мы отвечаем, это лишь наша добрая воля и ничего больше. Если вам кажется, что мы вам что-то должны, мне жаль, но это заблуждение.
2. На ваш вопрос ответ дан уже многократно. Вышеуказанные ссылки на ресурсы компании Microsoft в полной мере описывают решение этого вопроса.
In pivo veritas… t.G. — испокон и вовеки. Want to believe… It’s a magic…
-
Ты хочешь что бы прочитали вслух и с выражением?
На левом сайте школьника самоучки может быть написанно что угодно. Почитать о CIFS или SMB я знаю где. Мне нужен ответ на мой вопрос.
http://www.podgoretsky.com
-
Merlin_t_G спасибо
за ссылку на вики по SMB. Читал между строк и пропусти, что хотел. -
Стоп флуд.
Egor Lukin, что конкретно вам непонятно в приведенных статьях? Особенно в статье KB, где перечислены все протоколы, используемые Windows с объяснением, что к чему и почему?
Мнения, высказанные здесь, являются отражением моих личных взглядов, а не позиции корпорации Microsoft. Вся информация предоставляется «как есть» без каких-либо гарантий
Посетите Блог Инженеров Доклады на Techdays:
http://www.techdays.ru/speaker/Vinokurov_YUrij.html -
Разве это протокол не называется SMB (можно еще назвать такие имена как LanMan, NetBios)? (сейчас CIFS — Common Internet File System)/
Может я неточно понимаю твой вопрос, но информации в Интернет, не то что много, а очень много, на любом языке.
«CIFS, Common Internet File System (formerly SMB) is the file sharing protocol used by Microsoft Windows 95, 98, ME, NT, 2000, and XP operating systems to share files and printers across the network.»
Перевод — CIFS это протокол совместного использование файлов и папок
По моему это законченый ответ.
Подробности можно найти на msdn.microsoft.com но там очень много.
И извини, что пошутил насчет чтения вслух.
я ни кого не заставляю отвечать.
Анатолий, мне никто не дал ответ на то, что я хотел, за исключением портов. Ваша начальная точка эквивалентна
www.google.ru. Мне накидали ссылки на спецификацию по SMB и samba. Мне нужно было — Я хочу узнать (внимание еще раз!) — Какой протол используется в Windows XP и Windows 7 для доступа к общим папкам и принтерам? (пруфлинк).Вот ответ, который я ждал.
http://ru.wikipedia.org/wiki/SMB
В Windows 2000 впервые появился SMB непосредственно поверх
TCP (без NetBIOS); для этого используется
порт 445 (SMB поверх
NetBIOS over TCP/IP использовал порт 139).В Windows Vista появилась новая версия протокола —
SMB 2.0.Я не в одной стать не нашел ответа на вопрос. Если я ошибаюсь линканите.
Я в любом случае благодарен каждом за помощь.
http://www.podgoretsky.com
-
Вопрос по поводу CIFS меня тоже мучает. Хочу найти способ, узнать точно CIFS или SMB. Пока все сводится к SMB, но в некоторых источниках пишут про CIFS. Причем эти протоколы, как я понимаю, не одно и тоже.
Я пропускал некоторые ссылки, которые мне давали, пока искал/читал и обовлял эту страницу форума.
Один немаловажный момент. У меня все началось с того, что возник вопрос — почему я могу обратится к общим папкам из другой подсети, если netbios не маршрутизируемый протокол. С этого вопроса начались
мои иследования. По этому ответ типа -для доступа к общим ресурсам используется порт 139, меня не устраивает. -
CIFS подмножество SMB, в последней цитате сказано (ранее SMB)
Чистый NETBIOS не используется, а инкапсулирован как NETBIOS over TCP/IP, а этот уже маршрутизируемый.
Вопрос по поводу CIFS меня тоже мучает. Хочу найти способ, узнать точно CIFS или SMB. Пока все сводится к SMB, но в некоторых источниках пишут про CIFS. Причем эти протоколы, как я понимаю, не одно и тоже.
Я пропускал некоторые ссылки, которые мне давали, пока искал/читал и обовлял эту страницу форума.
Опять же! Как понимаю Windows XP и Windows 7 может работать как по SMB, так и по NetBIOS over TCP/IP. Если у кого есть статья о том, как происходит выбор протоколов и т.п. буду благодарен.
Один не маловажный момент. У меня все началось с того, что возник вопрос — почему я могу обратится к общим папкам из другой подсети, если netbios не маршрутизируемый протокол. С этого вопроса начались мои иследования. По этому ответ типа -для доступа к общим
ресурсам используется порт 139 меня не устраивает.
http://www.podgoretsky.com
-
Продолжая нашу приятную беседу
Я вот установил сегодня Windows 2008. Настроил ip из своей подсети и удостоверился, что в Netwrok and Sharing Center опция File sharing выключена. Попробовал зайти на общие папки другого компьютера и все прошло замечательно, папки открылись после ввода логина
и пароля. Потом глянул в свойства фаервола и теперь не понимаю, почему я подключился в общим папкам другого компьютера? Вроде как SMB заблокирван. В чем я ошибаюсь?Входящие правила
Name Group Profile Enabled Action Override Program Local Address Remote Address Protocol Local Port Remote Port Allowed Users Allowed Computers File and Printer Sharing (Echo Request - ICMPv4-In) File and Printer Sharing Private No Allow No Any Any Any ICMPv4 Any Any Any Any File and Printer Sharing (Echo Request - ICMPv4-In) File and Printer Sharing Domain, Public No Allow No Any Any Any ICMPv4 Any Any Any Any File and Printer Sharing (Echo Request - ICMPv6-In) File and Printer Sharing Private No Allow No Any Any Any ICMPv6 Any Any Any Any File and Printer Sharing (Echo Request - ICMPv6-In) File and Printer Sharing Domain, Public No Allow No Any Any Any ICMPv6 Any Any Any Any File and Printer Sharing (NB-Datagram-In) File and Printer Sharing Domain, Public No Allow No System Any Any UDP 138 Any Any Any File and Printer Sharing (NB-Datagram-In) File and Printer Sharing Private No Allow No System Any Any UDP 138 Any Any Any File and Printer Sharing (NB-Name-In) File and Printer Sharing Domain, Public No Allow No System Any Any UDP 137 Any Any Any File and Printer Sharing (NB-Name-In) File and Printer Sharing Private No Allow No System Any Any UDP 137 Any Any Any File and Printer Sharing (NB-Session-In) File and Printer Sharing Private No Allow No System Any Any TCP 139 Any Any Any File and Printer Sharing (NB-Session-In) File and Printer Sharing Domain, Public No Allow No System Any Any TCP 139 Any Any Any File and Printer Sharing (SMB-In) File and Printer Sharing Private No Allow No System Any Any TCP 445 Any Any Any File and Printer Sharing (SMB-In) File and Printer Sharing Domain, Public No Allow No System Any Any TCP 445 Any Any Any File and Printer Sharing (Spooler Service - RPC) File and Printer Sharing Domain, Public No Allow No %SystemRoot%\system32\spoolsv.exe Any Any TCP Dynamic RPC Any Any Any File and Printer Sharing (Spooler Service - RPC) File and Printer Sharing Private No Allow No %SystemRoot%\system32\spoolsv.exe Any Any TCP Dynamic RPC Any Any Any File and Printer Sharing (Spooler Service - RPC-EPMAP) File and Printer Sharing Domain, Public No Allow No Any Any Any TCP RPC Endpoint Mapper Any Any Any File and Printer Sharing (Spooler Service - RPC-EPMAP) File and Printer Sharing Private No Allow No Any Any Any TCP RPC Endpoint Mapper Any Any Any
Исходящие правила
Name Group Profile Enabled Action Program Local Address Remote Address Protocol Local Port Remote Port Allowed Computers File and Printer Sharing (Echo Request - ICMPv4-Out) File and Printer Sharing Private No Allow Any Any Any ICMPv4 Any Any Any File and Printer Sharing (Echo Request - ICMPv4-Out) File and Printer Sharing Domain, Public No Allow Any Any Any ICMPv4 Any Any Any File and Printer Sharing (Echo Request - ICMPv6-Out) File and Printer Sharing Private No Allow Any Any Any ICMPv6 Any Any Any File and Printer Sharing (Echo Request - ICMPv6-Out) File and Printer Sharing Domain, Public No Allow Any Any Any ICMPv6 Any Any Any File and Printer Sharing (NB-Datagram-Out) File and Printer Sharing Private No Allow System Any Any UDP Any 138 Any File and Printer Sharing (NB-Datagram-Out) File and Printer Sharing Domain, Public No Allow System Any Any UDP Any 138 Any File and Printer Sharing (NB-Name-Out) File and Printer Sharing Private No Allow System Any Any UDP Any 137 Any File and Printer Sharing (NB-Name-Out) File and Printer Sharing Domain, Public No Allow System Any Any UDP Any 137 Any File and Printer Sharing (NB-Session-Out) File and Printer Sharing Private No Allow System Any Any TCP Any 139 Any File and Printer Sharing (NB-Session-Out) File and Printer Sharing Domain, Public No Allow System Any Any TCP Any 139 Any File and Printer Sharing (SMB-Out) File and Printer Sharing Domain, Public No Allow System Any Any TCP Any 445 Any File and Printer Sharing (SMB-Out) File and Printer Sharing Private No Allow System Any Any TCP Any 445 Any
-
В чем я ошибаюсь?
в первую очередь — форумом. (если речь о Windows Server 2008…)
(к тому же, это ядро «поколения» Висты, а не Win7… совершенно другая тема)
-
В чем я ошибаюсь?
в первую очередь — форумом. (если речь о Windows Server 2008…)
(к тому же, это ядро «поколения» Висты, а не Win7… совершенно другая тема)
Объясните пожалуйста…
The SMB port number is TCP 445. If you’ve heard people saying the port number is 139, they could be partially correct. Let’s understand the SMB ports 445, 139, 138, and 137 in detail.
- Author
- Recent Posts
Surender Kumar has more than twelve years of experience in server and network administration. His fields of interest are Windows servers, Active directory, PowerShell, web servers, networking, Linux, virtualization, and Kubernetes. He loves writing for his blog.
Admins need to know the SMB port number when it comes to setting up firewalls in Windows networks. The earlier version of SMB (SMB 1.0) was originally designed to operate on NetBIOS over TCP/IP (NBT), which uses port TCP 139 for session services, port TCP/UDP 137 for name services, and port UDP 138 for datagram services. (Read my previous comprehensive overview of the SMB protocol.
By default, NBT is installed and enabled in Windows for backwards compatibility, but it is known for exposing file shares and other information to everyone on the network. While it is not a big problem in local networks, it could be a security risk if exposed to the Internet. Man-in-the-middle (MITM) and NetBIOS name service (NBNS) spoofing attacks are common with NTB-enabled networks—particularly if the related ports are not properly safeguarded.
How are SMB and NBT related?
NetBIOS over TCP/IP (NBT) is a completely independent service from SMB, and it doesn’t depend on SMB for anything. The SMB protocol, on the other hand, may rely on NetBIOS to communicate with old devices that do not support the direct hosting of SMB over TCP/IP.
Therefore, the SMB protocol relies on port 139 while operating over NBT. However, normally, for direct SMB over TCP/IP, the SMB port number is TCP 445. By the way, if both NetBIOS over TCP/IP and directly hosted SMB over TCP/IP are available (that is, if ports 445 and 139 are both listening), Windows tries both options at the same time. Whichever responds first is used for communication.
The SMB 2.0 that was introduced with Windows Vista and Windows Server 2008 can operate solely on TCP port 445, and you can safely disable NBT for improved security and reduced network overhead caused by NetBIOS broadcasts.
To see the status of ports 139 and 445 in your system, use the following PowerShell command:
Get-NetTCPConnection -LocalPort 139,445 -ea 0 | select Local*, Remote*, State, @{n="ProcessName";e={(Get-Process -Id $_.OwningProcess).ProcessName}} | ft -Auto
Viewing the status of ports TCP 139 and 445 using PowerShell
The above screenshot shows that both ports TCP 139 and 445 are in the listening state by default.
If you’re interested in disabling the NBT, it needs to be done on each network interface individually. See the following screenshot for disabling it using the GUI on each network adapter:
Disabling NBT on a network interface using GUI
Disabling NBT using the GUI becomes tedious if you’ve got more than one network adapter. The following PowerShell command can help you disable it on all network interfaces at once:
$adapters = (Get-WmiObject Win32_NetworkAdapterConfiguration | where {$_.IPEnabled -eq $true}) Foreach ($adapter in $adapters){ $adapter.SetTcpipNetbios(2) }
where the value «2» with the SetTcpipNetbios method is used to disable NBT. By the way, the value «1» means enable NBT, and «0» means configure NBT by DHCP.
Disabling NetBios on all network interfaces at once using PowerShell
After disabling it, if you view the status of TCP ports, you will notice that port 139 is no longer listening on your system.
Subscribe to 4sysops newsletter!
Confirming that TCP port 139 is no longer listening
If you do not have any old clients in your network, it is a good idea to block other ports, except for TCP 445 in the Windows Defender firewall.
Какие порты нужно открыть для того, чтобы компьютеры из 3 сети видели общие папки на компьютере 192.168.110.24 (Гость выключен)? В логах фаерволов ничего не появляется.
netbios-ns 137/tcp # NetBIOS Name Service
netbios-ns 137/udp
netbios-dgm 138/tcp # NetBIOS Datagram Service
netbios-dgm 138/udp
netbios-ssn 139/tcp # NetBIOS Session Service
netbios-ssn 139/udp
microsoft-ds 445/tcp # Microsoft Directory Service
microsoft-ds 445/udp
http://www.sql.ru/forum/978928/probros-portov-dlya-rassharennoy-papki
http://superuser.com/questions/637696/what-is-netbios-does-windows-need-its-ports-137-and-138-open
Может оказаться достаточно 139/tcp и 139/udp.
Однако все вышеперечисленное обеспечит подключение к сетевой папке по UNC
\hostname\share
\ip_address\share
Для «видимости» компьютеров в сетевом окружении потребуются дополнительные движения.
If I want to allow Windows networked drives between two firewalled computers, do I need to open ports 137-139, or is port 445 sufficient? I have to submit a form and get approval to open firewall ports, and I don’t want to ask for more open ports than I need. All of the machines here are Windows XP or later.
Note: when I say «Windows networked drives», I’m not entirely sure whether I’m referring to SMB or CIFS, and I’m not entirely clear on the difference between the two protocols.
asked Jan 3, 2012 at 16:35
Ports 137-139 are for NetBios/Name resolution. Without it you will have to access machines by IP address opposed to NetBIOS name. Example \\192.168.1.100\share_name
opposed to \\my_file_server\share_name
So port 445 is sufficient if you can work with IP addresses only.
answered Jan 3, 2012 at 16:41
TimTim
3,01717 silver badges15 bronze badges
6
This configuration worked for me: 137/UDP, 138/UDP, 139/TCP and 445/TCP. Source and additional information at: http://www.icir.org/gregor/tools/ms-smb-protocols.html.
So these are the iptables rules for my Samba server:
# The router doesn't need SMB access.
-A INPUT -s 192.168.1.1 -p udp --dport 137 -j REJECT
-A INPUT -s 192.168.1.1 -p udp --dport 138 -j REJECT
-A INPUT -s 192.168.1.1 -p tcp --dport 139 -j REJECT
-A INPUT -s 192.168.1.1 -p tcp --dport 445 -j REJECT
# Actual Samba ports
-A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 137 -j ACCEPT
-A INPUT -s 192.168.1.0/24 -m state --state NEW -p udp --dport 138 -j ACCEPT
-A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 139 -j ACCEPT
-A INPUT -s 192.168.1.0/24 -m state --state NEW -p tcp --dport 445 -j ACCEPT
answered Oct 12, 2016 at 10:00
JuanJuan
991 silver badge1 bronze badge
2
You must log in to answer this question.
Not the answer you’re looking for? Browse other questions tagged
.
Not the answer you’re looking for? Browse other questions tagged
.
The server message block (SMB) protocol provides “client-server communication,” which allows programs and services on networked computers to communicate with one another. SMB enables network functions like file, print and device sharing, among others.
SMB Ports Explained
SMB ports are used for file sharing, enabling programs and services on networked computers to communicate with each other. The SMB protocol sends and receives request-response communication between clients and servers to make dealing with networked computers easier.
How Does SMB Work?
The SMB protocol sends and receives request-response messages to establish communication between clients and servers. This arrangement sets up a file-sharing system as though a user was accessing data on their hard drive. It makes dealing with networked systems all over the world a lot easier.
Other operating systems, such as Unix, Linux and OS/2, use Samba to connect and provide file-sharing services within a network by speaking the same language as SMB.
SMB History and Evolution
During the mid-1990s, Microsoft incorporated SMB in their LAN Manager product, which IBM initially built. SMB 1.0 was renamed common internet file system (CIFS) , and Microsoft published draft standards to the Internet Engineering Task Force (IETF), though these have now expired.
SMB and early CIFS implementation had a number of flaws that limited its applicability to managing small files for end-users. The protocol was “chatty,” which resulted in poor performance over long distances or when there was a lag between client and server. Around this time, the Samba project was born, with the goal of reverse-engineering the SMB/CIFS protocol and developing an SMB server that would allow MS-DOS clients to access files on Unix machines.
SMB has gone through a few evolutions since then.
More on Cybersecurity: Enterprise Phishing Attacks Are on the Rise. Are Your Employees Security Threats?
SMB 2.0
Microsoft released SMB2 with Windows Vista in 2006. SMB2.0 had a significant number of improvements over SMB 1.0 particularly reducing the “chattiness” of the protocol by reducing the number of commands and subcommands from hundreds to 19.
The term CIFS become redundant, as it only applied to SMB version 1.0
SMB2 supported many other improvements like TCP window scaling and WAN acceleration, opportunistic locking and a feature known as “pipelining” to enable multiple requests to be queued at the same time.
Performance improvements included allowing larger block sizes, which improved large file transfers. Microsoft introduced “durable file handles” that allowed the connection to an SMB server to survive brief network failure frequently seen in wireless networks. They did this by allowing clients to transparently reconnect to servers.
SMB 2.1
SMB 2.1 was released alongside Windows 7 and Windows Server 2008, and included minor upgrades.
SMB 3.0
With Windows 8 and Windows Server 2012, SMB 3.0 (also known as SMB 2.2) was released. SMB3 included significant protocol modifications such as the SMB Direct Protocol (SMB over remote direct memory access (RDMA) and SMB Multichannel (many connections per SMB session), which are meant to improve SMB2 performance, particularly in virtualized data centers.
SMB Protocol Ports
To provide file and print sharing services within a network, SMB uses a number of ports. The following are all known SMB v2/v3 ports:
- TCP 445 — SMB over transmission control protocol (TCP) without the need for a network basic input/output system (NetBIOS).
- UDP 137 — SMB over user datagram protocol (UDP or Name Services).
- UDP 138 — SMB over UDP (datagram).
- TCP 139 — SMB over TCP (session service).
SMB Ports 139 and 445 Explained
There are two common ports you will see in SMBs. These are: Port 139 and Port 445. Here’s what they do.
Port 139
Port 139 is used by the NetBIOS session service. Prior to Windows 2000, most operating systems used TCP 139, with SMB running on top of NetBIOS. NetBIOS is a service on the open systems interconnectedness (OSI) model’s session layer that allows applications to communicate with one another within a local network (LAN). This might be anyone on the internet, but because of security concerns, it’s not a recommended alternative.
Port 445
Windows uses port 445 for file sharing across the network. From Windows 2000 onward, Microsoft changed SMB to use port 445. Microsoft directory services, often known as Microsoft-DS, use port 445.
TCP and UDP protocols both use port 445 for numerous Microsoft services. For file replication, user and computer authentication, group policy and trusts, Microsoft Active Directory and Domain Services use this port. SMB, CIFS, SMB2, DFSN, LSARPC, NbtSS, NetLogonR, SamR and SrvSvc protocols and services are most likely to be found on these ports.
Is SMB Secure?
While different versions of SMB provide differing levels of security and protection, SMBv1 was discovered to have a vulnerability that hackers may exploit to execute their code without the user’s knowledge. When a gadget becomes infected, it attacks any other devices that are linked to it. The National Security Agency (NSA) uncovered the flaw in 2017.
The exploit was called EternalBlue, and it was taken from the NSA and posted online by the Shadow Brokers hacker group. Microsoft did issue a patch to address the vulnerability, but the WannaCry ransomware attack hit the world just a month later.
More on Cybersecurity: Phishing Attacks: 18 Examples and How to Avoid Them
How to Prevent SMB Vulnerabilities
Patching your system is the best defense against an SMB attack. Attackers will be unable to get access to a patched machine, but a huge number of Windows computers have yet to be patched. The March 2017 update from Microsoft can assist in patching the server message block vulnerabilities. Applying this fix is one of the greatest ways to safeguard a system. If you use a Windows 10 or later system, the update fixes are already built-in. This is why most SMB assaults target Windows 7 and earlier. Furthermore, the WannaCry patch can prevent EternalBlue exploits and other similar flaws. These fixes are among the most effective SMB server security solutions available.
It’s better to have layers of security when it comes to protecting yourself from cyberattacks, as it is with other things. Apart from the WannaCry and ransomware patches, you can further safeguard your systems by restricting SMB access from the internet, blocking SMB in off site computers when in public areas, and removing SMB if it’s not needed. These easy measures can help protect your system from SMB exploits.
Finally, vulnerability scanning and managed detection and response services can help your system avoid and identify SMB attacks and other cyberattacks.