-
一.设置IP:
设置动态获取IP地址(DHCP)
输入 netsh interface ip set address name=”本地连接” source=dhcp设置固定IP 例如要改成IP 为192.168.0.3 掩码为255.255.255.0 网关为192.168.0.254netsh interface ip set address name=”本地连接” source=static addr=192.168.0.3 mask=255.255.255.0 gateway=192.168.0.1 /32
参数说明:
1.name:网络连接名称,一般为“本地连接”。你可以在“控制面板”->“网络连接”中看到。
2.source:获取IP的途径。动态获取,则为dhcp,手动设置,则为static。
3.addr:要设置的IP地址。
4.mask:子网掩码。
5.gateway:网关地址。
6.gwmetric:网关跃点数,可以设置为整型数值,也可以设置为“自动”:auto。
-
2
二.设置DNS:
自动获取DNSnetsh interface ip set dns name=”本地连接” source=dhcp手动设置单个DNS 例218.85.157.99
netsh interface ip set dns name=”本地连接” source=static addr=218.85.157.99 register=primary
需要多加个备用DNS 例202.101.98.55
netsh interface ip add dns name=”本地连接” source=static addr=202.101.98.55 index=2
参数说明:
1.name:网络连接名称,一般为“本地连接”。你可以在“控制面板”->“网络连接”中看到。
2.source:获取IP的途径。动态获取,则为dhcp,手动设置,则为static。
3.addr:要设置的IP地址。
4.register:
5.none: 禁用动态 DNS 注册。
6.primary: 只在主 DNS 后缀下注册。
7.both: 在主 DNS 后缀下注册,也在特定连接后缀下注册。
8.index:设置的DNS的顺序号。
-
--设置IP、子网掩码、网关-- cmd /c netsh interface ip set address "%net_interface%" source=static addr=%ip2% mask=%mask1% gateway=%gateway2% --设置dns-- cmd /c netsh interface ip set dns "%net_interface%" static %dns1% cmd /c netsh interface ip add dns "%net_interface%" %dns2% index=2 --------------------- --设置ip/dns为自动获取-- cmd /c netsh interface ip set address name="%net_interface%" source=dhcp cmd /c netsh interface ip set dns "%net_interface%" source=dhcp --------------------- --重启网卡-- cmd /c netsh interface set interface "%net_interface%" disabled cmd /c netsh interface set interface "%net_interface%" enable
DOS设置IP及DNS
最新推荐文章于 2024-01-19 16:04:26 发布