Настройка ip адреса windows 10 из командной строки


Windows, Windows 10, Windows 7, Windows 8, Windows Server, Windows Vista, Windows XP

  • 04.03.2020
  • 51 747
  • 4
  • 28.02.2023
  • 71
  • 70
  • 1

Как изменить IP адрес компьютера из командной строки или bat-файла

  • Содержание статьи
    • Описание
    • Комментарии к статье ( 4 шт )
    • Добавить комментарий

В процессе работы в ОС семейства Windows иногда бывает необходимо изменить IP адрес компьютера не через графический интерфейс, а с помощью пакетного файла (bat) или же с помощью командной строки (cmd). В данной статье мы расскажем о том, как это можно сделать.

Описание

Смена IP адреса компьютера осуществляется с помощью утилиты netsh, которая входит в состав Windows начиная с самых старых версий этой ОС. Чтобы правильно сменить IP адрес, сначала надо выяснить текущую конфигурацию. Сделать это можно в командной строке при помощи команды

netsh interface ip show address


Результат работы этой команды — отображение текущей конфигурации всех сетевых интерфейсов, настроенных в ОС. Из всех, нам необходимо найти и запомнить название того интерфейса, для которого мы хотим поменять адрес. В нашем примере видно, что интерфейс называется Ethernet. Текущий IP адрес 192.168.100.136, маска подсети 255.255.255.0, а основной шлюз 192.168.100.1.
Предположим, что нужно сменить наш IP адрес на 192.168.100.10, адресация в сети статическая, без использования DHCP, шлюз остается прежним 192.168.100.1, маска тоже не меняется 255.255.255.0

В этом случае, команда, которая должна быть выполнена из пакетного файла или командой строки принимает следующий вид:

netsh interface ip set address name="Ethernet" static 192.168.100.10 255.255.255.0 192.168.100.1

После выполнения этой команды у интерфейса Ethernet сменится IP адрес на 192.168.100.10, как на скриншоте ниже.

В том случае, если вы укажите неверное название интерфейса, то получите ошибку следующего содержания: «Синтаксическая ошибка в имени файла, имени папки или метке тома.«. Проверьте внимательно, что нигде не ошиблись при написании.

Также вы можете столкнуться со следующей ошибкой: «Для запрошенной операции требуется повышение прав (запустите с правами администратора)«. Как видно из текста ошибки, необходимо запустить командную строку (или bat-файл) с правами администратора, как это сделать на разных версиях Windows, можно прочитать в этой статье.

Команда netsh предоставляет широкие возможности по управлению сетевыми настройками из командной строки. Для ознакомления с другими ее функциональными возможностями пользуйтесь справкой при помощи netsh /?

Содержание

  • Способ 1: «Параметры»
  • Способ 2: «Свойства сетевого адаптера»
  • Способ 3: «Командная строка»
  • Вопросы и ответы

изменение параметров ip вручную в windows 10

Перед тем как менять параметры IP самостоятельно, рекомендуем куда-то записать текущие значения, поскольку они могут пригодиться во время редактирования, а также на случай, когда потребуется вернуть предыдущие адреса.

Читайте также: Определение IP-адреса компьютера с Windows 10

Способ 1: «Параметры»

Обычно компьютеру автоматически присваивается IP-адрес провайдером. Но изменить его параметры можно вручную с помощью соответствующего раздела в системных «Параметрах». Этот вариант, скорее, подойдет для проводного типа соединения, когда ПК или ноутбук напрямую подсоединен к маршрутизатору:

  1. Нажмите на кнопку «Пуск», затем выберите приложение «Параметры».
  2. изменение параметров ip вручную в windows 10-01

  3. Перейдите в раздел «Сеть и Интернет».
  4. изменение параметров ip вручную в windows 10-02

  5. Нажмите на вкладку слева «Ethernet», а в центральной части окна выберите активное соединение.
  6. изменение параметров ip вручную в windows 10-03

  7. Пролистайте до блока «Параметры IP» и кликните по кнопке «Редактировать».
  8. изменение параметров ip вручную в windows 10-04

  9. Во всплывающем окне нажмите на выпадающее меню и выберите пункт «Вручную».
  10. изменение параметров ip вручную в windows 10-05

  11. Отобразятся два варианта для изменения: «IPv4» и «IPv6». Чтобы изменить тот или иной протокол, переведите тумблер в активное состояние.
  12. изменение параметров ip вручную в windows 10-06

  13. Появятся дополнительные текстовые поля для ручного ввода параметров: IP-адрес, сервера DNS, шлюз и длина префикса подсети. Как только все данные будут введены, нажмите на кнопку «Сохранить».
  14. изменение параметров ip вручную в windows 10-07

