Windows でプロキシ アドレスを DNS 名から IP に変更する
このガイドでは、Windows でプロキシのDNS ホスト名(例:proxy.company.com)を生の IP アドレスに置き換える方法を、手動とPowerShell を使用する方法の両方で説明します。
これは、次のような環境で役立ちます。
- DNS 名前解決が不安定またはブロックされている
- 証明書の信頼またはネットワーク遅延の問題が発生する
- 明示的な送信先 IP ベースのアクセス制御が必要
手動の方法(インターネット オプション)
- 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"
# List of domains to bypass proxy
$bypassList = "localhost;127.0.0.1;*.microsoftonline.com;*.core.windows.net"
# 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