Windows networking concepts
Windows networking concepts explain how office PCs handle login, name resolution and file sharing: workgroup vs domain with Active Directory, legacy NetBIOS/WINS vs DNS, SMB, the Public/Private/Domain firewall profiles, and netsh vs PowerShell.
197.1 Workgroup vs domain
- Workgroup: peer to peer; every PC keeps its own local users, so Asha's account must be created on each PC. Fine for home or a small office.
- If PC 3 has no local account for Asha, she gets access denied there.
- Domain: a central Domain Controller (DC); all PCs join it, the DC checks passwords and issues Kerberos tickets.
- With one ticket Asha can open shares on any domain PC, because they all trust the same DC.
- Step 1
1.Office grows to 200 PCs; a Domain Controller (Active Directory) is added
- Step 2
2.All PCs join the domain
- Step 3
3.Asha logs in on PC 2; the DC checks her password
- Step 4
4.DC gives her a Kerberos ticket
- Step 5
5.Asha opens a folder on PC 3 over SMB by showing the ticket
- Step 6
6.PC 3 trusts the same DC, so access is OK
| Point | Workgroup | Domain |
|---|---|---|
| Users | local on every PC | central in Active Directory |
| Login check | each PC itself | DC (Kerberos) |
| Policy | per PC | Group Policy for all joined PCs |
| Scale | home / small office | tens to thousands of PCs |
197.2 Active Directory
- Runs on the DC; stores users, computers and groups in one place.
- OUs organise objects like folders; Group Policy applies one setting to all joined PCs.
- A DC runs LDAP, Kerberos and DNS together (details in the directory video).
197.3 Names: NetBIOS broadcast vs WINS vs DNS
- Step 1
1.Asha's laptop needs FILESRV's IP
- Step 2
2.NetBIOS name service broadcasts 'who is FILESRV?' on UDP 137
- Step 3
3.Switch floods it; only FILESRV replies with 192.168.217.10
- Step 4
4.Router stops the broadcast, so other subnets cannot be reached
- Step 5
5.WINS: laptop sends a unicast query to the central NetBIOS name server, works across routers
- Step 6
6.Today both are legacy: Microsoft says replace WINS with DNS
- SMB is the Windows file/printer sharing protocol, today on TCP 445.
- Old SMB ran over NetBIOS: UDP 137 (names), UDP 138 (datagrams), TCP 139 (sessions) = the NetBIOS ports.
- SMB1 is not installed by default today.
197.4 Network profiles: Public, Private, Domain
| Profile | When | Behaviour |
|---|---|---|
| Public | airport, cafe, unknown Wi-Fi | PC hidden, file sharing blocked: strictest |
| Private | home / trusted network | PC discoverable, sharing can be turned on |
| Domain (DomainAuthenticated) | laptop can authenticate to its domain's DC | applied automatically; you cannot select it |
- Step 1
1.Laptop joins a new Wi-Fi; Windows assigns a profile
- Step 2
2.Firewall applies rules for that profile
- Step 3
3.Profile is Public: PC hidden on the network
- Step 4
4.Unknown device tries TCP 445 on the laptop
- Step 5
5.Firewall drops it right there
197.5 netsh vs PowerShell
- netsh: older tool, text commands in contexts (advfirewall, interface, wlan; interface has ipv4, ipv6, portproxy ...).
- PowerShell cmdlets (Set-NetFirewallRule, Set-NetConnectionProfile ...) return objects you can filter in a pipeline; Microsoft recommends them now.
- Only generic help commands were run on the office domain PC (no names or IPs shown).
netsh /?netsh interface /?Get-Command -Module NetTCPIP | Measure-Object(Get-Help Set-NetConnectionProfile).Synopsis$ netsh interface /?tcp - Changes to the `netsh interface tcp' context.$ Get-Command -Module NetTCPIP | Measure-ObjectCount : 34$ (Get-Help Set-NetConnectionProfile).SynopsisSet-NetConnectionProfile [-Name <string[]>] [-InterfaceAlias <string[]>] [-InterfaceIndex <uint32[]>] [-NetworkCategory <NetworkCategory>] [-AsJob] [-PassThru] [-WhatIf] [-Confirm]- Set-NetConnectionProfile -NetworkCategory can set only Public or Private; DomainAuthenticated comes automatically.
# netsh (Command Prompt)netsh advfirewall set allprofiles state onnetsh advfirewall firewall set rule name="Allow Web 80" new remoteip=192.168.0.2# PowerShellSet-NetFirewallProfile -Profile Domain,Public,Private -Enabled TrueSet-NetFirewallRule -DisplayName "Allow Web 80" -RemoteAddress 192.168.0.2# network profile (docs example, not run)Set-NetConnectionProfile -InterfaceAlias Ethernet1 -NetworkCategory "Public"| Job | netsh | PowerShell |
|---|---|---|
| Firewall on for all profiles | netsh advfirewall set allprofiles state on | Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True |
| Change rule remote IP | netsh advfirewall firewall set rule name=... new remoteip=... | Set-NetFirewallRule -DisplayName ... -RemoteAddress ... |
| Output | text | objects (pipeline) |
197.6 Practical: Samba workgroup lab
- Docker network 192.168.217.0/24 with a Samba server FILESRV and a client. Samba = open-source SMB + NetBIOS on Linux.
- testparm: server role standalone, workgroup OFFICE, WINS support on. nmbd listens on UDP 137/138, smbd on TCP 139/445.
testparm -snetstat -lnunetstat -lntnmblookup FILESRVnmblookup -U 192.168.217.10 --recursion FILESRVnmblookup -A 192.168.217.10smbclient -L FILESRV -U asha%LabPass197$ netstat -lnuudp 0 0 192.168.217.10:137 0.0.0.0:*udp 0 0 192.168.217.10:138 0.0.0.0:*$ netstat -lnttcp 0 0 192.168.217.10:445 0.0.0.0:* LISTENtcp 0 0 192.168.217.10:139 0.0.0.0:* LISTEN- nmblookup FILESRV resolves by broadcast to 192.168.217.10; -U ... --recursion sends a unicast query to WINS.
- -A shows node status: FILESRV and group OFFICE registered; H = hybrid node (asks WINS first, then broadcast).
$ nmblookup -A 192.168.217.10Looking up status of 192.168.217.10 FILESRV <00> - H <ACTIVE> FILESRV <20> - H <ACTIVE> OFFICE <00> - <GROUP> H <ACTIVE> OFFICE <1e> - <GROUP> H <ACTIVE>$ smbclient -L FILESRV -U asha%LabPass197 Sharename Type Comment --------- ---- ------- docs Disk Team documents public Disk Public files IPC$ IPC IPC Service (N197 lab file server)SMB1 disabled -- no workgroup available- docs and public are disk shares, IPC$ is a hidden service share. 'SMB1 disabled -- no workgroup available': NetBIOS browsing is legacy.
197.7 Common mistakes
- Thinking Private is safer because of its name: Public is the strictest. Cafe = Public, home = Private.
- Expecting the Domain profile at home without VPN: the DC is unreachable, so it is Private or Public.
- Relying on NetBIOS/WINS for names in new networks instead of DNS.
- Leaving SMB1 or ports 137-139 open when only 445 is needed.
197.8 Interview tips
- Workgroup = peer to peer, local users, no central control; domain = AD DC, central users and Group Policy, Kerberos login.
- SMB uses TCP 445; NetBIOS ports are UDP 137, 138 and TCP 139.
- Domain profile is applied only when the DC is reachable; Set-NetConnectionProfile sets only Public/Private.
- WINS is a central NetBIOS name DB; replace it with DNS.
- Prefer PowerShell cmdlets over netsh for scripting.