Следует отметить, что при редактировании параметров необходимо быть уверенным, что все данные верны, иначе подключение к интернету может быть нарушено. Если у вас не получается сохранить новые параметры, то ознакомьтесь с нашей отдельной инструкцией:

Подробнее: Что делать, если не удается сохранить параметры IP-адреса в Windows 10

Способ 2: «Свойства сетевого адаптера»

Этот метод классический, поскольку используется «Панель управления», свойственная и предыдущим Windows. Через нее нужно перейти в окно с настройкой свойств сетевого адаптера:

  1. Через строку системного поиска отыщите средство «Панель управления».
  2. изменение параметров ip вручную в windows 10-08

  3. Для удобства просмотра разделов выберите «Крупные значки» в верхнем правом углу, затем перейдите в «Центр управления сетями и общим доступом».
  4. изменение параметров ip вручную в windows 10-09

  5. В новом окне щелкните по ссылке «Изменение параметров адаптера» на левой панели.
  6. изменение параметров ip вручную в windows 10-10

  7. Отобразится список всех подключений, которые были на ПК или ноутбуке. Отыщите нужное, затем щелкните по нему правой кнопкой мыши и из меню выберите пункт «Свойства».
  8. изменение параметров ip вручную в windows 10-11

  9. На вкладке «Сеть» выделите нажатием левой кнопкой мыши пункт «IP версии 4 (TCP/IPv4)», а потом кликните по кнопке «Свойства».
  10. изменение параметров ip вручную в windows 10-12

  11. Поставьте отметку у опции «Использовать следующий IP-адрес», после чего ниже поля станут доступными для редактирования. Введите нужные значения. Так же можно поступить и со сменой DNS-сервера. Сохраните настройки.
  12. изменение параметров ip вручную в windows 10-13

Аналогичные действия при необходимости есть возможность проделать и с протоколом «IP версии 6 (TCP/IPv6)», выбрав его в списке окна со свойствами сети.

Способ 3: «Командная строка»

Изменить некоторые параметры IP, в частности статический IP-адрес и DNS-сервер, можно, используя команды. Зная их, не придется копаться в настройках, что может сэкономить время:

  1. Запустите «Командную строку» от имени администратора. Для этого воспользуйтесь поисковой строкой на нижней панели.
  2. изменение параметров ip вручную в windows 10-14

  3. Чтобы посмотреть все конфигурации сетевых адаптеров, введите команду ipconfig /all и нажмите на клавишу «Enter». В списке отыщите тот адаптер, параметры IP которого собираетесь изменить.
  4. изменение параметров ip вручную в windows 10-15

  5. Чтобы задать сетевому адаптеру статический IP-адрес, вставьте netsh interface ip set address name="Ethernet" static 192.168.1.10 255.255.255.0 192.168.1.1, где нужно прописать свои параметры: вместо «Ethernet» – имя вашего адаптера, а цифры обозначают данные IP-адресов. Выполните команду клавишей ввода.
  6. изменение параметров ip вручную в windows 10-18

  7. Далее можете заменить предпочитаемый и альтернативный DNS-серверы, поочередно выполнив команды netsh interface ip set dns name="Ethernet" source="static" address="адрес_DNS-сервера" и netsh interface ip add dns name="Ethernet" address="адрес_DNS-сервера" index=2, не забывая прописывать вместо «Ethernet» и цифр свои данные.
  8. изменение параметров ip вручную в windows 10-17

То же самое можно проделать и через консоль «Windows PowerShell», запущенную с расширенными правами.

Еще статьи по данной теме:

Помогла ли Вам статья?

Configuring IP address in a Windows with CMD performed using netsh command line utility. The network shell (netsh) is a set of commands that help you configure any Windows operating system IP address, Network Interfaces, and Windows Firewall. The usage of the command line is for pro level Windows users. Those who are playing the network infrastructure configuration. But using the command line as normal Windows user indicate your expertise to Windows environment. If you are new to Windows command line, this article “configure IP address with command prompt in Windows 10” will help you begin using command line interface.

Configuring Windows IPv4 Networking with Netsh or Network Shell. Netsh is a command-line utility included in Microsoft’s Windows NT line of operating systems beginning with Windows 2000. It allows local or remote configuration of network devices such as the NICs.

Before setting IP address with cmd in Windows 10, you need to know how to find your IP address on Windows 10. So before everything, you must know the network IP address configuration on your system.

Let’s learn the process of IP configuration step by step. I am going to explain it with an easy pictorial guide. If you don’t understand some part, just kindly comment us and ask your questions.

