Skip to main content

How to Assign Static IP Address From Command Prompt

No device can communicate over a network without a valid IP address. Usually, DHCP server is providing Internet Protocol address to computers connected to the network. However, in certain cases, we must assign a static IP address to a PC by our self. There are different ways to assign it to a PC but the easiest method is the DOS method. There is a DOS prompt command to set a static IP address on a Windows computer. This tutorial explains how to configure static IP address from Command Prompt and explain the procedure with a practical example. At the end of this tutorial, you can see how to perform the same procedure in MAC.

Steps to Assign Static IP To Any Interface From Command Prompt
  1. Start MS-DOS as Administrator

    You must start the command prompt as administrator to set static Internet Protocol number on your computer from the command prompt. On Start menu, right click on cmd and click run as administrator. To learn more about it, visit the link below.
    Run DOS As Administrator

  2. Type the following command on DOS window.

    netsh interface ip set address name="[Interface Name]" static [IP Address] [Subnet Mask] [Default Gateway]

  3. Press Enter

This is the theoretical explanation of configuring a logical address on a laptop without the help of a DHCP server. Now let us check a practical example to learn it.

Practical Explanation

Here I am going to assign Permanent logical number to my computer with default gateway and subnet mask
  1. Check current Addressing using ipconfig

    Here make note of the current default gateway and most importantly the Interface name.

  2. Type the command

    netsh interface ip set address name="Local Area Connection 2" static and press enter.

  3. Check the current addressing with the command ipconfig

How to Release Static IP From Command Prompt

You cannot release and renew static IP by using ipconfig/release. There is another DOS Prompt command to release static IP address set on a computer. To learn more about it, visit the link below.
Configure Automatic Logical Addressing From Command Prompt

How to Assign Static IP on MAC OS
  1. Click the Apple menu(upper right-hand corner of the screen)

  2. From the menu select System Preferences

  3. On System Preferences window click on Network

  4. On the Network select the following

    Location = Automatic
    Show     =  Built-in Ethernet

  5. Select manual option for Configure IPv4

Now you can enter the logical number you want to assign for this MAC. After entering the details click on the Apply Now button to save the settings.

Related Topics
  1. How to Activate Disabled Adapter on your computer

  2. How to Track a Chat User and find the location

  3. How to Use Netstat Command

New Topics


SPM said…
Just don't forget, if you mentioned GW in syntax, you should also fill in [metric] parameter!!

About Author

My photo
Alex George
Alex George has Engineering graduation in Computer Science and an MBA in Finance. He had been working as a senior Network Engineer for ten years. His specialization is in Cisco products. Traveling is one of his hobbies and visited various places as part of his onsite work. He visited different places as part of his onsite work like New York, Dubai, London, etc. Right now Alex is a director of one of the leading career development firms in India, which trains students for UPSC, SSC, and PSC examinations. He guides a lot of students to get selection for various prestigious institutions like CBI, Income Tax Department, etc. Alex George is a stock market investor and a very active intraday trader. Engineering Background: He has a B.Tech in Computer Science and Engineering and passed different network and security courses like CCNA, CCNP (Security), CEH, and various Microsoft certifications. Finance Background: Alex has an MBA in Finance. He is an active intraday trader and a Share Market Investor. Webmaster Skills: Alex is a blogger since 2004. He has a working knowledge of HTML, CSS, PHP, and JavaScrip.