How-To Geek

How to change your ip address from the command prompt in windows.

It's easy enough to change an IP address on your PC using Control Panel, but did you know you can also do it from the Command Prompt?

Quick Links

Launch command prompt as admin to use netsh, view your network information with command prompt, change your ip address, subnet mask, and default gateway, change your dns settings in command prompt, key takeaways.

  • You must launch Command Prompt, PowerShell, or Terminal as admin to use netsh.
  • Use the "netsh interface ipv4 show config" command to find the full name of the network interface you want to change.
  • Modify your IP address, subnet mask, and default gateway using the command "netsh interface ipv4 set address". You can also change DNS settings using "netsh interface ipv4 set dns".

Changing your IP address with the Control Panel interface isn't difficult, but it does require clicking through a number of different windows and dialog boxes. If you're a fan of the Command Prompt, though, you can get it done more quickly using the netsh command, which is just one of the great network utilities built into Windows .

We're going to use the netsh command, but it requires that Command Prompt be launched as administrator to work. The netsh command allows you to configure just about any aspect of your network connections in Windows.

To launch Command Prompt (or PowerShell) as Admin, open up the Start Menu, search "cmd," hover over the result, then click "Run as Administrator."

Run Command Prompt as administrator.

In Windows 10 or Windows 11, you can also right-click the Start menu (or press Windows+X on your keyboard) to open the Power User Menu and choose "PowerShell (Admin)."

You can (and should ) use PowerShell for this instead.

Before you change your IP address and related information, you'll need to find the full name of the network for the interface you want to change. To do this, type the following command:

netsh interface ipv4 show config

The output of netsh interface ipv4 show config. The Wi-Fi adapter is highlighted in red.

Scroll down until you see the interface you're looking for. In our example, we're going to modify the Wi-Fi interface, which on our machine is just named "Wi-Fi." You'll also see other default names that Windows assigns to interfaces, such as "Local Area Connection," "Local Area Connection* 2," and "Ethernet." Just find the one you're looking for and make note of the exact name. You can also copy and paste the name to Notepad and then back into Command Prompt later to make things easier.

With the interface name in hand, you're ready to change the IP Address, subnet mask, and gateway. To do this, you'll issue a command using the following syntax:

netsh interface ipv4 set address name="YOUR INTERFACE NAME" static IP_ADDRESS SUBNET_MASK GATEWAY

So, for example, your command might look something like the following:

netsh interface ipv4 set address name="Wi-Fi" static 192.168.3.8 255.255.255.0 192.168.3.1

Where the info is replaced by whatever you want to use. In our example, the command does the following:

  • Uses the interface name "Wi-Fi"
  • Sets the IP address to 192.168.3.1
  • Sets the subnet mask to 255.255.255.0
  • Sets the default gateway to 192.168.3.1

And if you're using a static IP address but want to switch to using an IP address assigned automatically by a DHCP server — such as your router — you can use the following command instead:

netsh interface ipv4 set address name="YOUR INTERFACE NAME" source=dhcp

You can also use the netsh command to change the DNS servers used by a network interface. Third-party DNS servers — like Google Public DNS and OpenDNS —can be faster and more reliable than the DNS servers provided by your ISP. Whatever your reason for changing your DNS server , you can do it either at the router so it affects all the devices that get their information from the router or at the individual device. If you want to change the DNS servers for just one PC, it's easy to do with the netsh command.

You'll need to use the command twice: once to set your primary DNS server and once to set your secondary, or backup, DNS server. To set your primary DNS server, use the following syntax:

netsh interface ipv4 set dns name="YOUR INTERFACE NAME" static DNS_SERVER