The process of Changing Windows 10 IP Address with Command Prompt: 

  1. Find your IP address in Windows 10.
  2. View network interfaces card.
  3. Change IP address on Windows 10.
  4. Change DNS IP address with the command line.
  5. Reset IP address with Command Prompt.

How to Find your IP Address on Windows 10?

There are many options for finding IP address on Windows 10. The easy one is “ipconfig” command. To find your IP address on Windows 10, just type “ipconfig” in command prompt. To do this process:

  1. Press Windows+R keys to open the Run.
  2. Type “cmd” in the run and press enter.
  3. Now type “ipconfig” to show the IP address.

The “ipconfig” command shows everything about your computer network interfaces. You might have many physical or virtual network interface card.

How to Find Your IP Address on Windows 10 - Technig

How to Find Your IP Address on Windows 10 – Technig

Here, I just have one network interface on my Windows 10 computer. The result of ipconfig command shows that the IP 169.254.29.130 with the mask of 255.255.255.0 is my current Windows IP address.

This is a class C “autoconfiguration IPv4”. When your system doesn’t find any DHCP Server or manual IP address, it obtains auto IP address. So let’s change it.

How to Change IP Address with Command Prompt?

For change IP address, open command prompt or PowerShell. Both works the same and you can run all command prompt commends on Powershell as well. Ok, run cmd or Powershell as administrator. Netsh work in both command prompt and Powershell. I’m using Windows Powershell to change IP address on Windows 10 completely. Becuase the user interface and color’s of Powershell is better than Command prompt.

  1. Type “Powershell” in Windows 10 search box to run Windows Powershell.
  2. You need to run Powershell as administrator. Just press Windows+Shift the press enter to run Powershell as administrator. Or right-click the Powershell and click Run as administrator.

PowerShell Guide in Windows 10

PowerShell Guide in Windows 10

To find the network interface with the command line, type the following command on Powershell.

Netsh interface ipv4 show interface

Netsh Command to Check Network Adapter in Windows 10

Netsh Command to Check Network Adapter in Windows 10

The result shows two network interfaces. The Loopback and the Ethernet. The Loopback is Windows builtin network loopback interface, but our pointed network interface is the ethernet.

To find your IP address in Windows 10 with netsh command, just type the following command.

netsh interface ipv4 show config

How to Find Your IP Address on Windows 10 with Netsh Command - Technig

How to Find Your IP Address on Windows 10 with Netsh Command – Technig

It displays all the network interface configuration. The output result is clear and better than output result of “ipconfig” command on Command prompt. So to find an exact information of the network interface, just add the index ID of the network interface at the end of the command.

netsh interface ipv4 show config 2

How to Find Windows 10 IP address with Command Line - Technig

How to Find Windows 10 IP address with Command Line – Technig

That’s good. Let’s configure and change Windows 10 IP address with the command line. The command is bit long but easy to understand. No need to remember, just try to understand the netsh command structure.

To change the IP address of the “Ethernet0” network interface, type the following command.

netsh interface ipv4 set address name=2 static 200.100.10.5 mask=255.255.255.0 gateway=200.100.10.1

Change IP Address in Windows 10 using Command Line - Technig

Change IP Address in Windows 10 using Command Line – Technig

Once the command executed successfully, check the result with “netsh interface ipv4 show config 2” command. Yes, the output result shows the exact IP address has set on the “Ethernet0” network interface. Now the Windows IP address is 200.100.10.5 with the mask of 255.255.255.0 and default gateway is 200.100.10.1.

Note: You can’t change the default gateway separately with the following command. It will remove the IP address and just set the default gateway address.

netsh interface ipv4 set address name=2 gateway= (Gateway IP Address)

That’s good and enough for IP address configuration in Windows 10 with the command line. Let’s change DNS IP address from the command line.

  • Related: MCSA Lab Manual Articles.

How to Change DNS IP address from Command Prompt?

DNS IP address is the unique address in the network that resolves computer name to IP address and IP address to the computer name. In the network, finding a computer with a name is easy than 32-bit IPv4 address. To set or change the DNS IP address, just simply do it with the following command.

netsh interface ipv4 set dns name=2 static 200.100.10.30

How to Change DNS IP address from Command Prompt - Technig

How to Change DNS IP address from Command Prompt – Technig

You might see some error on a simple local network, because of not having a DNS server. When you don’t have a DNS server, it’s not necessary to set DNS IP address on your computer.

Configure IP Address with command prompt in Windows - Technig

Configure IP Address with command prompt in Windows – Technig

Finally, recheck the result with “netsh interface ipv4 show config 2” command. The output netsh command should be displayed with DNS IP address.

Final World

