====== Настройка сети в Windows из командной строки (bat файл) ====== ===== Для DHCP ===== @echo off netsh interface ip set address name="LAN" source=dhcp exit где //LAN// - название сетевого подключения. По умолчанию «Подключение по локальной сети». ===== Статический IP ===== @echo off netsh interface ip set address name="LAN" static 192.168.13.13 255.255.255.0 192.168.13.37 0 netsh interface ip set dns name="LAN" static 192.168.13.37 primary netsh interface ip add dns name="LAN" 8.8.8.8 exit ===== Просмотр текущей конфигурации ===== netsh interface ip show config ===== Экспорт команд конфигурации в скрипт netsh ===== netsh -c interface ip dump > c:\if-ip-dump.txt ===== Импорт скрипта конфигурации netsh в систему ===== netsh -f c:\if-ip-dump.txt Конфигурирование интерфейса через DHCP: netsh interface ip set address "Local Area Connection" dhcp netsh interface ip set dns "Local Area Connection" dhcp Статическое конфигурирование интерфейса: netsh interface ip set address //"Local Area Connection"// static //ipaddr subnetmask gateway metric// netsh interface ip set address "Local Area Connection" static 192.168.0.100 255.255.255.0 192.168.0.1 1 netsh interface ip set dns "Local Area Connection" static 192.168.0.1 netsh interface ip set wins "Local Area Connection" static 192.168.0.2 Добавление и удаление дополнительного ip-адреса: netsh interface ip add address "Local Area Connection" 192.168.0.200 255.255.255.0 netsh interface ip del address "Local Area Connection" 192.168.0.200 Удаление основного DNS-сервера: netsh interface ip del dns "Local Area Connection" 192.168.0.1 Добавление и удаление дополнительного DNS-сервера: netsh interface ip add dns "Local Area Connection" 192.168.0.2 index=2 netsh interface ip del dns "Local Area Connection" 192.168.0.2