So, for example, your command might look something like the following (in which we set it to Google's primary public DNS server, 8.8.8.8):

netsh interface ipv4 set dns name="Wi-Fi" static 8.8.8.8

To set your secondary DNS server, you'll use a very similar command:

netsh interface ipv4 set dns name="YOUR INTERFACE NAME" static DNS_SERVER index=2

So, continuing our example, you might set your secondary DNS as the Google Public DNS secondary server, which is 8.8.4.4:

netsh interface ipv4 set dns name="Wi-Fi" static 8.8.4.4 index=2

And just like with the IP address, you can also change it so that the network interface grabs its DNS settings automatically from a DHCP server instead. Just use the following command:

netsh interface ipv4 set dnsservers name"YOUR INTERFACE NAME" source=dhcp

And there you have it. Whether you like typing at the command prompt better or just want to impress your coworkers, now you know all the command line magic you need for changing your IP address settings.

StackHowTo

  • How To Set Static IP Address in Windows 10 using CMD

I n this tutorial, we are going to see how to set static IP address in Windows 10 using CMD . There are several methods to set a static IP address in Windows 10. In this tutorial, we will see together how to set a static IP address from the Command Prompt.

In Windows 10, setting a static IP address for your device is an essential configuration that may be required in a number of scenarios. For example, if you plan to share files or a printer on a local network, or when you try to set up port forwarding.

Using CMD may seem difficult for some users, yet it is one of the fastest ways to assign a static IP address in Windows 10.

assign ip address command line windows

  • IPv4 address
  • Subnet mask
  • Default gateway
  • DNS servers

assign ip address command line windows

  • Types of Ethernet Cable
  • How to Install CAB File in Windows 10 using Command Line
  • How to Change Multiple File Extensions at Once in Windows 10 Using PowerShell
  • How to Make Taskbar Buttons Smaller in Windows 10
  • How to Run AutoHotKey Script on Startup Windows 10
  • How to Remap Keyboard Keys in Windows 10
  • How to Search Files by Size in File Explorer on Windows 10
  • How to Check Internet Data Usage in Windows 10
  • How to Change Folder Background Color in Windows 10
  • How to Turn off Location on Laptop Windows 10
  • How to Disable Sleep Option from Windows 10 Start Menu
  • How to Wake Up Computer From Sleep Mode in Windows 10 with Mouse
  • How to Wake Up Computer From Sleep Mode in Windows 10 with Keyboard
  • Batch File To Display Popup Message in Windows 10
  • How to Display Popup Reminder in Windows 10
  • How to See PC Startup and Shutdown History in Windows 10
  • How to Record Your Screen with VLC on Windows 7/8/10
  • How to Change Paging File Size in Windows 10
  • How to Display Full Path in Title Bar of File Explorer on Windows 10
  • How to Cancel Shutdown on Windows 10
  • How to Schedule Auto Shutdown in Windows 10
  • How to Schedule a Scan in Windows Defender
  • How to Calculate Total Duration of Multiple Video Clips in Windows 10
  • How to Fix Drag and Drop Problems in Windows 10
  • How to Disable Power Throttling in Windows 10
  • How to Run Program as Administrator Without Password Prompt in windows 10
  • How to Limit Windows Defender CPU Usage
  • How to Check if Windows 10 is Activated
  • How to Fix Right Click on Desktop Not Working in Windows 10
  • Image Resizer on Right-click for Windows 10
  • How to Change Computer Name in Windows 10
  • How to Change Account Picture in Windows 10
  • How to Zoom in and out in CMD and PowerShell
  • How to Lock Screen After Inactivity on Windows 10
  • How to Sync Computer Time With Internet in Windows 10
  • Command To Check Open Ports in Windows
  • How to Keep a Window Always On Top on Windows 10
  • How to Increase Font Size in Windows 10
  • How to Change Cursor Color in Windows 10
  • How to Change Cursor Size in Windows 10
  • How to Change Default PDF viewer on Windows 10
  • How to Disable Security Questions in Windows 10
  • How to Pin Specific Settings to the Start Menu in Windows 10

How to Format USB Device When FAT32 Option is Not Available

  • How to Automatically Open a Web Page at a Specific Time
  • How to Restart explorer.exe in Windows 10 Using CMD
  • How to Restart Explorer.exe in Windows 10 [2 Methods]
  • How to Add Program Shortcut to Start Menu in Windows 10
  • Hibernate Option Not Showing In Windows 10
  • How To Delete Previous Version of Windows in Windows 10
  • How to Add Print Option in Right-Click Menu
  • How to Delay Startup Programs in Windows 10/8/7
  • How to Disable Task Manager on Windows 10
  • How to Turn on Network Discovery in Windows 10
  • How to Check if Virtualization is Enabled in Windows 10
  • How to Password Protect a Zip File on Windows 10
  • How To Change User Folder Name in Windows 10
  • How to Restore Drivers in Windows 10
  • How to Backup Drivers using PowerShell Command in Windows 10
  • How to Add Store Apps to Startup in Windows 10
  • How to Enable Fingerprint in Windows 10
  • How to Enable Autocorrect and Predictive Text in Windows 10
  • How To Open a Second File Explorer Window in Windows 10
  • How to Block Websites On Your Computer
  • Check Disk Command in Windows 10
  • How to Activate a Window by Hovering Over it with the Mouse in Windows 10
  • How to Control Volume for Individual Programs in Windows 10
  • How to Schedule Restart in Windows 10
  • How to Change Microsoft Store Region in Windows 10
  • How to Hide the Clock From Windows 10 Taskbar
  • How to Enable Number Pad on Keyboard Windows 10
  • How to Turn Off Taskbar Thumbnail Previews in Windows 10
  • How Can I See All Drives in CMD
  • How to Show All Drives in Windows 10 File Explorer
  • Windows 10 Privacy Settings to Turn Off
  • How to Change Desktop Icons in Windows 10
  • How to Force a Program to Open in Full Screen in Windows 10
  • How to Delete Temporary Files in Windows 10
  • How to Enable Startup Sound in Windows 10
  • How to Reset All Default Apps in Windows 10
  • How to Change Default Action on Connecting a USB Device Windows 10
  • How to Remove Old Drivers From Windows 10
  • Where is the Drivers Folder in Windows 10
  • How to Reset Windows Update in Windows 10
  • How to Format USB Using CMD on Windows 10
  • How To Check WiFi Signal Strength on Windows 10 Using CMD
  • How to Remove “Show Desktop” Button on Windows 10
  • How to Enable Remote Desktop on Windows 10
  • How To Open File Explorer To “This PC”
  • How to Stop the Screen From Turning Off on Windows 10
  • How to Change Default Folder Name in Windows 10
  • How to Display Day of Week in Windows 10 Taskbar
  • How To Display Windows 10 Start Menu in Full Screen
  • How to Create a New Library in Windows 10
  • How to Reset the Settings App in Windows 10
  • How To Disable Startup Programs in Windows 10
  • How to Enable Registry Backup in Windows 10
  • How to Remove Password at Windows 10 Startup
  • How to Reset Windows 10 To Factory Settings
  • How To Enable or Disable Night Light in Windows 10
  • How to Add Clocks to Start Menu on Windows 10
  • How to Disable Bing Web Search Results in Windows 10 Start Menu
  • How to check Bluetooth battery level on Windows 10
  • How To Find Out If a Program is 32 or 64-bit Windows 10
  • How To Check Bios Firmware Version in Windows 10
  • How To Activate Windows 10
  • How to enter UEFI (BIOS) on Windows 10
  • How to Boot From a USB Drive on Windows 10
  • How to Reinstall Microsoft Store in Windows 10
  • How to Enable Ultimate Performance Mode in Windows 10
  • How to Stop Apps From Running in the Background on Windows 10
  • How to Change Another User’s Password in Windows 10
  • How to Delete Local User Account using PowerShell in Windows 10
  • How to Create Local User Account using PowerShell in Windows 10
  • How to Disable User Account Control (UAC) in Windows 10
  • How to Block Inappropriate Websites on Windows 10
  • How to Set Up a Child Account in Windows 10?
  • How to Download Windows 10 ISO file (32 bits and 64 bits)
  • How to Change the Default Save Location in Windows 10
  • How to Add Open Command Prompt Here to right-click Menu in Windows 10
  • Add Open PowerShell Window Here as Administrator in Windows 10
  • How to Mount ISO Images on Windows 10
  • How to Clear DNS Cache on Windows 10
  • How to Change DNS Server in Windows 10
  • How to Change Temp Folder Location in Windows 10
  • How to Reduce the Size of the Search Bar in Windows 10
  • How to Force Close a Program on Windows Without Task Manager
  • How to Force Close a Program with Task Manager
  • How to Speed Up Windows 10 Startup
  • How to Enable Sandbox in Windows 10
  • How to Disable Automatic Installation of Suggested Apps in Windows 10
  • No Sounds on Windows 10? Here’s How to Fix It
  • No Audio Output Device Is Installed in Windows 10 Fix
  • Where is the Location of Startup Folder in Windows 10?
  • How to Create a Windows 10 Bootable USB
  • How To Run Computer Performance Test in Windows 10
  • How To Tell If Your Computer Is 32 Or 64-bit Windows 10
  • How to Remove Recycle Bin From Desktop on Windows 10
  • How to Show My Computer, Recycle Bin Icon on Windows 10
  • How To Enable Screen Saver In Windows 10
  • How to Enable or Disable Updates For Other Microsoft Products on Windows 10
  • How to Disable Windows 10 Startup Delay
  • How To Open Emoji Keyboard on Windows 10
  • How to Turn On File and Printer Sharing in Windows 10
  • How To Optimize Windows 10 For Gaming
  • How to Add Shortcuts to the “Send to” Menu in Windows 10
  • How to Change the Screen Refresh Rate of Your Monitor in Windows 10
  • How to Make a Program Run on Startup in Windows 10
  • How to Turn Off SmartScreen in Windows 10
  • How to Disable Telemetry in Windows 10
  • How to Disable Windows 10 Tracking
  • How to Disable Windows 10 Data Collection
  • How to Free Up Disk Space in Windows 10
  • Fast Way to Delete a Large Folder in Windows 10
  • How to Create a Printer Shortcut on Desktop Windows 10
  • How to Change Audio Output Device Per Application on Windows 10
  • How to Format a Hard Drive or SSD in Windows 10
  • How to Switch Between Windows in Windows 10 using Keyboard
  • How to Download and Install Windows Media Player for Windows 10
  • How to Create a Shortcut on Desktop Windows 10
  • How to Block reopening of Programs on startup Windows 10
  • How To Limit Windows Update Bandwidth in Windows 10
  • How to remove the 3D Objects folder from This PC in Windows 10
  • How to Remove Old User Account Pictures in Windows 10
  • How to Delete the Hibernation File hiberfil.sys
  • How to Show Seconds in System Clock in Windows 10
  • How to Open Files and Folders with Single Click in Windows 10
  • How to Reset Your Microsoft Account Password for Windows 10
  • How to Fix Corrupted Files in Windows 10
  • How To Export And Import Start Menu Layout In Windows 10
  • How to Stop Automatic Restart After Updating Windows 10
  • How to Remove Ads From the Start Menu in Windows 10
  • How to Create a Homegroup Network in Windows 10
  • How to Disable ads in File Explorer in Windows 10
  • How To Fix gpedit.msc Group Policy Editor Missing in Windows 10
  • How to Change the Network Connection Priority in Windows 10
  • How to Watch Videos While Working on Other Tasks on Windows 10 Computer
  • How to Create a System Repair Disk in Windows 10
  • How to Customize the Taskbar in Windows 10
  • How to Change Taskbar Icons in Windows 10
  • How to Show the Control Panel in File Explorer on Windows 10
  • How to Uninstall Updates in Windows 10

How to reset all Local Group Policy on Windows 10

  • How To Turn Windows 10 Computer Into a Wi-Fi Hotspot
  • How to Reset Network Settings in Windows 10 Using CMD
  • How to Disable the Game Bar in Windows 10
  • How to Clear Windows 10 Update Cache
  • How to Create an Invisible Folder without Any Name in Windows 10
  • How to Add Open With to Right-click Menu in Windows 10
  • How to Change Default Apps on Windows 10
  • How to Prevent Copying Files From USB to PC
  • How to Find Your WiFi Password on Windows 10
  • How to Hide Your Name and Email Address on Windows Login
  • How to Speed Up File Transfer in Windows 10
  • How to Remove Power or Shutdown Button from Lock Screen in Windows 10
  • How to Start Windows 10 in Safe Mode
  • How to Stop Lock Screen ads in Windows 10
  • How to Enable Guest Account in Windows 10 using CMD
  • How to Restore Windows 10 Image Backup From Hard Drive
  • How to Create a System Image in Windows 10
  • How to Disable Automatic Update on Windows 10
  • How to Stop Programs From Automatically Updating in Windows 10
  • How to Take a Screenshot on Windows 10
  • Windows 10: Start Menu And Taskbar Not Working
  • How to Rebuild a Broken Icon Cache in Windows 10
  • How to Turn Off Windows Security Notifications in Windows 10
  • How to Preview a File Without Opening it in Windows 10
  • How to Permanently Disable Windows Defender on Windows 10
  • How to Disable the Action Center in Windows 10
  • How To Reinstall Microsoft Edge In Windows 10
  • How to Uninstall Microsoft Edge in Windows 10
  • How to Change Start Menu and Taskbar Color in Windows 10
  • How to Get Windows 7 Start Menu on Windows 10 with Classic Shell
  • Why the Start Menu is Slow to Open in Windows 10
  • How to Change Login Screen Background on Windows 10
  • How to Restore Windows Photo Viewer in Windows 10
  • How to Fix Screen Flickering in Windows 10
  • How to Remove Windows 10’s Built-in Apps
  • How to Fix Black Screen on Windows 10
  • How to Remove Search Bar From Taskbar on Windows 10
  • How to Disable Windows 10 Peer-to-Peer Updates
  • How to Downgrade to Windows 7 From Windows 10
  • How to Fix Windows 10 Start Menu And Cortana Not Working
  • How to Backup and Restore Registry in Windows 10
  • How to Change the Default Installation Location on Windows Using Regedit
  • How to Force Restart Windows 10 with Keyboard
  • How to Remove Shortcut Arrow from Desktop Icons on Windows 10
  • How to Find Computer Specs on Windows 10
  • How To Move Your Libraries To Another Drive in Windows 10
  • How to Enable Numlock at Windows Startup
  • How to Change CMD Color in Windows 10
  • How To Increase Font Size In CMD
  • How To Assign Letter To Drive In CMD
  • How To Get MAC Address In CMD
  • How to Open File Explorer Using CMD on Windows 10
  • How To Run Batch File On Windows Startup
  • How To Run EXE From A Batch File
  • How To Run A Python Script From A Batch File
  • How to Run PowerShell Script From A Batch File
  • How to Run Multiple Batch Files From One Batch File
  • Batch File To Copy All Files From One Folder To Another
  • How To Compare Strings In Batch Files
  • How To Concatenate Variables In Windows Batch File
  • How To Clear A Variable In A Batch File
  • For Loop Counting From 1 To N in a Batch File
  • How to Run Batch File Automatically Every X Minutes
  • Batch File To Get and Set System Date
  • Batch File To Set Default Programs in Windows 10
  • Batch File To Get Computer Name
  • Batch File To Get Current Directory
  • Batch File To Get Input From User
  • Batch File To Get IP Address
  • Batch File To Get MAC Address
  • How to Add a Registry Key in a Batch File
  • Batch File To Create Local User Accounts
  • Batch File To Create a Text File
  • Batch File To Create a Folder
  • Batch File To Create Folders From a List
  • Batch File To Write Ping Results To a Text File
  • Batch File To Write Variable To a Text File
  • Batch File To Write To a Text File
  • Batch File To Read XML File

Batch File To Read CSV / XLS

  • Batch File To Read Text File Line By Line into A Variable
  • Batch File To List Folder Names
  • Batch File To List Folders and Subfolders
  • Batch File To List Filenames in a Specified Folder
  • Batch File to List All Files in a Folder and Subfolders
  • How to Check Internet Connection using Batch File
  • How to Check the Size of a File in a Windows Batch Script
  • How To Check Batch File Error
  • Batch File To Check If Folder Exists
  • How to Check If a Path is File or Directory using Batch
  • Batch File To Delete Folders Older Than N Days
  • Batch File To Delete All Files in Folder Older Than N Days
  • Batch File To Delete All Files In Folder
  • Batch File To Delete A File If Exists
  • Batch File To Check If Multiple Files Exist
  • Batch File To Check If File Exists
  • Batch File Commands List With Examples
  • 8 Batch File Commands You Should Know
  • How to Create a Batch File in Windows
  • How to Run Batch File in CMD
  • How to Run EXE File in CMD
  • How to Change the MAC Address on Windows 10
  • How to Create a Website Shortcut on Desktop In Windows 10
  • 29 Run Commands in Windows You Should Know
  • How to Ping IP Address in CMD
  • How to Get IP Address Using Ipconfig in CMD
  • How to Delete Folder Using CMD in Windows 10
  • CMD Commands List You Should Know
  • How to Change Lock Screen in Windows 10
  • How to Show My Computer Icon on Desktop in Windows 10
  • How to Change Compatibility Mode in Windows 10
  • How to Uninstall Internet Explorer in Windows 10
  • How to Add or Change Desktop Theme in Windows 10
  • How to Disable Transparency Effects in Windows 10
  • How to Delete and Uninstall Fonts in Windows 10
  • How to Install New Fonts in Windows 10
  • How to Disable Lock Screen on Windows 10 Using Registry
  • How to Customize Action Center in Windows 10
  • How to Disable Cortana in Windows 10 using Registry
  • Battery Icon Missing From Taskbar in Windows 10 [Solved]
  • How to Change Desktop Background in Windows 10
  • How to Increase Battery Life of Windows 10 Laptop
  • How to Turn off Notifications in Windows 10
  • How to Create Keyboard Shortcuts in Windows 10
  • How to Change Desktop Icon Size in Windows 10
  • How to Turn On Dark Mode on Opera
  • How to Turn On Dark Mode on Mozilla Firefox
  • How to Turn On Dark Mode on Google Chrome
  • How to Turn On Dark Mode on Microsoft Edge
  • How to Enable Dark Mode in Windows 10
  • How to Increase Mouse Sensitivity in Windows 10
  • How to Find Which Programs are Slowing Down Your Boot Time in Windows 10
  • How to Defrag the Hard Drive in Windows 10
  • How to Copy and Paste Into Command Prompt in Windows 10
  • How to Enable the On-Screen Keyboard in Windows 10
  • How to Check Laptop Battery Health in Windows 10
  • How to Use Offline Maps in Windows 10
  • How to Calibrate Your Monitor in Windows 10
  • How to Enable God Mode in Windows 10
  • How to Increase Processor Speed in Windows 10
  • How to Pin a Folder to Taskbar in Windows 10
  • How to Pin a Website to Taskbar in Windows 10
  • How to Switch Between Desktops in Windows 10
  • How to Make Windows 10 Boot Faster
  • How to Stop Windows 10 From Sleeping
  • How to Set an Alarm Clock on Windows 10
  • How to Go Directly to Desktop in Windows 10
  • How to Create a New Folder on Windows 10
  • How to Reduce Blue Light on Computer Screen on Windows 10
  • How to Turn on Speech Recognition in Windows 10
  • How to Sync My Settings in Windows 10
  • How to Change the Screen Resolution on Windows 10
  • How to Create a New User on Windows 10
  • How to Turn Off Tablet Mode in Windows 10
  • How to Uninstall a Program on Windows 10
  • How To Change Password In Windows 10
  • Top Keyboard Shortcuts in Windows 10
  • How to Speed Up Windows 10 Shutdown
  • How to Change Default Browser in Windows 10
  • How to Disable the Lock Screen in Windows 10
  • How to disable User Account Control in Windows 10
  • How to Hide File Extensions in Windows 10
  • How to Show Hidden Files and File Extensions in Windows 10
  • How to Create a Restore Point with System Protection Enabled in Windows 10
  • How to Delete Browsing History on Firefox in Windows 10
  • How to Delete Browsing History on Microsoft Edge in Windows 10
  • How to Delete Browsing History on Google Chrome in Windows 10

You May Also Like

How to reset all Local Group Policy on Windows 10

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

How to Configure Windows 10 IP Address with CMD?

' data-src=

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.

Configure IP Address with Command Prompt in Windows 10

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: 

  • Find your IP address in Windows 10.
  • View network interfaces card.
  • Change IP address on Windows 10.
  • Change DNS IP address with the command line.
  • 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:

  • Press Windows+R keys to open the Run .
  • Type “ cmd ” in the run and press enter.
  • 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

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 C hange  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.

  • Type “ Powershell ” in Windows 10 search box to run Windows Powershell.
  • 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

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

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.

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.

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.

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.

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.

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

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?

' data-src=

How to Restore Backup in Windows Server 2022

How to change DNS zone settings in Windows Server 2022?

How to Share Files Over Network (Share Permissions) on Windows 11

Deny Users Access to PC Settings and Control Panel using Group Policy

' data-src=

I am thankful to you for your articles.

' data-src=

i changed my ip address and need it back

' data-src=

You are the greatest! I have been banging my head trying to find information on how to do this. 2 days and the only information I changed was “connected” to “not connected”, thank you so much

Your email address will not be published.

Save my name, email, and website in this browser for the next time I comment.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

Welcome, Login to your account.

Recover your password.

A password will be e-mailed to you.

How to configure a static IP on Windows 10 or 11

Do you need to switch from a dynamic to a static IP address configuration on Windows 11 or 10? Here's how.

Windows 11 static IP

  • Windows 11 static IP
  • Windows 10 static IP

On Windows, the router's Dynamic Host Configuration Protocol (DHCP) server is (usually) responsible for assigning a dynamic Transmission Control Protocol/Internet Protocol (TCP/IP) configuration to every device in the network, including to your computer running Windows 11 or Windows 10.

Although a dynamic IP address is the recommended configuration for most situations, you may need to change to a static IP address if you're thinking about setting up a printer or file sharing, or you have to configure port forwarding on the router to your computer.

The reason is that a dynamic network configuration can change at any time after the lease from the DHCP expires and if the address changes, network resources you may have configured will stop working. Setting a static IP address will always stay the same on the computer, allowing a more reliable experience sharing resources in the network or forwarding ports.

Whatever the reason, on Windows 10 and 11, you have many ways to configure a static TCP/IP address, including using the Settings app and Command Prompt.

This guide will walk you through the different ways to configure a static network configuration on Windows 11 and 10.

How to set a static TCP/IP network configuration on Windows 11

On Windows 11, you can change your computer's dynamic IP configuration to static in at least two ways through the Settings app or commands.

Configure IP from Settings app

To assign a permanent TCP/IP configuration on Windows 11, use these steps:

  • Open  Settings .
  • Click on  Network & internet .
  • (Optional) Click on Advanced network settings .
  • Under the "More settings" section, click on Hardware and connection properties.
  • Note the current IPv4 ,  Subnet mask ,  Default Gateway , and  DNS server addresses to determine the new configuration, as it has to be in the same network scope.
  • Click the  Ethernet  or  Wi-Fi  page on the right side from the "Network & internet." page.
  • Quick note:  If you select the Wi-Fi page, you need to click on the connection properties to access the network settings.
  • Click on the  Edit  button for the "IP assignment" setting.
  • Select the  Manual  option from the drop-down menu.
  • Turn on the  IPv4  toggle switch.
  • Confirm the IP address for the computer – for example, 10.1.4.90.
  • Confirm the subnet mask for the configuration – for example, 255.255.255.0.
  • Confirm the default gateway address (usually your router's IP) – for example, 10.1.4.1.
  • Confirm the preferred DNS address – for example, 10.1.4.1.
  •   Quick note:  In a home network, you may also be able to use the router's IP address for the DNS configuration. You can also use third-party DNS services like Google Public DNS, Cloudflare, Cisco's OpenDNS, and others. 
  • (Optional) Select the  "On (automatic template)"  option for the "DNS over HTTPS" setting and leave the  "Fallback to plaintext"  option disabled unless you want to encrypted as well as unencrypted traffic or you're troubleshooting connectivity.
  • Quick note:  DNS over HTTPS (DoH) is a feature that encrypts the DNS queries over the HTTPS protocol to improve security and privacy on the internet. You only want to enable this feature if the DNS server supports this feature.
  • Confirm the alternate DNS address (if applicable).
  • (Optional) Select the  "On (automatic template)"  option for the "DNS over HTTPS" setting and leave the  "Fallback to plaintext"  option disabled.
  • Click the  Save  button.

Once you complete the steps, the computer will start using the static network configuration. If everything has been configured correctly, you should be able to open the web browser to access the internet.

If you entered an address (such as the DNS address) and then changed it, you probably won't be able to save the settings. If this is the case, cancel the configuration, start over, enter the correct configuration, and then try to save the settings.

Configure IP from Command Prompt

To set a static TCP/IP configuration on Windows 11, use these steps:

  • Open  Start .
  • Search for  Command Prompt , right-click the top result, and select the  Run as administrator  option.
  • Type the following command to see your current networking configuration and press  Enter : ipconfig /all
  • Confirm the name of the adapter and the networking configuration, including the IPv4 , Subnet mask , Default Gateway , and DNS Servers .
  • Type the following command to configure a static TCP/IP address and press  Enter :  netsh interface ip set address name= "ADAPTER-NAME" static IP-ADDRESS SUBNET-ADDRESS DEFAULT-GATEWAY-ADDRESS

In the above command, replace  ADAPTER-NAME  with the name of your network adapter. Change  IP-ADDRESS SUBNET-ADDRESS    DEFAULT-GATEWAY-ADDRESS  with the device IP address, subnet mask, and default gateway addresses you want. For example, this command sets the 10.1.4.90, 255.255.255.0, 10.1.4.1 configuration:  netsh interface ip set address name="Ethernet 10Gb" static 10.1.4.90 255.255.255.0 10.1.4.1

  • Type the following command to set a DNS server address and press  Enter :  netsh interface ip set dns name="ADAPTER-NAME" static DNS-ADDRESS  

In the command, change  ADAPTER-NAME  with your adapter's name and  DNS-ADDRESS  with the DNS server address of the network. For example, this command sets the local router as the DNS server:  netsh interface ip set dns name="Ethernet 10Gb" static 10.1.4.1

  • Type the following command to set an alternate DNS server address and press  Enter :  netsh interface ip add dns name="ADAPTER-NAME" DNS-ADDRESS index=2

In the command, change  ADAPTER-NAME  with the adapter's name and  DNS-ADDRESS  with an alternate DNS server address. For example, netsh interface ip add dns name="Ethernet 10Gb" 1.1.1.1 index=2

After you complete the steps, the commands will set a static network configuration on Windows 11.

How to set a static TCP/IP network configuration on Windows 10

On Windows 10, you can also use the Settings app and Command Prompt to set up a static IP network configuration.

To assign a permanent TCP/IP configuration on Windows 10, use these steps:

  • Click on  Ethernet  or  Wi-Fi .
  • Click on the active connection on the right side.
  • Click the  Edit  button for the "IP assignment" setting.
  • Select the  Manual  option.
  • Confirm the subnet prefix length (subnet mask) for the configuration – for example, 24 to specify the 255.255.255.0 subnet mask.
  • Quick tip:  It's important to use the number that represents the network instead of the subnet mask. Otherwise, the configuration won't save. If you don't know the subnet prefix length for your subnet mask, you can use any  online subnet calculator  to find out.

Once you complete the steps, Windows 10 will start using the static IP configuration. If you lose network connectivity, restart the computer to regain access to the local network and internet.

To change from dynamic to static IP address with commands on Windows 10, use these steps:

In the command, change  ADAPTER-NAME  with your adapter's name and  DNS-ADDRESS  with the DNS server address of the network. For example, this command sets the local router as the DNS server:  netsh interface ip set dns name=" Ethernet 10Gb" static 10.1.4.1

In the command, change  ADAPTER-NAME  with the adapter's name and  DNS-ADDRESS  with an alternate DNS server address. For example, netsh interface ip add dns name="Ethernet0" 1.1.1.1 index=2

After you complete the steps, the network configuration will switch from dynamic to static on Windows 10.

Get the Windows Central Newsletter

All the latest news, reviews, and guides for Windows and Xbox diehards.

Mauro Huculak

Mauro Huculak is technical writer for WindowsCentral.com. His primary focus is to write comprehensive how-tos to help users get the most out of Windows 10 and its many related technologies. He has an IT background with professional certifications from Microsoft, Cisco, and CompTIA, and he's a recognized member of the Microsoft MVP community.

  • 2 The possibilities are (almost) endless with this Verizon Fios deal that gets you a $300 gift card
  • 3 Windows Central Podcast #340: Windows 11 version 24H2 confirmed!
  • 4 TODAY ONLY: Grab the best PC gaming handheld at a HUGE discount and enjoy the Xbox Game Pass ecosystem anywhere
  • 5 The Sticky Notes app just got the biggest update since Microsoft shipped Windows 11, and no it has nothing to do with AI-powered features or Copilot this time

assign ip address command line windows

site logo

Change IP Address and DNS Servers using the Command Prompt

Just because it's more fun

Author avatar

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.

Change IP Address and DNS Servers using the Command Prompt image 1

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.

How To Change IP Address Using Command Prompt

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.

Change IP Address and DNS Servers using the Command Prompt image 2

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 .

Change IP Address and DNS Servers using the Command Prompt image 3

  • Next, type netsh interface ipv4 show config in the command prompt window, press Enter, and scroll down to the interface you want.

Change IP Address and DNS Servers using the Command Prompt image 4

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

Change IP Address and DNS Servers using the Command Prompt image 5

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.  

Change IP Address and DNS Servers using the Command Prompt image 6

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 .

Change IP Address and DNS Servers using the Command Prompt image 7

  • Type netsh and press Enter .

Change IP Address and DNS Servers using the Command Prompt image 8

  • Next, type interface ip show config and press Enter .

Change IP Address and DNS Servers using the Command Prompt image 9

  • 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

Change IP Address and DNS Servers using the Command Prompt image 10

  • 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.

Change IP Address and DNS Servers using the Command Prompt image 11

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

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.

' src=

Elsie is a technology writer and editor with a special focus on Windows, Android and iOS. She writes about software, electronics and other tech subjects, her ultimate goal being to help people out with useful solutions to their daily tech issues in a simple, straightforward and unbiased style. She has a BCom degree in Marketing and currently pursuing her Masters in Communications and New Media. Read Elsie's Full Bio

Read More Posts:

assign ip address command line windows

Itechtics

How to set static IP address and DNS Server using Command Line in Windows 10

Configure Static IP address and DNS Server using PowerShell in Windows 10

Repeatedly having to change your Static IP address when shifting from one network to another can be a pain in the neck. The process is lengthy on Windows 10 and a bit irritating. If you are the person who needs to switch between IP addresses, then this article is for you.

Here we shall show you how you can configure your system’s IP address directly through the command line interface on your Windows 10 platform. It is very less time consuming and can be done in a few steps.

Table of Contents

The IP address is a unique identifier of your machine that lets every other component on the network know where the packets need to be routed to. Since it is unique, it cannot conflict with another IP address on the same network.

Configure Static IP address and DNS Server using PowerShell in Windows 10

You can manage your IP address by both the Command Prompt and the PowerShell, which shall be discussed further in the article.

How to check Interface Index using PowerShell

The Interface Index is a unique number assigned to either a physical or virtual networking port. Each port is assigned a number that is used to address the respective port on the machine. For example, if there are 5 different networking adapters on a computer, each one would have its own Interface Index.

To check the associated Interface Index for each, run the following command in PowerShell with administrative privileges :

get index

In the example above, the “ifIndex” is identified as the Interface Index. Note that the ports are repeated as the first half represents IPv6, while the 2nd half represents IPv4 configuration. Nonetheless, the Interface Indexes of the same ports are the same.

Note down the associated Interface Indexes as they will be required when assigning static IPs through PowerShell.

How to set static IP address using Command Prompt

These commands are relatively easier with the Command Prompt when compared with PowerShell . You can change the IP address of your computer using this quick command.

Launch the Command Prompt with administrative privileges and then use the command below to assign the desired IP address configuration:

In the above command, you need to place the information according to your requirement. Replace NameOfPort with the alias name of the network adapter you wish to set the IP of. Also, replace [IP address] with the IP address of the port you wish to assign, replace [Subnet mask] with its subnet, and replace [Default gateway] with the gateway of the adapter.

Here is an example:

Since the name of my port is “Ethernet,” entering the command above would result in the following configuration:

ip set

How to set DNS address using Command Prompt

As you may have noticed above, we did not set up the DNS. This is because you need to enter a separate command to configure the DNS, which is as below:

This will set the first DNS entry as 8.8.8.8. Note that this will only occur if the port can communicate with the DNS. Else it will throw an exception.

The above command would result in something like this:

dns 1 set

To change the second DNS server, use the following command:

dns 2 set

Remember to change the port name, IP address, gateway, and subnet mask according to your requirement.

Each time you need to switch between your IPs and DNSs, use these commands, and it will automatically overwrite the previous entering.

How to set static IP address using PowerShell

Although the PowerShell command lines are more complex than those of the Command Prompt, they also offer more parameters to be addressed. However, we will try and keep it as plain and simple as possible.

Before we proceed further, you need to understand some terms to enter the correct parameters. Below are a few arguments and their descriptions used in PowerShell to set static IPs and DNS entries.

Now, modify the following command according to your needs, launch Windows PowerShell with administrative privileges and enter the command:

PS 1

Note that we determined the correct Interface Index using the command we had discussed earlier in the article. This is what the IP configuration of the port would look like after running the command above:

PS ip set

How to set DNS address using PowerShell

You can also use PowerShell to assign DNS addresses as well quickly. In the example below, we have assigned both the primary and the secondary DNS addresses to our port simultaneously.

PS set dns

You may repeatedly use these commands in PowerShell to overwrite new IP address, subnet mask, gateway and DNS entries of any network port you want on your PC.

Closing words

Now you do not need to worry about switching from one network to another. You can make the process even quicker by saving the respective IP configuration on your PC and copy-pasting it to the command line when required to switch.

If, however, you run into a problem associated with your computer network, you may use this guide to reset the TCP/IP stack .

Get Updates in Your Inbox

Sign up for the regular updates and be the first to know about the latest tech information

Email Address

  • How to Check Public IP Address Using Command Line In Windows 10/Windows 11
  • Check VPN Connection Status From Command Line In Windows
  • Download and Install Windows Media Center for Windows 10
  • 6 Ways To Open Run Command Box In Windows
  • Findstr: Find Specific String In Files With Windows Command (Grep Alternative)
  • How To Quickly Find Mac Address In Windows 10

assign ip address command line windows

Pradip Shah

I have been using netsh for more than 10 years now to switch between 2 ISP’s services. My only problem was the jokers at MS kept changing command line switches with every version of Windows. XP -> 7 -> 10. Why is something beyond me.

Forgot to mention that I religiously avoid using power shell & work only with “Take Command” from JPSoft.

Leave your comment (Cancel Reply)

Notify me of follow-up comments by email.

Notify me of new posts by email.

Microsoft Introduces Its Own AI Enabled Interpolation Super Resolution On Windows 11

Online Tech Tips logo

How to Assign a Static IP Address to a Windows 11/10 PC

Makes establishing a remote connection easier

Author avatar

Usually, your network router assigns a dynamic IP address to your devices, including your Windows 10 and 11 PCs. If you need a static IP address for your PC, you either need to configure your router or change a settings option on your computer.

The good thing is there are multiple ways to assign a static IP address to your Windows PC. Depending on what you feel comfortable with, you can choose a method and proceed with it to acquire a fixed IP address for your machine.

How to Assign a Static IP Address to a Windows 11/10 PC image

Why Use a Static IP Address?

There are many reasons you need a static IP address. It’s possible you use a remote connection to connect to your PC. In this case, having a permanent IP address makes establishing the remote connection easier.

Similarly, if you use your PC for network file sharing , a static IP address ensures the other devices on your network can connect to your PC without any reconfigurations.

Assign a Static IP to Your Windows 11/10 PC Using Your Router

One way to get a static IP for your PC is by configuring your router to allocate a specified IP address to your machine. Most routers offer this option but how you configure the router is different for each router model.

Generally, you’d follow the following steps to configure a static IP for your PC on your network router.

Find Your Network Adapter’s MAC Address

For your router to identify your PC and assign it a specific IP address, you need to enter your network adapter’s (which is in your PC) unique MAC address on your router’s settings page.

So, let’s first find your network adapter’s MAC address:

  • Open the Start menu, search for Command Prompt , and select Command Prompt in the search results.

Find Your Network Adapter’s MAC Address image

  • Type the following command in the Command Prompt window and press Enter :

ipconfig /all

Find Your Network Adapter’s MAC Address image 2

  • Command Prompt will display various values on your screen. Find your network adapter here and look for the Physical Address field’s value. That’s your adapter’s unique MAC address. Make a note of this address.

Find Your Network Adapter’s MAC Address image 3

Configure Your Router to Assign a Static IP to Your PC

You now need to access your router’s settings page. For most routers, you can do this by entering the 192.168.1.1 IP address in a web browser on your computer. If this doesn’t work for you, consult your router’s manual to find out how to access the settings page.

  • Launch a web browser on your computer, type the following IP address, and press Enter .

192.168.1.1

  • You’ll see your router’s login page. Enter your router’s username and password and continue. For most routers, you can use admin in both username and password fields.
  • Select Network Settings at the top of your router’s settings page.

Configure Your Router to Assign a Static IP to Your PC image

  • Choose DHCP Client & Address Reservation from the sidebar on the left.
  • Enter the static IP address you’d like to assign to your PC in the IP Address field on the right.

Configure Your Router to Assign a Static IP to Your PC image 2

  • Type your network adapter’s unique MAC address in the MAC Address field. Then, select Add and then select OK at the bottom of the page.
  • Restart your router.

When your Windows 11 or 10 PC connects to your router, your router will assign the specified IP address to your PC. This will happen each time you connect your PC to your router.

Assign a Static IP to Your Windows 10 PC

If you don’t wish to configure your router’s settings, the other way to assign a static IP address to your Windows 10 PC is by using the Windows Settings app. You can configure your IP settings in this app to ensure your PC always gets a unique static IP.

However, there’s a slight issue with this method. If your router has already assigned the IP address that you want for your PC to another device, you’ll experience issues connecting your PC to your router .

To get around this, try to use an IP address far beyond the general IP addresses that your router assigns. For example, if your router usually gives IP addresses up to, say, 192.168.1.10, then use 192.168.1.20 as the static IP for your PC.

To proceed with this method:

  • Open the Settings app on your PC by pressing Windows + I keys at the same time.
  • Select Network & Internet on the Settings window.

Assign a Static IP to Your Windows 10 PC image

  • Scroll down the Status page that opens and choose Change adapter options .

Assign a Static IP to Your Windows 10 PC image 2

  • You’ll see a list of your network adapters. Right-click the adapter that you use with your network and select Properties from the menu.

Assign a Static IP to Your Windows 10 PC image 3

  • Choose Internet Protocol Version 4 (TCP/IPv4) in the list and select Properties .

Assign a Static IP to Your Windows 10 PC image 4

  • Enable the Use the following IP address option on the following window.

Assign a Static IP to Your Windows 10 PC image 5

  • Select the IP address field and type the static IP address you’d like to assign to your PC.
  • Fill in the Subnet mask field, which is usually 255.255.255.0 . Type your router’s gateway, which is usually 192.168.1.1 , in the Default gateway field.
  • For DNS servers, you can use Google’s Public DNS. To use these, select the Preferred DNS server field and type 8.8.8.8 . Select the Alternate DNS server field and type 8.8.4.4 . Then, choose OK .
  • Close the Properties window by selecting Close .

Your Windows 10 PC will disconnect from your router, and it will then automatically reconnect. After this reconnection, your PC should now have the specified static IP address allocated to it.

Assign a Static IP to Your Windows 11 PC

Like with Windows 10, you can use the Windows Settings app to assign a static IP address to your Windows 11 PC.

  • Press Windows + I keys simultaneously to open the Settings app.
  • Select Network & internet from the sidebar on the left in Settings.

Assign a Static IP to Your Windows 11 PC image

  • Select Advanced network settings at the bottom of the Network & internet page.

Assign a Static IP to Your Windows 11 PC image 2

  • Find your network adapter in the list and select the adapter. Then, select View additional properties .

Assign a Static IP to Your Windows 11 PC image 3

  • Select Edit next to IP assignment .

Assign a Static IP to Your Windows 11 PC image 4

  • Choose Manual from the Edit IP settings dropdown menu. Then, toggle on the IPv4 option.

Assign a Static IP to Your Windows 11 PC image 5

  • Select the IP address field and type the static IP address to assign to your PC.

Assign a Static IP to Your Windows 11 PC image 6

  • Select the Subnet mask field and enter 255.255.255.0 . Enter your router’s IP address, which is usually 192.168.1.1 , in the Default gateway field.
  • Enter 8.8.8.8 in the Preferred DNS field. Enter 8.8.4.4 in the Alternate DNS field.
  • Select Save at the bottom.

And your Windows 11 PC now has a static IP address assigned to it. In the future, your PC will continue to acquire this static IP address from your router, provided there are no IP conflict issues with your router .

' src=

Mahesh has been obsessed with technology since he got his first gadget a decade or so ago. Over the last few years, he's written a number of tech articles on various online publications including but not limited to MakeTechEasier and Android AppStorm. Read Mahesh's Full Bio

Read More Posts:

assign ip address command line windows

Leave a Reply

Your email address will not be published. Required fields are marked *

How to Set a Static IP Address on a Windows PC

You can learn how to set up a static IP address on your computer. Here's how.

While most of the internet runs on dynamic addresses these days, static addresses are sometimes helpful to use as well. Whether you need to run a server of your own, set up external devices or services, or are just simply looking to explore, before you get your hands dirty, you need to know your way around and be super careful while setting up an IP address.

Moreover, there's more than one way to go about this. So, one by one, let's look at all the ways you can easily set up a static IP address on your Windows.

Static IP Addresses: The Whys and Hows

An IP address of a computer that stays the same over time is known as a Static IP address . This is in contrast to a dynamic IP Address, which is an address that can tweak over time.

Today, most devices use a dynamic IP address because of their ease of use and management. However, in rare cases, Static IP addresses can become handy. Some of those cases include:

  • When you have external devices that you can only connect to your network through your IP address.
  • When you connect to other networks through a VPN.
  • Static IP addresses can make hosting a server somewhat easier.

Because of a slew of such benefits, using a Static IP address can make your life super easy in some situations. So, now let's look at the different methods you can use to set up a static IP address for yourself.

How to Set a Static IP Address on Windows 11

Like most things on Windows, you have multiple ways to do this. Let's look at the most straightforward method first, which is using Windows Settings.

Here's how you can set a static IP Address using the Windows settings:

  • Head to the Start menu search bar, type in 'settings,' and select the best match. Alternatively, press the Windows Key + I to launch the Settings menu.
  • Then head to Network & internet settings .
  • Look for the Properties button. It's right next to your connection settings.
  • Scroll down and look for the IP assignment section. Then click on Edit .
  • In the new Edit IP settings dialog box, click on the scroll-down menu and select Manual .
  • Toggle on the switch for the IPv4 button.
  • Fill in all the network details here, including the IP address , Subnet mask , Gateway , and then click on Save .

ip settings

Follow the above steps meticulously, and your Windows 11 will have a new static IP address from here on.

How to Set Up a Static IP Address on Windows 10

The basics of setting up an IP Address in Windows 10 are similar. Even though the implementation of steps might differ here and there, you have to follow a pattern that's pretty much the same. Here's how:

  • Open the Windows 10 Settings.
  • Click on Network & Internet .
  • Depending on how you are connected to the Internet, select Wi-Fi or Ethernet .
  • Select the current network connection.

settings

  • Toggle on the IPv4 switch.
  • Set up the static IP address here and fill in other relevant information, such as the Preferred DNS , Default Gateway , etc.
  • Click on Save .

After you are done, you will have a new static IP address on your PC from here on.

How to Set Up a Static IP With Command Prompt

The above method, using the Settings GUI, is only one of the ways to tweak your IP address settings. For those of you who tilt more towards a command line rather than a simple click-and-play GUI, luckily, alternatives exist. For instance, you can also use the Command prompt, and set up the address with just a few commands.

To change up your IP address through your Command Prompt, follow the below steps:

  • Head to the Start menu search bar, type in 'cmd,' and launch the cmd as administrator.
  • Type in the following command in the cmd and hit Enter : ipconfig /all
  • Subnet mask
  • Default Gateway
  • DNS Servers
  • Type in the following command to assign static IP address on your Windows and hit Enter : netsh interface ip set address name= "Ethernet1" static 10.1.4.220 255.255.255.0 10.1.4.1 In the above command, replace Ethernet1 with the name of your adapter, and change 10.1.4.220 255.255.255.0 10.1.4.1 with the device IP address, subnet mask, and default gateway address corresponding to your network configuration
  • Now type the following command to set up a DNS server address and hit Enter : netsh interface ip set dns name= "Ethernet1" static 10.1.4.1

cmd

That's it. Your new static IP address will be set up from here.

How to Set Up a Static IP Address With PowerShell

PowerShell is another tool primarily handy for power users, designed to give them more control and management capabilities through task automation. If any of the above methods fail, you can also use PowerShell to set up the Static IP Address. Here’s how you can get started:

  • Head to the Start menu search bar, type in ‘powershell,’ and run it as administrator.
  • Type the following command to view your current network configuration and press Enter : Get-NetIPConfiguration
  • InterfaceIndex
  • IPv4Address
  • IPv4DefaultGateway
  • Type in the following command to set up a static IP address and hit Enter : New-NetIPAddress -InterfaceIndex 10 -IPAddress 10.1.4.119 -PrefixLength 24 -DefaultGateway 10.1.4.1
  • Here, replace all values of information. Replace the InterfaceIndex number (10) with the number assigned to your adapter. Similarly, replace the above IPAddress with a static IP address that you want to set.
  • Finally, type in the following command to assign the DNS server address and hit Enter : Set-DnsClientServerAddress -InterfaceIndex 10 -ServerAddresses 10.1.4.1

Again, replace the InterfaceIndex number (10) with your network’s corresponding number. Also, replace the ServerAddress with the DNS IP address.

You will have a new static IP address as soon as you finish all the above steps.

Setting up a Static IP Address on a Windows PC

Setting up your static IP address doesn't have to be complicated. If you follow the above methods we have laid out above, you should be done without any significant difficulties.

And while static IP address has their uses, dynamic addresses are undoubtedly necessary. So, before you make an important switch, ensure you understand their significant differences well.

Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

How to change IP address using script on Windows?

I need fixed IP in three wireless networks I log in frequently.

It is a pain to set those IP and gateway everytime I change networks.

I am willing to write a script to change my IP and gateway between those 3 fixed IPs and a choice to make it get IP automatically (when I´m in another network).

A plus feature to my script would be if it could discover the wireless network I am logged in and decide the IP automatically.

Is it even possible?

Diogo's user avatar

  • possible duplicate of How can I switch between multiple sets of network configurations on Windows XP? –  Breakthrough Nov 24, 2011 at 12:43

5 Answers 5

ipconfig /renew to get a new IP address or default gateway The NETSH command does this. check this .

See this example for setting DNS address manually via netsh command:

configure your NIC to dynamically obtain its DNS settings ( * Obtain DNS server address automatically ):

and to set the * Obtain an IP address automatically setting:

More info: read this Configure TCP/IP from the Command Prompt and How to change IP address from command prompt .

This is assuming 3 things.

1) The network adapter you're trying to change the IP for is "local area connection". It could also be "local area connection 2" or "wireless network connection". Look in your control panel for the correct name.

2) The IP you want to set is 192.168.0.101, change this to whatever IP to want to use.