Configure IP address with command prompt in Windows has tow benefits. The first benefit of working with Windows command line helps get you improve your skills in Windows environment. The second benefit is command line is faster than GUI. If you work with the command line, you will understand the power of command line.

The Windows command line interface has improved a lot in Windows 10. Now you can find some Linux commands that run in Windows 10 and works the same on Linux. Finally, hope you learn how to configure IP address with Command Prompt in Windows operating systems. If you don’t understand, please ask us about how to configure IP address with command prompt in Windows 10?

Любой системный администратор сталкивается с настройкой сетевых интерфейсов. Большинство для этой цели используют графический интерфейс Windows, что не всегда удобно. В этой статье я расскажу, как настроить сеть с помошью интерфейса командной строки cmd, используя встроенную утилиту netsh.

В операционных системах Windows есть специальная утилита netsh для настройки сетевого адаптера из командной строки cmd.

netsh.exe (network shell) — сетевая оболочка (программа) для ОС Windows, которая позволяет настраивать сетевые параметры, в том числе и удаленно. Данная утилита доступна на всех версиях Windows, начиная с Windows 2000.

Запуск командной строки:

Пуск —> Выполнить —> в строку вводим cmd.exe

Откроется черное окно с мигающим курсором. Тут мы и будем вводить перечисленные ниже команды (ну это для тех, кто никогда не работал с командной строкой).

Конфигурирование сетевых параметров (ip-адреса, сетевой маски и шлюза)

Уснановка ip-адреса, маски и шлюза.

netsh interface ip set address name="Local Area Connection" static 192.168.1.15 255.255.255.0 192.168.1.1

где
Local Area Connection — название вашего сетевого интерфейса.
192.168.1.15 — сетевой адрес (ip address).
255.255.255.0 — сетевая маска (network mask).
192.168.1.1 — шлюз (default gateway).

Установка дополнительного ip-адреса.

netsh interface ip add address name="Local Area Connection" 192.168.1.20 255.255.255.0

Включение автоматического получения ip-адреса, сетевой маски и шлюза от DHCP-сервера.

netsh interface ip set address "Local Area Connection" dhcp

Конфигурирование DNS и WINS серверов

Добавить предпочитаемый DNS сервер.

netsh interface ip set dns "Local Area Connection" static 8.8.8.8

Добавить альтернативный DNS сервер.

netsh interface ip add dns "Local Area Connection" 8.8.4.4

Добавить 3-й DNS сервер.

netsh interface ip add dns "Local Area Connection" 192.168.1.30 index=3

Установка автоматического получения предпочитаемого и альтернативного dns-сервера от DHCP-сервера.

netsh interface ip set dns "Local Area Connection" dhcp

Установка WINS.

netsh interface ip set wins "Local Area Connection" static 192.168.1.240

Включение и отключение сетевых интерфейсов

Отключение интерфеса

netsh interface set interface name="Local Area Connection" admin=DISABLED

Включение интерфеса

netsh interface set interface name="Local Area Connection" admin=ENABLED

Просмотр сетевых настроек

Расширеный вывод конфигурации сетевых интерфейсов.

netsh interface ip show config

Просмотр состояния интерфейсов (connected/disconnected).

C:\Windows\System32>netsh interface ip show interface
Инд  Мет         MTU         Состояние     Имя
---  ----------  ----------  ------------  ---------------------------
  1          50  4294967295  connected     Loopback Pseudo-Interface 1
 12          10        1300  disconnected  Local Area Connection

Просмотр таблицы маршрутизации.

netsh interface ip show route

Просмотр конфигурации IP-адресов.

netsh interface ip show addresses

Просмотр адресов DNS-сервера.

netsh interface ip show dnsservers

Просмотр адресов WINS-сервера.

netsh interface ip show winsservers

Сохранение и восстановление конфигурации сетевых интерфейсов

Ну а теперь самое интересное. Поговорим о том, как сохранить сетевые настройки в виде файла конфигурации и восстановить из файла конфигурации. Это может пригодиться тем, кто постоянно меняет сетевые настройки.

Сохранить сетевые настройки в виде файла.

C:\Windows\System32>netsh -c interface dump > C:\my-config.txt

Восстановить сетевые настройки из файла конфигурации.

C:\Windows\System32>netsh -f C:\my-config.txt

Вот и все. Мы рассмотрели далеко не все возможности утилиты Netsh.exe, а лишь самые часто используемые. Используя коммандную строку Windows и утилиту netsh можно намного облегчить себе жизнь.

The Command Prompt application, sometimes referred to as command shell, is found in most Windows NT-based operating systems. Its purpose is to execute specific commands for troubleshooting or solving specific Windows issues, performing advanced administrative functions, and automating tasks via batch files and scripts.

