I have more than one adapter in my system and I want to know the IP of particular adapter. Is it possible through a command in Windows, in Linux it's easy? Or any other way?
Asked
Active
Viewed 3.7k times
15
-
1Invoking `ipconfig` doesn't seem much like programming (at least to me). – Jerry Coffin Dec 14 '10 at 14:19
4 Answers
34
The following will let you specify an adapter (something ipconfig doesn't appear to do):
netsh interface ip show config name="Local Area Connection"
You can add | findstr "IP Address"
to the end of that command to only show the IP address line.

Trevor
- 55,264
- 2
- 18
- 12
-
Hey Trevor, I tried with "netsh interface ip show address" it gave me the actual current ip of my system but when i tried "netsh interface ip show address name="Local Area Connection" " it gave me some different ip which i used in past. One more thing what name i have to provide for getting the ip of PPP adapter can anyone suggest. – zombie Dec 14 '10 at 15:07
-
however it would show the ip address only if set as static, it does not show dhcp assigned IP. – Mubashar Nov 20 '13 at 00:37
-
And if you want to find out a name, you can use `netsh interface show interface` – Hrvoje T Mar 30 '18 at 06:54
1
Here's how I was able to get my IP Address for a specific network adapter:
for /f "tokens=3 delims=: " %i in ('netsh interface ip show config name^="Ethernet" ^| findstr "IP Address"') do echo Your IP Address is: %i
For an explanation of how this works, see my related answer here: https://stackoverflow.com/a/59004409/2684661

Joshua Dyck
- 2,113
- 20
- 25
0
With Powershell
Get-NetIpInterface
ifIndex InterfaceAlias AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp ConnectionState PolicyStore
------- -------------- ------------- ------------ --------------- ---- --------------- -----------
56 vEthernet (WSL) IPv6 1500 15 Enabled Connected ActiveStore
17 vEthernet (Default Switch) IPv6 1500 15 Enabled Connected ActiveStore
7 Local Area Connection* 2 IPv6 1500 25 Enabled Disconnected ActiveStore
21 Ethernet 2 IPv6 1348 25 Enabled Connected ActiveStore
26 Local Area Connection* 1 IPv6 1500 25 Disabled Disconnected ActiveStore
25 Ethernet IPv6 1500 5 Enabled Disconnected ActiveStore
12 Wi-Fi IPv6 1500 35 Enabled Connected ActiveStore
1 Loopback Pseudo-Interface 1 IPv6 4294967295 75 Disabled Connected ActiveStore
56 vEthernet (WSL) IPv4 1500 15 Disabled Connected ActiveStore
17 vEthernet (Default Switch) IPv4 1500 15 Disabled Connected ActiveStore
7 Local Area Connection* 2 IPv4 1500 25 Enabled Disconnected ActiveStore
21 Ethernet 2 IPv4 1348 1 Disabled Connected ActiveStore
26 Local Area Connection* 1 IPv4 1500 25 Enabled Disconnected ActiveStore
25 Ethernet IPv4 1500 5 Enabled Disconnected ActiveStore
12 Wi-Fi IPv4 1500 35 Enabled Connected ActiveStore
1 Loopback Pseudo-Interface 1 IPv4 4294967295 75 Disabled Connected ActiveStore
Identify your interface and note the ifIndex and then run
Get-NetIpAddress -AddressFamily IPv4 -InterfaceIndex 21|findstr IPAddress
IPAddress : 172.55.23.43
To get the IPv4 address.

Zioalex
- 3,441
- 2
- 33
- 30
-2
ipconfig /all should do the trick.

Chris Kooken
- 32,730
- 15
- 85
- 123
-
This doesn't answer the question. The OP wants to get a particular adapter and this will just list all of them out. – fujiiface Oct 03 '18 at 21:54