3) The default gateway and dns are the same IP. If you are using some kind of router they usually are. Change this to match your network config found with the command ipconfig /all

Here is example of batch file that I have created for your problem solutions: just change the command after the con1: type labels

How to create batch file: paste this code in notepad and save it as "test.bat"

Note: Change your connection names "local area connection" to your "wireless connection" name

Hope this help you.. for more reference check this Set Your IP Address Via Batch File

David d C e Freitas's user avatar

  • I get Adapter is not enabled for DHCP when trying ipconfig /renew "Wireless Network Connection" –  Hrvoje T Mar 28, 2018 at 8:10
  • I used this netsh interface ip set address "Wireless Network Connection" dhcp and this for auto dns netsh interface ip set dns "Wireless Network Connection" dhcp –  Hrvoje T Mar 28, 2018 at 8:26
  • 1 To set dns manualy, I had to use netsh interface ipv4 add dnsserver "Wireless Network Connection" address=8.8.8.8 index=1 from here stackoverflow.com/questions/18620173/… –  Hrvoje T Mar 28, 2018 at 9:10

You can make a .bat script file that contains the configuration commands based on "netsh" command, for example :

This changes the IP address and Default Gateway: "netsh int ip set address "local area connection" static {192.168.0.101} 255.255.255.0 {192.168.0.254} 1" This changes DNS: "netsh int ip set dns "local area connection" static {192.168.0.254} primary"

