Windows で IP アドレスを使用してプロキシを設定する
This guide explains how to replace a proxy DNS hostname (e.g.,proxy.company.com) with its IP address on Windows, using either the GUI or PowerShell.
この方法は、次のような状況で役立ちます。
- DNS 名前解決がブロックされている、または信頼できない
- ネットワーク遅延または証明書の信頼の問題がパフォーマンスに影響する
- アクセスを特定の IP アドレスのみに制限する必要がある(egress control)
手動の方法(インターネット オプション)
- Control Panel → Internet Options を開きます
- Connections タブに移動します
- LAN Settings をクリックします
- Under Proxy server, enable the checkbox:
proxy.company.comをプロキシ IP(例:192.168.1.10)に置き換えます- ポート(通常は
8080)を設定します
- OK をクリックし、次に Apply をクリックします
これは、WinINET プロキシ スタックを使用するほとんどのアプリケーション(例:Internet Explorer、Microsoft Edge Legacy、Office アプリ)に適用されます。
スクリプトによる方法(PowerShell)
この PowerShell スクリプトを使用して、IP アドレスを使って WinHTTP と WinINET の両方のプロキシ設定を構成します。
# Define proxy IP and port
$proxyIP = "http://192.168.1.10:8080"
# Configure proxy for WinHTTP (used by system services like Intune, Windows Update)
netsh winhttp set proxy $proxyIP ";$bypassList"
# Configure proxy for WinINET (used by most user apps and browsers)
$regPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Set-ItemProperty -Path $regPath -Name ProxyEnable -Value 1
Set-ItemProperty -Path $regPath -Name ProxyServer -Value $proxyIP
Set-ItemProperty -Path $regPath -Name ProxyOverride -Value $bypassList