0

How do I get system network address using angular application?

C:\Users\asdasd>ipconfig

Windows IP Configuration

PPP adapter asdas:

Connection-specific DNS Suffix  . :
**IPv4 Address. . . . . . . . . . . : 10.212.134.220**
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 0.0.0.0

I have tried below urls but the results are not matching with IPv4 address shown in ipconfig.

this.http.get("http://api.ipify.org/?format=json").subscribe((res:any)=>{
  this.ipAddress = res.ip;
});

https://jsonip.com

https://geolocation-db.com/json/

  • 1
    10.x.x.x is a private address. The service returns your public ip. It is impossible to get the public ip address without using an external service. And an external service shouldn't have a way to get your private ip. – kgiannakakis Nov 08 '21 at 13:14
  • you wont be able to get that specific address from an external source, like kgiannakakis mentioned. You could via WebRtc but looks like the browsers are no longer returning it due to security reasons. check related below https://stackoverflow.com/questions/20194722/can-you-get-a-users-local-lan-ip-address-via-javascript https://stackoverflow.com/questions/56755747/rtcicecandidate-no-longer-returning-ip – silvio Nov 08 '21 at 15:23

0 Answers0