Community's user avatar

I know this is very old thread but still it can be useful to many like me.

As per the op asked for WiFi, I have created a batch script for Wi-Fi. It will fetch current Wi-Fi connected and based on that set Static IP or DHCP.

Here is the script -

You should save this a batch file and run that batch file as %% in for command will not work in command prompt.

TIP: You can also add this in Task Scheduler with Trigger as below and Action with above batch path

In Windows 10 & 11, you can set the IP configuration as well as DHCP / Static settings for each Saved WiFi network also.

Sachin's user avatar

Run this on CMD as admin:

back to dhcp:

"Local Area Connection" can be different in your case

Toto's user avatar

in this cmd how to set dns netsh interface ip set address name = "Local Area Connection" static 192.168.1.1 255.255.255.0

vijaiprabu's user avatar

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center . –  Community Bot Nov 23, 2021 at 10:08

You must log in to answer this question.

Not the answer you're looking for browse other questions tagged windows-7 ..

  • The Overflow Blog
  • Would you trust an AI bot to find the fix for vulnerabilities in your code?
  • Who owns this tool? You need a software component catalog
  • Featured on Meta
  • Site maintenance - Saturday, February 24th, 2024, 14:00 - 22:00 UTC (9 AM - 5...
  • Upcoming privacy updates: removal of the Activity data section and Google...

Hot Network Questions

  • Toddler keeps lifting mattress up and putting his legs into the mattress rack - how to prevent?
  • Make a single object transparent in viewport shading
  • Why does my opto behave like this?
  • A co--ection of images
  • Strings without twin letters
  • How to not fear the supernatural?
  • Reduce the line length of the strike through within the \neq sign
  • Manager asked for home address without giving a reason. Should I have provided it?
  • Which Potentials lead to Kepler's second Law?
  • Is it fine to email several people regarding internship programs and potentially have to turn down one?
  • Why is the Map of Earth on the Ringworld?
  • Industrial Geothermal smelting power
  • What does cleanliness have to do with vines in John 15?
  • The Devil's Shell Game
  • Is there a no-go theorem for or an upper bound on code threshold?
  • XTR Double chain set to single?
  • Maze-Jigsaw Fusion
  • British Duke is murdered in elevator. Title is inherited by one of a pair of identical twins, both of whom are suspects
  • Why is the SSH server asking for a password even if I specify a valid key?
  • Median of a set with even number of elements
  • My PhD supervisor gave up on me
  • How is this "bread" puffing up without yeast or baking soda?
  • How to prevent inrush current caused by LED bulbs from tripping a breaker?
  • What are the differences between a synagogue and a temple?

assign ip address command line windows

How to change from static to dynamic IP address on Windows 10

Are you using a static IP address? Here are four ways to switch to a dynamic configuration on Windows 10.

Avatar for Mauro Huculak

On Windows 10, you can configure a network adapter to use a static IP address manually, or you can use an automatically assigned configuration using the local Dynamic Host Configuration Protocol (DHCP) server.

Although using a static IP address is recommended for devices that provide services to network users, as its configuration never changes, it may come a time when you may no longer need this configuration, and a dynamically assigned network configuration will be more suited.

If you use a static IP address and need to switch to a dynamic configuration, it’s possible to perform this task in several ways, including using the Settings app, Control Panel, Command Prompt, and even PowerShell.

In this guide , you’ll learn the steps to remove a static IP address configuration to obtain a dynamic configuration from the DHCP server on Windows 10 .

Change to dynamic IP address (DHCP) from Settings

Change to dynamic ip address (dhcp) from command prompt, change to dynamic ip address (dhcp) from powershell, change to dynamic ip address (dhcp) from control panel.

To enable DHCP to obtain a TCP/IP configuration automatically on Windows 10, use these steps:

Open Settings on Windows 10.

Click on Network & Internet .

Click on Ethernet or Wi-Fi .

Click the network connection.

Under the “IP settings” section, click the Edit button.

Edit IP settings on Windows 10

Use the Edit IP settings drop-down menu and select the Automatic (DHCP) option.

Enable automatic (DHCP) IP address using Settings app

Click the Save button.

Once you complete the steps, the networking stack configuration will reset, and your device will request an IP address from the DHCP server (usually your router).

To switch from a static TCP/IP configuration to a dynamically assigned configuration using DHCP with Command Prompt, use these steps:

Open Start .

Search for Command Prompt , right-click the top result, and select the Run as administrator option.

Type the following command to note the name of the network adapter and press Enter

Network adapter name using Command Prompt

Type the following command to configure the network adapter to obtain its TCP/IP configuration using DHCP and press Enter :

In the command, make sure to change “Ethernet1” for the adapter’s name that you want to configure.

Enable DHCP on Windows 10 using Command Prompt

After completing the steps, the network adapter will stop using a static IP address, and it’ll obtain a configuration automatically from the DHCP server.

To remove a static IP and DNS addresses to use a dynamic configuration using PowerShell, use these steps:

Search for PowerShell , right-click the top result, and select the Run as administrator option.

Type the following command to note the “InterfaceIndex” number for the network adapter and press Enter :

Network interface information using PowerShell

Type the following command to enable the network adapter to obtain its TCP/IP configuration using DHCP and press Enter :

In the command, make sure to change “Ethernet0” for the adapter’s name that you want to configure.

Type the following command to enable the network adapter to obtain its DNS configuration using DHCP and press Enter :

In the command, change “3” for the InterfaceIndex for the adapter to configure.

Enable DHCP for dynamic IP assignment using PowerShell

Once you complete the steps, the IP and DNS addresses will be reset from the adapter, and your computer will receive a new dynamic configuration from DHCP.

To configure a network adapter to use a dynamic IP address using Control Panel, use these steps:

Open Control Panel .

Click on Network and Internet .

Click on Network and Sharing Center .

On the left pane, click the “Change adapter settings” option.

Network and Sharing Center in Control Panel

Right-click the network adapter and select the  Properties option.

Select the “Internet Protocol Version 4 (TCP/IPv4)” option.

Click the Properties button.

Ethernet1 Properties on Windows 10

Select the “Obtain an IP address automatically” option.

Select the “Obtain the following DNS server address automatically” option.

Enable dynamic IP address (DHCP) using Control Panel

Click the OK button.

After completing the steps, the statically assigned TCP/IP configuration will no longer be available, and the computer will automatically request a dynamic network configuration from the network.

Avatar for Mauro Huculak

Mauro Huculak is a Windows expert and the Editor-in-Chief who started Pureinfotech in 2010 as an independent online publication. He is also been a Windows Central contributor for nearly a decade. Mauro has over 12 years of experience writing comprehensive guides and creating professional videos about Windows, software, and related technologies, including Android and Linux. Before becoming a technology writer, he was an IT administrator for seven years. In total, Mauro has over 20 years of combined experience in technology. Throughout his career, he achieved different professional certifications from Microsoft (MSCA), Cisco (CCNP), VMware (VCP), and CompTIA (A+ and Network+), and he has been recognized as a Microsoft MVP for many years. You can follow him on X (Twitter) , YouTube , LinkedIn and About.me .

  • Windows Subsystem for Android gets January 2023 update
  • How to access Advanced startup (WinRE) on Windows 10

We hate spam as much as you! Unsubscribe any time Powered by follow.it ( Privacy ), our Privacy .

How to Assign Static IP Address to Your Devices

IP address

By default, your router assigns dynamic IP Address to every device that connects to it. This is called DHCP (short for Dynamic Host Control Protocol). But sometimes, we need our devices to have the same IP address (i.e. Static IP) every time it connects to the network. Reason being,

  • Access your computer from the Internet.
  • Share data between two devices on the same network.
  • Quickly access your Network Printer or NAS.
  • Use your computer as a media server.
  • Or your work WiFi requires you to use Static IP address.

IP address

What IP address should you choose?

If two devices on the network have the same IP address, then there will be conflicts. The Internet won’t work on one of them or both, depending on your router. So, it’s important to assign a unique IP address to your computer. There are a couple of ways to pick an unused IP address.

For instance– first  find your device’s IP address , say it’s  192.168.1.7 ; then keep the first three values (i.e. 192.168.1) as it’s and replace the last digit with some far number like  192.168.1.222 . Though make sure the last digit should be between a  0-255  range.

Assigning Static IP address to most devices is easy, just go to its network settings, look for DHCP option and turn it OFF. Once you do that, you’ll see a text area to enter Static IP address. Enter the new IP address there, save changes and that’s it.

So let’s see how to Assign Static IP address to various Operating Systems

1. Assign IP Address on Windows 10/8/7

You can do this quickly through the command line. You will need to first find your subnet mask, default gateway, and network adapter name. In my case, I’m on a Wi-Fi network, so the adapter name is Wi-Fi. To find yours just type the following command.

Once you get the output, find for the Network Adapter which has IP listed under it. The adapter name is a one-word name suffixed to the end of the Network Title. You will also need the Subnet mask and the Default Gateway Address.

adapter_name_command_line

Once you have the adapter name, Subnet Mask and Default Gateway, run the following command.

Wherein, Wi-Fi should be replaced by your adapter name and the IP, subnet mask and gateway address according to your configuration.

staticIP_cmd

This will change your IP address from DHCP to manual with the static IP address you have specified.

In case you find it too confusing, you are not alone. You can do the same via GUI which is much more intuitive. You’ll need the  Subnet Mask and Default Gateway Address . You can refer to the above step on how to find these details. Once you have noted down the address, click on  Start  Menu and type in  Network and Sharing Center.  Click once you see the Network and Sharing Center Icon.

Network_Sharing_Center_Start_Menu

Alternatively, if you are in Windows 10 then you can right-click on the Start menu and click on “ Network Connections “.

RightClickOnStartMenu_Windows10

A new window will open, click on  Change Adapter Options.

Change_Adapter_Options

Right Click on your Current Network Adapter ( like WiFi)  and choose  Properties.

Right_Click_NetworkAdapter

When the new window pops up, select  Internet Protocol Version 4(TCP/IPv4)   and click on  Properties.

IPv4_Properties

Once you get the pop-up window, select “ Enter the IP address you want ” and fil the IP Address, For Subnet Mask , and Default Gateway Address enter the values that you have noted down previously. Next, click on OK to save changes.

Manual_IP_Settings

To switch to dynamic IP, click on Obtain the IP address automatically. Once this is enabled, your system will start picking an IP address dynamically from the router.

2. How to setup static IP on Ubuntu

On Ubuntu, you can set a static IP Address via the terminal or GUI. Firstly, let’s start with the command line. Right-click anywhere on the desktop to open the terminal.

OpenTerminal_Ubuntu

Once the terminal window opens, we need to run a command. We need the subnet mask and network adapter name in order to set a static IP and to get that, run the following command on the terminal.

assign ip address command line windows

Once you have the subnet mask noted down, in my case, it’s 255.255.255.0, we can proceed further.

It is pretty simple and straight forward. We need to open the Network Adapter settings. To do that, click on the Network Icon at the top right corner of the desktop.

GUI_Network

Now, navigate on the active network and click on the expand button for more options. Click on Wired Settings to open the Network menu.

Wired_Settings_GUI

Once you get the Wired Settings dialogue, make sure you are on the Network page. Click on the Settings icon beside the active network to open the adapter properties.

assign ip address command line windows

When you get the pop-up, navigate to the IPv4 tab to change the IP settings.

IPv4_Tab

On the IPv4 tab, select the radio button which says “ Manual “. Some text fields will appear, you need to enter the IP address, Netmask and Gateway accordingly. Once it is validated, you can click on the Apply button to register the changes.

static_IP_GUI_Ubunty

Again you need to restart the network for the changes to take effect. You can do it manually via command line or just switch off and switch on the Network adapter. Once done, run ifconfig on the terminal to check the IP address. It should be the same IP address which you have specified earlier.

changed_IP_Config

3. How to setup static IP on Mac

If you are on macOS, setting static IP is quite similar to that of Ubuntu. But, here you don’t need the subnet mask or Default Gateway Address. Right click on the apple icon at the top left corner of the desktop. Click on  System Preferences  from the dropdown list.

mac_systemPreferences

Once the System Preferences dialogue box displays, navigate to Network and click on it to open the Network Settings

Network_Symbol

Alternatively, you can also hit Cmd+Space to trigger the Spotlight search. Type “ Network ” in the search bar and click on the icon once it appears. This will directly navigate you to the Network Settings.

network_on_spotlight

From the pop-up window, select an active network interface. For example, I am connected to a WiFi network so my active network is  Wi-Fi. Make sure you are on the active network tab and then click on  Advanced .

Network_Settings_menu

A new window will open the configuration settings for that adapter. Move over to the IP settings by clicking on the TCP/IP tab .

TCP_IP_tab

From the Configure IPv4 menu, choose Using DHCP with manual address.  Enter a static IP address in the IPv4 Address and leave the Subnet Mask and Router field as default. Click Ok to save the changes.

change_tcp_ip_Settings

Now when you do an ifconfig, the system should be using the static IP you have defined in the previous times. If the IP’s have not changed, try restarting the Wi-Fi and it should fix it.

To switch back to dynamic IP, move back to “ Using DHCP ” from the Configure IPv4 menu.

4. How to setup static IP on Android

Settings_menu_Android

The network which you are connected to should be on top of the list. Tap on the settings icon beside the Wi-Fi network name.

Wifi_connected_network

Once the pop-up opens, you will see IP settings at the bottom of the menu. The default option is “DHCP”. Tap on it to change the IP configuration.

IP_Settings_Android

Select “ Static ” from the presented drop-down menu. Enter the desired IP address and leave the other options as default. Make sure that other devices are not using the same IP. You can see the IP address of the other devices in your network by using a small utility called Fing . For a detailed process, check our article on how to find the IP Address of any Device on your network . Once you have entered the IP, click on Save to register the change. Now, your Android phone should start using the desired IP Address.

Manual_IP_Android

In almost all the Android version, you get the option to set static IP Address. For some rare older Android versions, you can use a third-party app like  WiFi Static . It’s free and it doesn’t require ROOT.

To switch back to dynamic IP, repeat the same procedure and select “DHCP” from the IP settings instead.

5. How to setup static IP on iPhone and iPad

If you are using an iPhone or iPad, then you can set static IP Address natively. You would need the Subnet Mask of your network. This can be obtained from the Wi-Fi settings and we would see to it in the further steps. To get started, click on the Settings icon in the dock to get to the Settings menu.

ios_Settings

Now on the Settings menu page, tap on Wi-Fi to get to the Wi-Fi settings.

Settings_page_wifi_ios

On the Wi-Fi page, you should see your connected Wi-Fi network at the top. Click on the “i” button beside it. This will open the Wi-Fi configuration window.

i_button_ios_wifi

Once the Wi-Fi settings page appears, you will see an option called “ Configure IP “. By Default, this would be set to automatic. Just below this option, you will see “ Subnet Mask “, note it down as we will need it in the further steps. In order to set static IP, we need to change Configure IP it to Manual. Tap on it and it will open the IPv4 settings page.

Configure_ip_page

There should be 3 options available on the “Configure IPv4” page. Select “ Manual ” from it. As soon as Manual IP is enabled, you will get extra text fields at the bottom to enter the IP Address, Subnet Mask, Router. We need to fill in the IP Address of our choice and Subnet Mask which we noted down in the previous step. Now, after you fill both the fields, the save button at the top right corner will be enabled. Click on it to save the static IP configuration.

IPv4_Configuration_Menu

Now, when you return to the Wi-Fi settings page, you will see your device is using the Static IP address. This should be the same IP address we have set in the IP configuration menu.

ipaddr_ios

This static IP address will be applicable only to that particular Wi-Fi network. In case, you connect to some other Wi-Fi network the IP will change accordingly.

6. How to setup static IP to any Device from Router

Other network devices like your  Wireless Printer, PS4, NAS, IP Camera, Raspberry Pi , etc. do not have an Interface. Hence, in order to configure the network, either you have to connect remotely or use the router. If you have access to the router, setting Static IP for network devices is the easiest and convenient way. I would recommend this method over any other.

So, to assign a Static IP Address to any network device, you need to login to the web portal of the router. The web portal address, username, and password are mostly printed behind the router. In case you don’t have physical access to the router, the web portal URL is mostly the PC’s gateway address. To find that, open command prompt and type the following command.

Once you have the web portal loaded, log in with the credentials. Now every router has a different web UI, but the overall structure is the same. Basically,  you will have to link the IP Address to the Mac Address and Hostname of the device. So, we need to find the MAC address & Hostname of the network device. To do that, look for DHCP client list which should look something like the following screenshot.

MAC_address_Router

You can get your MAC Address & Hostname under DHCP Client list. Once, you have the MAC address & Hostname noted down, we can proceed further. On most of the routers, you will have the option to set a Static IP under the section  IP Mac binding or DHCP Static IP  option. In case you are on a custom ROM like dd-wrt, head over to Services tab and you will have DHCP Server . Under DHCP Server, add an entry for Static Leases by clicking on the Add button.

Static_leases_router

Clicking on the Add button will create a new row. You have to enter the MAC Address, Hostname, desired Static IP and Lease time . Lease time is a unit in minutes after which your IP will be renewed. Since we are adding only 1 entry for the particular host the IP will be the same even after the renewal. Once, done click on Save changes .

staticIPSetting_Router

Once you have configured successfully on the router, just restart the Wi-Fi on the device. When it connects it should start using the static IP. In case of issues, make sure that you have the correct MAC Address and Hostname. To check, just run the command ipconfig or look back again in the router’s DHCP client list.

ipconfig_newIP

These changes are written to the ROM so restarting the router won’t make changes to the static IP configuration. In order to get back to Dynamic IP, just remove the entry from the IP leases.

What’s next

Once you have started configuring the IPs on Router and network devices, you are good to go configure telnet and SSH. Have a look at our brief article on  How to Enable Telnet Server in Windows 10 ,  Best SSH clients for iOS To Manages Remote Servers and  6 Best FTP Clients For Android . A word of caution would be to note down the static IPs assigned to devices as assigning the same IP to two network devices would render them useless.

Also Read:  How To Change DNS on Windows|Mac|Android|iOS

' src=

Mrinal Saha

Mrinal is a tech geek who spends half of his day reading and writing about tech. While the nights are spent on shooting or editing YouTube videos. Feel free to geek out with him on-

You may also like

8 fixes for something went wrong error on..., how to use travel mode on apple vision..., 10 fixes for tiktok couldn’t upload video error, 10 fixes for amazon fire tv stick stuck..., why am i getting notifications when someone posts..., top 7 fixes for too many attempts error..., how to create and share stickers on whatsapp, what do various icons and symbols mean in..., 7 fixes for tiktok not showing comments on..., how to edit sent messages on instagram.

  Windows OS Hub / PowerShell / Configure Network Settings on Windows with PowerShell: IP Address, DNS, Default Gateway, Static Routes

Configure Network Settings on Windows with PowerShell: IP Address, DNS, Default Gateway, Static Routes

Managing network adapter settings via powershell, how to get an ip address settings with powershell, set static ip address on windows using powershell, set dns server ip addresses in windows with powershell, managing routing tables with powershell, powershell: change adapter from static ip address to dhcp, change dns and ip addresses remotely on multiple computers with powershell.

Previously, the netsh interface ipv4  command was used to manage network settings from the CLI. In PowerShell 3.0 and newer, you can use the built-in NetTCPIP PowerShell module to manage network settings on Windows.

To get the list of cmdlets in this module, run the following command:

get-command -module NetTCPIP

Managing WIndows Network Settings with PowerShell NetTCPIP module

List available network interfaces on a Windows computer:

Get-NetAdapter

The cmdlet returns the interface name, its state (Up/Down), MAC address, and port speed.

In this example, I have several network adapters on my computer (besides the physical connection, Ethernet0 , I have  Hyper-V and VMWare Player network interfaces).

To display only enabled physical network interfaces:

Get-NetAdapter -Physical | ? {$_.Status -eq "Up"}

Get-NetAdapter - list connected network adapters

You can view only certain network adapter parameters, such as name, speed, status, or MAC address:

Get-NetAdapter |Select-Object name,LinkSpeed,InterfaceOperationalStatus,MacAddress

list nic mac address with powershell

Get-NetAdapter –IncludeHidden

You can refer to network interfaces by their names or indexes (the Index column). In our example, to select the physical LAN adapter Intel 82574L Gigabit Network Connection , use the command:

Get-NetAdapter -InterfaceIndex 8

powershell Get-NetAdapter select NIC by name

You can change the adapter name:

Rename-NetAdapter -Name Ethernet0 -NewName LAN

To disable a network interface, use this command:

Enable the NIC by its name:

Enable-NetAdapter -Name Ethernet0

Using PowerShell to disable a network adapter

If the network adapter has a configured VLAN number, you can view it:

Get-NetAdapter | ft Name, Status, Linkspeed, VlanID

Here is how you can find out the information about the network adapter driver that you are using:

Get-NetAdapter | ft Name, DriverName, DriverVersion, DriverInformation, DriverFileName

list network adapter used drivers

List the information about physical network adapters (PCI slot, bus, etc.):

Get-NetAdapterHardwareInfo

Disable the IPv6 protocol for the network interface:

Get-NetAdapterBinding -InterfaceAlias Ethernet0 | Set-NetAdapterBinding -Enabled:$false -ComponentID ms_tcpip6

Disable the NetBIOS protocol for a network interface:

Set-NetAdapterBinding -Name Ethernet0 -ComponentID ms_netbios -AllBindings -Enabled $True

To get current network adapter settings in Windows (IP address, DNS, default gateway):

Get-NetIPConfiguration -InterfaceAlias Ethernet0

Get-NetIPConfiguration - Retrieve the IP configuration on WIndows via PowerShell

To display more detailed information about the network interface TCP/IP configuration, use the command

Get-NetIPConfiguration -InterfaceAlias Ethernet0 -Detailed

In this case, the assigned network location (profile) (NetProfile.NetworkCategory) of the interface, MTU settings (NetIPv4Interface.NlMTU), whether obtaining an IP address from DHCP is enabled (NetIPv4Interface.DHCP), and a number of other useful information are displayed.

Get-NetIPConfiguration detailed info

To get the IPv4 interface address only:

(Get-NetAdapter -Name ethernet0 | Get-NetIPAddress).IPv4Address

Return the value of the interface’s IP address only:

Display a list of the network protocols that can be enabled or disabled for a network adapter:

Get-NetAdapterBinding -Name ethernet0 -IncludeHidden -AllBindings

Get-NetAdapterBinding view enabled network protocols

Let’s try to set a static IP address for the NIC. To change an IP address, network mask, and default gateway for an Ethernet0 network interface, use the command:

Get-NetAdapter -Name Ethernet0| New-NetIPAddress –IPAddress 192.168.2.50 -DefaultGateway 192.168.2.1 -PrefixLength 24

You can set an IP address using an array structure (more visually):

$ipParams = @{ InterfaceIndex = 8 IPAddress = "192.168.2.50" PrefixLength = 24 AddressFamily = "IPv4" } New-NetIPAddress @ipParams

If a static IP address is already configured and needs to be changed, use the Set-NetIPAddress cmdlet:

Set-NetIPAddress -InterfaceAlias Ethernet0 -IPAddress 192.168.2.90

To disable obtaining an IP address from DHCP for your adapter, run the command:

Set-NetIPInterface -InterfaceAlias Ethernet0 -Dhcp Disabled

Remove static IP address:

Remove-NetIPAddress -IPAddress "xxx.xxx.xxx.xxx"

To set the preferred and alternate DNS server IP addresses in Windows, use the Set-DNSClientServerAddress cmdlet. For example:

Set-DNSClientServerAddress –InterfaceIndex 8 –ServerAddresses 192.168.2.11,10.1.2.11

You can also specify DNS nameserver IPs using an array:

$dnsParams = @{ InterfaceIndex = 8 ServerAddresses = ("8.8.8.8","8.8.4.4") } Set-DnsClientServerAddress @dnsParams

After changing the DNS settings, you can flush the DNS resolver cache (equivalent to ipconfig /flushdns ):

Clear-DnsClientCache

The Get-NetRoute cmdlet is used to display the routing table.

Get the default gateway route for a physical network interface in Windows:

Get-NetAdapter -Physical | ? {$_.Status -eq "Up"}| Get-netroute| where DestinationPrefix -eq "0.0.0.0/0"

powershell: get default gateway route

To add a new route, use the New-NetRoute cmdlet:

New-NetRoute -DestinationPrefix "0.0.0.0/0" -NextHop "192.168.2.2" -InterfaceIndex 8

This command adds a permanent route to the routing table (similar to route -p add ). If you want to add a temporary route, add the -PolicyStore "ActiveStore" option. This route will be deleted after restarting Windows.

Remove a route from the routing table:

Remove-NetRoute -NextHop 192.168.0.1 -Confirm:$False

To configure your computer to obtain a dynamic IP address for the network adapter from the DHCP server , run this command:

Set-NetIPInterface -InterfaceAlias Ethernet0 -Dhcp Enabled

Clear the DNS server settings:

Set-DnsClientServerAddress –InterfaceAlias Ethernet0 -ResetServerAddresses

And restart your network adapter in order to automatically obtain an IP address from the DHCP server:

Restart-NetAdapter -InterfaceAlias Ethernet0

If you previously had a default gateway configured, remove it:

Set-NetIPInterface -InterfaceAlias Ethernet0| Remove-NetRoute -Confirm:$false

If you need to reset all the IPv4 settings for the computer’s network interfaces and switch them to obtain a dynamic IP address from DHCP, use the following script:

$IPType = "IPv4" $adapter = Get-NetAdapter | ? {$_.Status -eq "up"} $interface = $adapter | Get-NetIPInterface -AddressFamily $IPType If ($interface.Dhcp -eq "Disabled") { If (($interface | Get-NetIPConfiguration).Ipv4DefaultGateway) { $interface | Remove-NetRoute -Confirm:$false } $interface | Set-NetIPInterface -DHCP Enabled $interface | Set-DnsClientServerAddress -ResetServerAddresses }

You can use PowerShell to remotely change the IP address or DNS server settings on multiple remote computers.

Suppose, your task is to change the DNS settings on all Windows Server hosts in the specific AD Organizational Unit (OU) . The following script uses the Get-ADComputer cmdlet to get the list of computers from Active Directory and then connects to the remote computers through   WinRM (the Invoke-Command cmdlet is used):

$Servers = Get-ADComputer -SearchBase ‘OU=Servers,OU=Berlin,OU=DE,DC=woshub,DC=cpm’ -Filter '(OperatingSystem -like "Windows Server*")' | Sort-Object Name ForEach ($Server in $Servers) { Write-Host "Server $($Server.Name)" Invoke-Command -ComputerName $Server.Name -ScriptBlock { $NewDnsServerSearchOrder = "192.168.2.11","8.8.8.8" $Adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.DHCPEnabled -ne 'True' -and $_.DNSServerSearchOrder -ne $null} Write-Host "Old DNS settings: " $Adapters | ForEach-Object {$_.DNSServerSearchOrder} $Adapters | ForEach-Object {$_.SetDNSServerSearchOrder($NewDnsServerSearchOrder)} | Out-Null $Adapters = Get-WmiObject Win32_NetworkAdapterConfiguration | Where-Object {$_.DHCPEnabled -ne 'True' -and $_.DNSServerSearchOrder -ne $null} Write-Host "New DNS settings: " $Adapters | ForEach-Object {$_.DNSServerSearchOrder} } }

