Windows 中的 iptables 指令模擬

Windows 中的 iptables 指令模擬

iptables -I FORWARD -s 192.168.1.100 -p udp --dport 27000:27200 --match string --algo kmp --string 76561198923445525 -j ACCEPT

我需要簡單地模擬 Windows 作業系統中的工作命令,例如 powershell 或....cmd...等等。

基本上我們有一個具有 ID 的用戶連接到伺服器。使用該命令,我們在 192.168.1.100 本機伺服器內的連接埠 27000:27200 上接受指定的字串 ID。如何在沒有 iptables 的情況下使其工作?

答案1

這將相當接近。 Windows 防火牆允許經過驗證的連線(使用者對應),但這可能對您不起作用,具體取決於連線的用戶端類型以及它是否支援:

New-NetFirewallRule -DisplayName My-Firewall-Rule `
    -Direction Inbound `
    -Enabled True `
    -Action Allow `
    -Protocol UDP `
    -LocalPort 27000 `
    -LocalAddress 192.168.1.100 `
    -Authentication Required `
    -RemoteUser "D:(A;;CC;;;$UserSID)"

替換$UserSID為要進行身份驗證的使用者的實際 SID。

這並不完全相同,我不相信windows真的具有與iptables中的FORWARD鏈相同的功能,而沒有一些路由功能

# Basic maintenance commands:
Get-NetFirewallRule -DisplayName My-Firewall-Rule | format-list *  ## show all properties
Remove-NetFirewallRule -DisplayName My-Firewall-Rule  ## Delete your rule

# Enable detailed logging:
Set-NetFirewallProfile -LogAllowed True -LogFileName %SystemRoot%\System32\LogFiles\Firewall\pfirewall.log

# Watch log:
Get-Content -Tail 10 -Wait "C:\windows\System32\LogFiles\Firewall\pfirewall.log"

Get-Help New-NetFirewallRule -Full對於其他任何內容,請查看或中的範例和文檔網路文件。考慮在您的問題中添加更多信息,以了解您到目前為止所嘗試的內容以及正在使用的客戶端/伺服器作業系統。

相關內容