Keri sisuni

Spikker: Võrk, tulemüür ja teenused

Laborivõrgu plaan

Masin IP-aadress Mask Lüüs DNS-server
DC01 192.168.50.10 255.255.255.0 (/24) tühi 127.0.0.1
WS01 192.168.50.20 255.255.255.0 (/24) tühi 192.168.50.10
CORE01 (valikuline) 192.168.50.11 255.255.255.0 (/24) tühi 192.168.50.10

Laboriparool kõigil kontodel: Passw0rd.

Hyper-V (sinu arvutis)

New-VMSwitch -Name "LabNet" -SwitchType Internal
Get-VMSwitch
Connect-VMNetworkAdapter -VMName "WS01" -SwitchName "LabNet"

Võrk

ipconfig
ipconfig /all
Get-NetAdapter
Get-NetIPAddress -AddressFamily IPv4
New-NetIPAddress -InterfaceAlias "Ethernet" -IPAddress 192.168.50.20 -PrefixLength 24
Set-DnsClientServerAddress -InterfaceAlias "Ethernet" -ServerAddresses 192.168.50.10
Rename-Computer -NewName "WS01" -Restart
hostname
ping 192.168.50.10
Test-NetConnection 192.168.50.10
Test-NetConnection 192.168.50.10 -Port 80

Tulemüür

Get-NetConnectionProfile
Get-NetFirewallRule -DisplayName "Lab*" | Format-Table DisplayName, Enabled, Direction, Action, Profile
New-NetFirewallRule -DisplayName "Lab - ping" -Direction Inbound -Protocol ICMPv4 -IcmpType 8 -Action Allow -Profile Any
New-NetFirewallRule -DisplayName "Lab - web" -Direction Inbound -Protocol TCP -LocalPort 80 -Action Allow -Profile Any
New-NetFirewallRule -DisplayName "Lab - esitus" -Direction Inbound -Protocol TCP -LocalPort 6767 -Action Allow -Profile Any
Set-NetFirewallRule -DisplayName "Lab - ping" -Profile Any
Disable-NetFirewallRule -DisplayName "Lab - ping"
Enable-NetFirewallRule -DisplayName "Lab - ping"
Remove-NetFirewallRule -DisplayName "Lab - ping"

Graafiline liides: Win+R, wf.msc.

Teenused ja rollid

Get-Service -Name Spooler
Stop-Service -Name Spooler
Start-Service -Name Spooler
Set-Service -Name Spooler -StartupType Automatic    # Automatic, Manual, Disabled
Get-Service -Name W3SVC                             # IIS-i teenus

Install-WindowsFeature -Name Web-Server -IncludeManagementTools    # ainult serveris
Install-WindowsFeature -Name Web-Scripting-Tools                   # IIS-i PowerShelli käsud (New-IISSite jt)
Get-WindowsFeature -Name Web-Server
New-IISSite -Name "Esitus" -PhysicalPath "C:\inetpub\esitus" -BindingInformation "*:6767:"   # uus veebisait pordil 6767
Get-IISSite                                                         # kõik veebisaidid
Set-Content -Path C:\inetpub\esitus\index.html -Value "<h1>Nimi</h1>" -Encoding UTF8

Graafiline liides: Win+R, services.msc. Serveris Server Manager > Manage > Add Roles and Features.

Nimed

Add-Content -Path C:\Windows\System32\drivers\etc\hosts -Value "192.168.50.10    dc01    mari.labor"
Get-Content -Path C:\Windows\System32\drivers\etc\hosts
ping dc01