Exchange Offline Address Book Not Updating in Outlook

How to run program without admin privileges and bypass uac prompt, related reading, deploying third party software updates with wsus, unlocking active directory user accounts, how to find windows version and build number..., fix: action center not opening on windows 10..., couldn’t mount iso file on windows.

' src=

Lovely like always! many thanks

' src=

Thanks for the great info. Would you happen to know a way to get the IP from the PC and then set the internet proxy using the 2nd octet from the IP address? So I have multiple schools and each has a proxy server, so I want to be able to set the proxy based on where that PC is. Location 1 gives PC IP address of 100.55.50.100, Proxy at this location is 100.55.100.1:9090 Location 2 gives PC IP address of 100.60.50.26, Proxy at this location is 100.60.100.1:9090 The second octet is what changes between locations for both proxy address and IP schema. I am trying to do a script at login for the user, so that if the device moves locations, it will not need to have the proxy manually re-entered to get back on the internet.

' src=

I think it will be easier for you to configure the Web Proxy Automatic Detection (WPAD) protocol or Proxy Auto-Configuration (PAC) file to automatically configure proxy setting on client computers.

' src=

Double thumbs up, well done.

' src=

Any Idea how to modify the Connection specific DNS suffix for a network adapter via powershell if possible?

' src=

Wow, amazing work! Was wondering if you know a way to set a static ip for a network adapter without it disconnecting UDP/TCP connections?

