≡ Menu

Check IP address from CMD

Ipconfig command is used to find the IP address of a system from command line. Run the command ipconfig to print IP addresses for all network adapters installed on the system.

c:\>ipconfig
Windows IP Configuration

Ethernet adapter Local Area Connection:
   Connection-specific DNS Suffix  . :
   IPv4 Address. . . . . . . . . . . : 192.168.1.2
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1

Wireless LAN adapter Wireless Network Connection:
   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . :

If you are interested in just knowing the IP address and not bothered about all other details printed by the command, you can use findstr to filter out unwanted details.

c:\>ipconfig | findstr /C:Address
   Link-local IPv6 Address . . . . . : fe80::f9d5:883c:9ae7:3af0%12
   IPv4 Address. . . . . . . . . . . : 192.168.0.105
   IPv6 Address. . . . . . . . . . . : 2001:0:4137:9e76:14b6:3da3:b662:d819
   Link-local IPv6 Address . . . . . : fe80::14b6:3da3:b662:d819%11
c:\>

Here, it shows IP addresses for various interfaces installed on the computer, it includes IPv6 interfaces as well.

If the system is connected to a DHCP configured network then you can release the IP obtained from DHCP.

ipconfig /release

The above command works for IPv4. To release IPv6 address the command is given below.

ipconfig /release6

 

4 comments… add one
  • Suren chettri

    Not show DHCP in my computer

  • dave128

    I run cmd / ipconfig using an admin account and it displays the Default Gateway 86.187.161.242, but as it’s a dynamic IP address it both changes each log in and always times out after about 20 seconds. How can I extend the time out to say a minute?

    Dave128

    • Kevin

      Default Gateway = Router
      If you login on your firmware of the router and go to your DHCP server settings.
      And change your Client Lease Time. That should do the trick. (https://www.wikihow.com/Configure-a-Router-to-Use-DHCP)

      If the default gateway it self changes after 20 seconds. Then I suggest to contact your ISP provider. Or google how to set a static IP to your default gateway.

  • Avinash

    i want to get only ip 192.168.x.x
    but it’s showing me like IPv4 Address. . . . . . . . . . . : 192.168.x.x
    i dont want (IPv4 Address. . . . . . . . . . . :) this part
    and also i want this in a vbscript that can store this value in a variable
    please help .

Leave a Comment