That said, you can also use it to change your IP address when you want to spoof it to bypass geoblocks or online bans on sites that impose such restrictions on their content, or change your Domain Name System (DNS) servers for troubleshooting reasons or to make surfing more secure and faster.

In this guide, we’re going to show you how to change your IP address and DNS servers using the Command Prompt in Windows 10.

An IP address holds information about your device, location, your internet service provider (ISP), and browser information.

Changing it is useful when you have a malfunctioning router that’s providing addresses used by a different computer on the network or an invalid address is accidentally configured.  It’s also helpful when you want to install a new router and reconfigure your home network to use the default IP address range.

The first step to changing your IP address is to find the network name for the interface you want to change. 

  • Open an elevated Command Prompt by typing CMD in the search bar and clicking on Run as Administrator.
  • Next, type netsh interface ipv4 show config in the command prompt window, press Enter, and scroll down to the interface you want.

In our case, we’ll be modifying the WiFi interface, but you can pick the correct interface for your case. Make note of the interface name.  

  • To change the IP address, type this command: netsh interface ipv4 set address name=”YOUR INTERFACE NAME” static IP_ADDRESS SUBNET_MASK GATEWAY

In our example, this command would look like this: netsh interface ipv4 set address name=”Wi-Fi” static 192.168.0.173 255.255.255.0 192.168.0.0

This command will use the Wi-Fi interface, set the IP address to 192.168.0.173, set the subnet mask to 255.255.255.0 and set the default gateway to 192.168.0.0.

If you want to switch to using an IP address automatically assigned by a DHCP server instead of a static IP address, use the netsh interface ipv4 set address name=”YOUR INTERFACE NAME” source=dhcp command.

How To Change DNS Servers Using Command Prompt

 A DNS server holds public IP addresses and related hostnames in a database, and is used to resolve or translate the hostnames to IP addresses. The server does this by running special software to communicate with other servers through special protocols based on certain requests from the computer. 

The conversion process is thoroughly vetted and verified, and it happens quickly behind the scenes so as to obtain information corresponding to the server that the computer is looking for, and then tells the original connecting computer where to go so that it can connect to that server.  

There are several reasons why you’d want to change your default DNS server, but the main ones are:

  • Boost your privacy when getting around a firewall, bypassing geoblocks or ISP blocks on a website
  • Increase security
  • Parental controls like blocking websites from your router
  • Speed your surfing, which your own ISP’s DNS servers may not offer because they’re not always reliable or up-to-date

Note: You can change DNS servers individually for your home network on your router or on computers, smartphone, and Chromebook, among other devices

How To Change DNS Servers With Command Prompt

Follow the steps below to learn how to change DNS servers using Command Prompt.

  • Open an elevated Command Prompt by typing CMD in the search bar, and clicking Run as Administrator.
  • Type netsh and press Enter.
  • Next, type interface ip show config and press Enter.
  • Find the network interface whose DNS server you want to change, and enter the netsh interface ipv4 set dns name=”YOUR INTERFACE NAME” static DNS_SERVER. This will set your primary DNS server.

From our example above, we changed the IP address for the “Wi-Fi” interface, so we’ll use the same example to change DNS servers. 

For purposes of this guide, we’ll use Google’s primary public DNS server, 8.8.8.8. The command will look something like this: netsh interface ipv4 set dns name=”Wi-Fi” static 8.8.8.8

  • Next, type the netsh interface ipv4 set dns name=”YOUR INTERFACE NAME” static DNS_SERVER index=2 command to set the secondary DNS server. Again, we’ll use Google’s public DNS secondary server, 8.8.8.8  as an example, which will look like this: netsh interface ipv4 set dns name=”Wi-Fi” static 8.8.4.4 index=2.

Note: You can use the netsh interface ipv4 set dnsservers name”YOUR INTERFACE NAME” source=dhcp command if you want the network interface to automatically pick DNS settings from a DHCP server. Continuing with our example, this command would look like this: netsh interface ipv4 set dnsservers name”Wi-Fi” source=dhcp

Conclusion

Command Prompt is a great tool to use when you want to change IP addresses and DNS servers. It’s faster and saves you the hassle of having to click through several windows and dialog boxes from the Control Panel interface just to get to the IPv4 Properties dialog box to do the same thing. 

Was this guide helpful? Let us know by dropping your comment in the section below.

  • Настройка dfs windows server 2019
  • Настройка ip адреса windows 10 вручную
  • Настройка dcom для opc windows 10
  • Настройка intel hd graphics windows 10
  • Настройка com порта windows xp