' src=

Hi, Could you or anyone help to create two scripts that:

script #1. Reads and records all IP settings for a NIC (IP-, subnet mask-, gateway-, and DNS addresses)

script #2. Changes the IP settings to the settings recorded by script 1

Script 1. Saves all network adapters settings to a json file: $adapterSettings = @() foreach ($adapter in $adapters) { $settings = Get-NetIPAddress -InterfaceIndex $adapter.InterfaceIndex $dns = Get-DnsClientServerAddress -InterfaceIndex $adapter.InterfaceIndex $adapterInfo = [PSCustomObject]@{ AdapterName = $adapter.Name IPAddress = $settings.IPAddress SubnetMask = $settings.PrefixLength Gateway = $settings.NextHop DNS = $dns.ServerAddresses } $adapterSettings += $adapterInfo } $adapterSettings | ConvertTo-Json | Out-File -FilePath "C:\PS\NIC_Settings.json"

Script 2: Apply network settings from file to NICs:

$adapterSettings = Get-Content -Raw -Path "C:\PS\NIC_Settings.json"| ConvertFrom-Json foreach ($adapterInfo in $adapterSettings) { Set-NetIPAddress -InterfaceAlias $adapterInfo.AdapterName -IPAddress $adapterInfo.IPAddress -PrefixLength $adapterInfo.SubnetMask Set-NetIPInterface -InterfaceAlias $adapterInfo.AdapterName -InterfaceMetric $null Set-DnsClientServerAddress -InterfaceAlias $adapterInfo.AdapterName -ServerAddresses $adapterInfo.DNS Set-NetRoute -InterfaceAlias $adapterInfo.AdapterName -NextHop $adapterInfo.Gateway } Restart-NetAdapter -Confirm:$false

Leave a Comment Cancel Reply

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Current ye@r *

Leave this field empty

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Set-Net IPAddress

Modifies the configuration of an IP address.

Description

The Set-NetIPAddress cmdlet modifies IP address configuration properties of an existing IP address.

To create an IPv4 address or IPv6 address, use the New-NetIPAddress cmdlet.

Example 1: Modify an IP address

This command adds the IP address 192.168.0.1 to the interface located at index 12.

The PrefixLength parameter may also be specified as part of the Set-NetIPAddress cmdlet.

Example 2: Modify an IP address and set the valid lifetime

