我有一个安装了Windows 10 ioT的Raspberry Pi 2.如何在代码中静态设置IP地址?
I have a Raspberry Pi 2 with Windows 10 ioT installed. How do I set the IP Address statically in code?
推荐答案您可以通过通过Powershell远程连接到您的设备并运行"netsh".
You can do this by connecting remotely to your device via Powershell and running "netsh".
您可以使用Netsh命令行实用程序执行各种任务,包括在Windows中配置网络适配器的IP地址.
You can perform a variety of tasks using the Netsh command-line utility, including configuring the IP addresses of network adapters in Windows.
以下是配置静态IP地址的方法:
netsh接口ip设置地址连接名称"静态192.168.0.101 255.255.255.0 192.168.0.1
netsh interface ip set address "connection name" static 192.168.0.101 255.255.255.0 192.168.0.1
注意:默认连接名称是有线适配器的本地连接和Wi-Fi适配器的无线网络连接. IP地址顺序:客户端IP,子网掩码和网关IP.
NOTE: The default connection names are Local Area Connection for wired adapters and Wireless Network Connection for Wi-Fi adapters. The IP address order: client IP, subnet mask, and gateway IP.
以下是配置DNS地址的方法:
netsh接口ip添加dns连接名称" 208.67.222.222
netsh interface ip add dns "connection name" 208.67.222.222
netsh接口ip添加dns连接名称" 208.67.220.220 index = 2
netsh interface ip add dns "connection name" 208.67.220.220 index=2
注意:请记住要替换连接名称和IP地址.
NOTE: Remember to replace the connection names and IP addresses.
更多推荐
如何使用Windows Universal App设置设备的IP地址?
发布评论