How to find my VPN client IP in windows

When I run ipconfig and I get the following:

C:\Documents and Settings\grmsrh14>ipconfig
Windows IP Configuration
Ethernet adapter Wireless Network Connection: Media State . . . . . . . . . . . : Media disconnected
Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : 112.25.2.222 Subnet Mask . . . . . . . . . . . : 255.255.254.0 Default Gateway . . . . . . . . . : 112.25.2.1 DHCP Class ID . . . . . . . . . . : rise
Ethernet adapter Local Area Connection 2: Media State . . . . . . . . . . . : Media disconnected
PPP adapter my_lab: Connection-specific DNS Suffix . : IP Address. . . . . . . . . . . . : 10.2.251.41 Subnet Mask . . . . . . . . . . . : 255.255.255.255 Default Gateway . . . . . . . . . :

Is there a command that prints only the my_lab(VPN) IP address, ie 10.2.251.41?

0

2 Answers

You can use the netsh command:

For Vista/7:

netsh interface ipv4 show addresses "PPP adapter my_lab"

And one of these for XP:

netsh interface ip show config "PPP adapter my_lab"

Where PPP adapter my_lab can be replaced by the name of any one of your adapters.

4

Do you know the ip range of the my_lab VPN?

If you do, a batch file like this will do the trick:

@echo off
FOR /F "tokens=2 delims=:" %%a in ('IPCONFIG ^|FIND "IP" ^|FIND "10.2"') do set _IP=%%a
set IP=%_IP:~1%
echo %IP%

But, as it was suggested by heavyd, if you know only the name of the PPP adapter it's better to use the netsh command.

@echo off
FOR /F "tokens=1-6 delims=:. " %%a in ('netsh int ip show address "my_lab" ^|find "IP Address"') do set IP=%%c.%%d.%%e.%%f
echo %IP% 

-Updated

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like