The first command creates a new TimeSpan object of one day, and stores it in the variable named $Timesp.

The second command then uses the TimeSpan object to set the preferred lifetime of the IP address located at interface 12 to one day.

-AddressFamily

Specifies an array of IP address families. The cmdlet modifies the IP address configuration that matches the families. The acceptable values for this parameter are:

-- IPv4 -- IPv6

-AddressState

Specifies an array of duplicate address detection (DAD) state values for the IP address. The acceptable values for this parameter are:

  • Invalid. IP address configuration information for addresses that are not valid and will not be used.
  • Tentative. IP address configuration information for addresses that are not used for communication, as the uniqueness of those IP addresses is being verified.
  • Duplicate. IP address configuration information for addresses for which a duplicate IP address has been detected and the current IP address will not be used.
  • Deprecated. IP address configuration information for addresses that will no longer be used to establish new connections, but will continue to be used with existing connections.
  • Preferred. IP address configuration information for addresses that are valid and available for use.

Runs the cmdlet as a background job. Use this parameter to run commands that take a long time to complete.

-CimSession

Runs the cmdlet in a remote session or on a remote computer. Enter a computer name or a session object, such as the output of a New-CimSession or Get-CimSession cmdlet. The default is the current session on the local computer.

Prompts you for confirmation before running the cmdlet.

-IncludeAllCompartments

Indicates that the cmdlet includes addresses from all configured network compartments. If you do not specify this parameter, the cmdlet modifies only addresses in the default network compartment.

-InputObject

Specifies the input object that is used in a pipeline command.

-InterfaceAlias

Specifies an array of aliases of network interfaces. The cmdlet modifies IP addresses that match the aliases.

-InterfaceIndex

Specifies an array of indexes of network interfaces. The cmdlet modifies IP addresses that match the indexes.

Specifies an array of IPv4 or IPv6 addresses.

Returns an object representing the item with which you are working. By default, this cmdlet does not generate any output.

-PolicyStore

Specifies a PolicyStore value. The acceptable values for this parameter are:

-- ActiveStore. The IP address information is valid. -- PersistentStore. The computer saves IP address information across restarts. When the computer restarts, it copies the saved settings to the ActiveStore.

The default value is ActiveStore. Specify ActiveStore only.

If you do not specify this parameter, the default entries are created in both the ActiveStore and the PersistentStore.

-PreferredLifetime

Specifies a preferred lifetime, as a TimeSpan object, for an IP address. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.

-PrefixLength

Specifies a prefix length. This parameter defines the local subnet size, and is also known as a subnet mask.

-PrefixOrigin

ps_deprecate_para

-SkipAsSource

Indicates whether an address is a primary IP address. This parameter identifies the primary IP address for outgoing traffic in a multiple IP address scenario. If this parameter is set to True, the address is not used for outgoing traffic and is not registered in DNS.

-SuffixOrigin

Specifies an array of origins for address suffixes. IP addresses are divided into two parts, the prefix and the suffix. The address prefix identifies the network portion of an IP address, and the address suffix identifies the host portion. The acceptable values for this parameter are:

-- Manual. The IP address suffix was manually specified. -- WellKnown. The IP address suffix is from a well-known source. -- DHCP. The IP address suffix was provided by DHCP settings. -- Link. The IP address suffix was obtained from the link-layer address. -- Random. The IP address suffix was obtained from a random source.

-ThrottleLimit

Specifies the maximum number of concurrent operations that can be established to run the cmdlet. If this parameter is omitted or a value of 0 is entered, then Windows PowerShell® calculates an optimum throttle limit for the cmdlet based on the number of CIM cmdlets that are running on the computer. The throttle limit applies only to the current cmdlet, not to the session or to the computer.

Specifies an array of IP address types. The acceptable values for this parameter are:

-- Unicast -- Anycast

The default value is Unicast.

-ValidLifetime

Specifies a valid lifetime, as a TimeSpan object, for an IP address. To obtain a TimeSpan object, use the New-TimeSpan cmdlet.

Shows what would happen if the cmdlet runs. The cmdlet is not run.

CimInstance

The Microsoft.Management.Infrastructure.CimInstance object is a wrapper class that displays Windows Management Instrumentation (WMI) objects. The path after the pound sign ( # ) provides the namespace and class name for the underlying WMI object.

Related Links

  • New-TimeSpan
  • Get-NetIPAddress
  • New-NetIPAddress
  • Remove-NetIPAddress

Was this page helpful?

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback .

Submit and view feedback for

Additional resources

  • iPhone 15 Plus vs. Pro Max
  • 3 Key Tech Trends to Watch in 2024

Release and Renew Your IP Address in Microsoft Windows

Use the IPconfig command to fix common networking errors

  • Massachusetts Institute of Technology
  • University of Illinois

assign ip address command line windows

  • Western Governors University
  • The Ultimate Laptop Buying Guide

What to Know

  • Release an IP address: Open Command Prompt , enter ipconfig /release , and press Enter .
  • Renew an IP address: Open Command Prompt , enter ipconfig /renew , and press Enter .

Releasing and renewing the IP address on a computer with the Windows operating system resets the underlying IP connection, which often eliminates common IP-related issues, at least temporarily. It works in a few steps to disengage the network connection and refresh the IP address. Instructions apply to Windows 10, Windows 8.1, Windows 8, and Windows 7.

Windows: Release and Renew IP Addresses 

Under normal conditions, a device can use the same IP address indefinitely. Networks usually reassign correct addresses to devices when they first join. However, technical glitches with DHCP and network hardware can lead to IP conflicts and other problems that prevent the networking system from working correctly.

When to Release and Renew the IP Address

Scenarios in which releasing the IP address and then renewing it might be beneficial include:

  • When connecting a computer to a modem.
  • When physically moving a computer from one network to another, such as from an office network to home or home to a hotspot.
  • When experiencing an unexpected network outage.

Release and Renew an IP Address With Command Prompt

Here's how to release and renew the address of any computer running the Windows operating system.

Open Command Prompt . The quickest method is to press Win + R to open the Run box dialog, enter cmd , and then press Enter .

Enter ipconfig /release and press Enter .

In the command results, the IP address line shows 0.0.0.0 as the IP address. This is normal because the command releases the IP address from the network adapter . During this time, your computer has no IP address and cannot access the internet.

Enter ipconfig /renew and press Enter to get a new address.

When the command is finished, a new line appears at the bottom of the Command Prompt screen that contains an IP address.

More Information About IP Release and Renew

Windows may receive the same IP address after renewal as it had before. This phenomenon is normal. The desired effect of deleting the old connection and starting a new one occurs independently of which address numbers are involved.

Attempts to renew the IP address may fail. One possible error message may read:

  • An error occurred while renewing interface [interface name]: unable to contact your DHCP server. Request has timed out.

This error indicates that the DHCP server may be malfunctioning or is unreachable. Reboot the client device or the server before proceeding.

Windows also provide a troubleshooting section in Network and Sharing Center and Network Connections. These troubleshooting tools run diagnostics that include an equivalent IP renewal procedure if it detects that it's needed.

Get the Latest Tech News Delivered Every Day

  • How to Find Your IP Address on Windows 10
  • How to Find an IP Address in Command Prompt
  • How to Find the MAC Address of Your Laptop
  • How to Delete Old Computer Name From Network in Windows 10
  • How to Find a Modem's IP Address
  • How to Find Your IP Address in Windows
  • What Is an IP Address?
  • How to Find Your IP and MAC Addresses in Windows
  • How to Change the IP Address on Your Android
  • How to Identify Network Hardware IP Addresses on a Local Network
  • How to Resolve Limited or No Connectivity Errors in Windows
  • How to Fix a 169 IP Address Error
  • DNS Servers: What Are They and Why Are They Used?
  • Cisco Default Password List
  • What It Means When You See the 0.0.0.0 IP Address
  • What Is an IP Address Conflict?

How to find the IP address in CMD using hostname?

command prompt to find hostname ip address

In networking, each system has its own identity denoted by a few numerical digits known as IP address, however, remembering them can be a difficult task, especially when there are a large number of systems. For example, each website running on the Internet has an IP address, so that other systems can call them whenever needed but do you think it is feasible to remember the long series of numbers for each website we visit?

The answer is “No”, hence corresponding to each IP address we can set a human-readable label. That’s the reason why when we need to visit Google we use its domain name Google.com instead of its IP address. Similarly, in our local networks, we have hostnames for each PC alongside IP addresses. This hostname allows us to connect PC if we don’t know the IP address.

However, if you don’t know the IP address corresponding to some hostname and want to find that, here in this tutorial we learn how to use the Command prompt or PowerShell to translate a hostname or Domain name to its corresponding IP address.

Step 1: Open Command Prompt

Well, as the title of this tutorial suggests we are going to use the command line on Windows to find the IP address associated with a hostname. Therefore, open the command prompt or PowerShell, click on the Windows Start button search for “ CMD ” as it appears click to run the same.

Alternatively , we can use the Windows key + R to open the Run dialog, typing “ cmd ,” and pressing Enter to access the Command prompt.

Rus as administrator command prompt

Also, learn – how to find a Wi-Fi password using the command prompt in Windows 11.

Step 2: Ping and NSLookUp

There are two common commands that we can use to find the IP address associated with a hostname, one is PING , and the other is NsLookUP , let’s see how to use them.

Ping Command to find the hostname IP

On your command prompt, and those are use PowerShell, run the “ ping ” command along with the hostname of the PC or device that IP address you want to identify. For example, our local hostname is “h2smedia” then the command to find its IP address:

ping hostname or domain

If you want to get IPv4 then add the ‘ -4 ‘ parameter in the above command, it will be like this:

Similarly, we can use any domain name to find its corresponding IP:

Using NSLookUp

Like ping, we can use the NSLookUp which is a specialized command line tool for querying Domain Name System to obtain the mapping between domain name and IP address:

nslookup hostname or domain

Step 3: View the IP Address

Well, the ping command as you run it, the system will start pinging the remote system or device to send packets to the mentioned hostname and in return will display the IP address along with information on whether the remote or local system is in reach or not. To identify the IP address just look for the line that starts with “Reply from” followed by the IP address.

Similarly, in the NSlokup command, you will directly have the Ip-address value as output, instead of confirming whether the host is reachable or not.

command prompt to find hostname ip address

Step 4: Note the IP Address

Once you have the IP address on the command prompt display, you can start using it to either connect the device available in your network or perform any troubleshooting task with the help of any third-party software such as Wireshark .

Other Articles:

  • Check if Virtualization is Enabled via Command Prompt (CMD)
  • Install PHP on Windows 10 | 11 using the Command prompt
  • How to start Firefox in safe mode with the command prompt?
  • How to create multiple folders in the Windows command prompt?

Inside Kodak TV Factory: A Glimpse into the Manufacturing Process

How to Reset Windows 11: A Step-by-Step Guide to Restore Your PC to Factory Setting

Related posts.

Display Features Required for Hyper V Using PowerShell

How to Display Features Required for Hyper-V Using PowerShell

What is the DPC watchdog violation on Windows 11

What is the DPC watchdog violation on Windows 11? Why this is caused and the possible fixes

Reinstall Windows step by step to Factory settings

How to Check if Virtualization is Enabled via Command Prompt (CMD)

Install Virt viewer on Windows 11

Single Command to Install Virt-viewer on Windows 11 or 10

Leave a comment cancel reply.

This site uses Akismet to reduce spam. Learn how your comment data is processed .

Reach out to us for sponsorship opportunities or suggestions

Problems are meant to be solved.

© 2024 H2S Media

ncesc-gaming-pedia

How do I assign a static IP address?

featured

  • Access the Control Panel. In the Windows search bar, type in “ncpa. …
  • Select the Network Adapter. …
  • Select Properties. …
  • Select Internet Protocol Version 4 (TCP/IPv4) …
  • Manually enter IP address and subnet mask. …
  • Save Settings. …
  • Revert Back to DHCP. …

How do I set my IP address to static?

  • Open “Settings” and select “Connections” > “Wi-Fi.”
  • Select the gear icon which appears beside your current network.
  • Select “IP settings” > “Static.”
  • Input your static IP address.
  • Select “Save.”

How do I manually assign an IP address?

Click Start > Settings > Network & Internet. Under your local area connection, click Properties. Under IP assignment, click Edit. Choose Manual, toggle on IPv4, and enter the IP address.

What does it mean to assign a static IP address?

When a device is assigned a static IP address, the address does not change. Most devices use dynamic IP addresses, which are assigned by the network when they connect and change over time.

How do I assign an IP address to my router?

Select ‘Advanced’ at the top of the page. Choose left for ‘Network’, followed by ‘DHCP server’. You’ll now find the option ‘Add’ under ‘Address reservation’. Enter your MAC address, choose an IP address, and describe your appliance in a way you’ll recognize it later.

How to Assign a Static IP Address in Windows 10

Should I set my router to static IP?

Most users don’t need static IP addresses. Static IP addresses normally matter more when external devices or websites need to remember your IP address. One example is VPN or other remote access solutions that trust (whitelists) certain IPs for security purposes.

Does modem or router assign IP address?

By default, the cable modem router acts as a Dynamic Host Configuration Protocol (DHCP) server. The cable modem router assigns IP, DNS server, and default gateway addresses to all computers connected to the LAN. The assigned default gateway address is the LAN address of the cable modem router.

Which device should be assigned a static IP address?

While most network-connected devices receive their IP addresses dynamically through DHCP, it’s common to reserve part of the network address space for use as static IP addresses for devices such as routers, printers, FTP servers, and DHCP servers.

How do I know if my IP is static or dynamic?

On a Windows computer, type ipconfig /all within a command prompt. Find the “DHCP Enabled” text. If it says NO, you have a static IP address. If it says YES, you have a dynamic IP address.

What are the disadvantages of a static IP address?

However, using static IP addresses also has some drawbacks. One of them is that they are less secure and more vulnerable to hacking or spoofing. Since static IP addresses do not change, they are easier to track and target by malicious actors.

What is an example of a static IP address?

For example, I have my home server set to 192.168. 1.10, my main desktop to 192.168. 1.11, and so on—easy to remember, sequential, and unchanging. You can assign these static IP addresses on the device itself—using, say, Windows’ network settings on each computer—or you can do it at the router level.

What are the two ways to assign IP address?

There are 2 ways how you can assign an IP address to your device: (1) dynamically via DHCP or (2) statically by manually assigning an IP address yourself.

Should IP settings be DHCP or static?

Static IP allocation ensures seamless IP allocation and management of these devices. For mobile devices that frequently move between networks, DHCP IP allocation is more convenient since it can automatically assign IP addresses regardless of the network.

How can I tell if my IP address is static?

Can you set static ip on wifi.

Assigning a static IP address to a wireless computer always allows it to use the same IP address. This is in contrast to having a router assign a dynamic IP address to your computer where the IP address changes every time you connect and reconnect to the WiFi.

Is static IP the same as IP address?

The static IP meaning refers to an IP address that is assigned to a device and remains constant, as opposed to a dynamic IP address that changes each time the device connects to the internet. Users assign them to individual devices or resources. The address then applies for as long as users desire.

What are the benefits of a static IP address?

One of the main benefits of using static IP addresses is that they are easier to manage and troubleshoot. You can configure your devices with specific settings and preferences, and you do not have to worry about conflicts or errors caused by changing IP addresses.

How do I get a static IP address from an ISP?

To obtain a static IP address from an internet provider requires signing up for a special service plan and paying extra fees. IP addresses for mobile devices connecting to public Wi-Fi hotspots also change regularly.

Why do routers have 2 IP addresses?

If there’s only one computer in your office, your router has a total of two IP addresses: one public and one private. These enable the router to forward packets of data destined for the Internet to the modem, and to the data’s destination IP address outside your office.

Does IP address depend on WIFI or device?

The internet knows your IP address because it’s assigned to your device and is required to browse the internet. Your IP address changes, though, every time you connect to a different Wi-Fi network or router.

How many IP addresses can a router assign?

Most home routers aren’t even capable of creating multiple subnets, but we will assume you have a really nice home router that can. Your router will only have 254 usable network addresses on a typical home network. Most routers have a network IP address of 192.168. 1.

What are 2 commonly used IP addresses?

There are two versions of IP addresses in common use: IPv4 and IPv6.

What is the difference between static and DHCP?

Can you assign any ip address.

Instead of letting your router assign whatever IP address is free at any given time, you can assign specific IP addresses to the devices you access frequently. For example, I have my home server set to 192.168. 1.10, my main desktop to 192.168. 1.11, and so on—easy to remember, sequential, and unchanging.

When should you use a static IP address?

When static IPs are needed. Most users don’t need static IP addresses. Static IP addresses normally matter more when external devices or websites need to remember your IP address. One example is VPN or other remote access solutions that trust (whitelists) certain IPs for security purposes.

About The Author

Genevieve reed, leave a comment cancel reply.

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

MUO

How (and When) to Use the Ping Command in Windows

Quick links, what does the ping command do, how to use the ping command on windows, what can the ping command do for you.

  • The ping command tests the availability of a host by sending data packets and checking for a response from the server.
  • To use the ping command on Windows, open PowerShell, type "ping " where the targetname parameter refers to the domain name or IP address you want to ping, and press Enter.
  • The ping command can help resolve domain names, check an internet connection, and assess connection stability.

The ping command is commonly used to troubleshoot network problems and assess the health of a network connection. Learn how the ping command works, how to use it on Windows, and examples of a few scenarios you can use it for.

The ping command is a network utility tool used to test the availability of a host, usually a server or computer, locally or over the internet.

When you use the ping command, your device periodically sends packets of data (also known as echo request messages) to the specified IP address (or domain name) and waits for a response from the server each time. If your device receives a response back, the server is considered online. If the server fails to respond, the signal is considered lost, indicating a server problem.

Besides checking if a host is reachable, the command keeps track of the round-trip time. This is the time a message takes to go from a source computer to a destination server and then return to the source, along with a response from the destination server. This data can help you analyze how stable your connection to a server is.

Syntax of the Ping Command

The basic syntax of the ping command looks like this:

Besides this basic parameter required for the Ping test to execute correctly, you can also use other parameters listed on the Microsoft website to customize the test further.

To run the ping command on Windows, follow the steps below:

  • Press the Win + R keys simultaneously to open the Run dialog box.
  • Type "PowerShell" in the box and click the OK button.
  • Type the following command after entering the IP address or domain name of the server you wish to ping: Ping
  • Press Enter and let your device ping the server four times. Then, it will compile the results.

Alternatively, you can perform the test in Command Prompt. Simply press Win + R, type “cmd , ” and click OK . Then, type the command and press Enter.

If you are an administrator of a locked corporate-owned PC, you might need to run PowerShell or Command Prompt with administrative privileges to run the ping test. To do so, type "Command Prompt" or "PowerShell" in Windows Search, right-click on the utility, and select "Run as administrator . "

Then, click "Yes" in the UAC (User Account Control) window.

Analyzing the Results of the Ping Test

The Sent packets (with a default size of 32 bytes each) indicate how many messages were sent from the host device to the remote server. Received packets show the number of responses received from the server to the host device. Lost packets represent the number of signals sent from the host device that the destination server didn't respond to. Time refers to the round-trip time of each ping.

The TTL (Time to Live) value is the lifespan of the packet in the network, after which it's discarded after a certain number of hops through routers. The common benchmark is 64, but TTL can be higher if the data packet is sent through a complex network. But a drastically longer one deserves a closer look to ensure your network is functioning smoothly.

If the ping doesn't go through correctly in the test, and you see a "request timed out" error, it indicates an issue with your internet connection.

How Do You Stop the Ping Command?

The ping command supports a "/t" parameter that specifies that it should continue sending echo requests to the destination server until interrupted. If you use this parameter when running the ping test, your device keeps pinging the specified server until you manually stop the test. To stop an ongoing ping test, you can press Ctrl + C or press Ctrl + Enter to stop and display the data.

Here are some common uses for the ping command:

  • Domain name resolution: The ping command can help you resolve a domain name by translating it into its corresponding IP address. To find the IP address associated with a particular domain, enter "ping " in the Command Prompt or Windows PowerShell and press Enter.
  • Check your internet connection: You can use the ping command to see if your device is connected to the internet or router. Just find your router's IP address and ping it. If you receive a response every time you ping, your device is connected to your router.
  • Check your connection stability: The command can help you check the stability of an internet connection . The connection is considered stable if no packets are lost during the test, and the response time remains short and stable. If some packets are lost, and the response time is high and fluctuates a lot, your connection isn't stable.

Besides the ping command, you can also use other CMD commands to manage your wireless networks effectively.

How (and When) to Use the Ping Command in Windows

IMAGES

  1. Manually Assign a Static IP Address in Windows 11

    assign ip address command line windows

  2. How to Assign Static IP Address From Command Prompt?

    assign ip address command line windows

  3. How to Assign a Static IP Address in Windows 11/10

    assign ip address command line windows

  4. How to Configure IP Address with Command Prompt in Windows 10?

    assign ip address command line windows

  5. Setting IP Address Using ipconfig Command

    assign ip address command line windows

  6. How to Change Your Computer’s IP Address From the Command Prompt

    assign ip address command line windows

VIDEO

  1. Command to Show IP Address Information #ccna #ciscoccna #technology #shorts#viral #youtubeshorts

  2. How to Assign IP Address in your computer using CMD

  3. HOW TO ASSIGN IP ADDRESS ON MIKROTIK ROUTER INTERFACE

  4. Configure IP address to PC in GNS3 #gns3 #networkengineer #networkengineerstuff #ipaddresstoPCGNS3

  5. Assign IP Address at Router

  6. IP Address using CMD

COMMENTS

  1. How to Change Your IP Address From the Command Prompt in Windows

    To launch Command Prompt (or PowerShell) as Admin, open up the Start Menu, search "cmd," hover over the result, then click "Run as Administrator." In Windows 10 or Windows 11, you can also right-click the Start menu (or press Windows+X on your keyboard) to open the Power User Menu and choose "PowerShell (Admin)."

  2. How To Set Static IP Address in Windows 10 using CMD

    Step 1: There are two ways to open the command line. Click on the Start menu, type CMD in the search box, then right-click on it and select Run as administrator. Or press WIN + R, type CMD, and press Enter.

  3. How to Configure IP Address with Command Prompt in Windows 10?

    Type " cmd " in the run and press enter. 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

  4. How to change the IP address in Windows 10 and Windows 11 (4 ways)

    1. How to change the IP address in Windows 10 using the Settings app 2. How to change the IP address in Windows 11 using the Settings app 3. How to change the IP address in Windows using the Control Panel 4. How to change the IP address in Windows 10 and Windows 11 using commands How do you change the IP address in Windows 10 or Windows 11?

  5. How to configure a static IP on Windows 10 or 11

    To assign a permanent TCP/IP configuration on Windows 11, use these steps: Open Settings. Click on Network & internet. (Optional) Click on Advanced network settings. Under the "More settings"...

  6. ipconfig

    ipconfig. To display the full TCP/IP configuration for all adapters, type: ipconfig /all. To renew a DHCP-assigned IP address configuration for only the Local Area Connection adapter, type: ipconfig /renew Local Area Connection. To flush the DNS resolver cache when troubleshooting DNS name resolution problems, type: ipconfig /flushdns.

  7. Change IP Address and DNS Servers using the Command Prompt

    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.

  8. How To Set Static IP Address And DNS Server Using Command Line In

    How to set static IP address using Command Prompt. These commands are relatively easier with the Command Prompt when compared with PowerShell. You can change the IP address of your computer using this quick command. Launch the Command Prompt with administrative privileges and then use the command below to assign the desired IP address ...

  9. How to Assign a Static IP Address to a Windows 11/10 PC

    Choose Manual from the Edit IP settings dropdown menu. Then, toggle on the IPv4 option. Select the IP address field and type the static IP address to assign to your PC. Select the Subnet mask field and enter 255.255.255.. Enter your router's IP address, which is usually 192.168.1.1, in the Default gateway field.

  10. How to Set a Static IP Address on a Windows PC

    Click on the drop-down menu and select Manual. Toggle on the IPv4 switch. Set up the static IP address here and fill in other relevant information, such as the Preferred DNS, Default Gateway, etc. Click on Save. After you are done, you will have a new static IP address on your PC from here on.

  11. How to set static IP address on Windows 10

    To set a static IP address on Windows 10, open Settings > Network & Internet > Wi-Fi, click the connection, click on "Edit," select "Manual," turn on "IPv4," and set the static IP address. Alternatively, you can configure a static IP address from Command Prompt, PowerShell, and Control Panel.

  12. How to Assign IP Address to Computer CMD

    To assign an IP address using the Command Prompt in Windows 10, you can use the netsh (Network Shell) command. You can either set a static IP address or configure your network...

  13. How to change IP address using script on Windows?

    5 Answers Sorted by: 15 ipconfig /renew to get a new IP address or default gateway The NETSH command does this. check this. See this example for setting DNS address manually via netsh command: netsh interface ip set dns "Local Area Connection" static 192.168..200

  14. How to set a static IP address on Windows 11

    Default Gateway DNS Servers Type the following command to assign a static IP address on Windows 11 and press Enter: netsh interface ip set address name="Ethernet0" static 10.1.4.119 255.255.255. 10.1.4.1 In the above command, replace "Ethernet0" with the name of your network adapter.

  15. How to change from static to dynamic IP address on Windows 10

    Open Settings on Windows 10. Click on Network & Internet. Click on Ethernet or Wi-Fi. Click the network connection. Under the "IP settings" section, click the Edit button. Use the Edit IP settings drop-down menu and select the Automatic (DHCP) option. Click the Save button. Once you complete the steps, the networking stack configuration ...

  16. How to Assign Static IP Address to Your Devices

    1. Assign IP Address on Windows 10/8/7 You can do this quickly through the command line. You will need to first find your subnet mask, default gateway, and network adapter name. In my case, I'm on a Wi-Fi network, so the adapter name is Wi-Fi. To find yours just type the following command. ipconfig

  17. Configure TCP/IP from the Command Prompt

    Type the following command in a Command Prompt window (CMD.EXE): netsh interface ip show config With Netsh.exe, you can easily configure your computer's IP address and other TCP/IP...

  18. Configure Network Settings on Windows with PowerShell: IP Address, DNS

    In Windows, you can manage the settings for your network adapters not only from the GUI but also from the PowerShell command prompt. In this article, we'll look at the most important cmdlets that you can use to find out the current IP address of a network adapter, assign a static IP address, assign a DNS server IPs, or configure a network interface to receive an IP configuration from a DHCP ...

  19. Set-NetIPAddress (NetTCPIP)

    The address prefix identifies the network portion of an IP address, and the address suffix identifies the host portion. The acceptable values for this parameter are:-- Manual. The IP address suffix was manually specified. -- WellKnown. The IP address suffix is from a well-known source. -- DHCP. The IP address suffix was provided by DHCP ...

  20. Release and Renew Your IP Address in Microsoft Windows

    Here's how to release and renew the address of any computer running the Windows operating system. Open Command Prompt. The quickest method is to press Win + R to open the Run box dialog, enter cmd, and then press Enter . Enter ipconfig /release and press Enter . In the command results, the IP address line shows 0.0.0.0 as the IP address.

  21. How to find the IP address in CMD using hostname?

    Step 1: Open Command Prompt. Well, as the title of this tutorial suggests we are going to use the command line on Windows to find the IP address associated with a hostname. Therefore, open the command prompt or PowerShell, click on the Windows Start button search for "CMD" as it appears click to run the same.

  22. How do I assign a static IP address?

    How to Assign a Static IP Address in Windows 10. Should I set my router to static IP? ... On a Windows computer, type ipconfig /all within a command prompt. Find the "DHCP Enabled" text. If it says NO, you have a static IP address. If it says YES, you have a dynamic IP address.

  23. How (and When) to Use the Ping Command in Windows

    To do so, type "Command Prompt" or "PowerShell" in Windows Search, right-click on the utility, and select "Run as administrator. Then, click "Yes" in the UAC (User Account Control) window.