Get Client Local IP Address

Sureshdta
Kilo Explorer

Hello,

 

Does anyone know how to get the client Local IP address in servicenow.

 

I see there is a way to get the Public IP address using the below method, but need a way to get the local IP address.

gs.getSession().getClientIP();

 

Please let me know if anyone has suggestion.

 

Thanks
Suresh

1 ACCEPTED SOLUTION

sshall
Mega Expert

Hi Suresh,



I'm assuming you're trying to retrieve the client's local network address, which may be an RFC 1918 private IP behind some NAT device. You may be able to accomplish this via a client script using the methods described here: Can You Get A Users Local LAN IP Address Via JavaScript? - Stack Overflow



There is, to my knowledge, no way to do this purely on the server side within a business rule or script include. You would need a client script to run client-side JavaScript that could GlideAJAX the IP back to the server, at which point you could do something interesting with it.



Regards,



Scott Hall


View solution in original post

3 REPLIES 3

sshall
Mega Expert

Hi Suresh,



I'm assuming you're trying to retrieve the client's local network address, which may be an RFC 1918 private IP behind some NAT device. You may be able to accomplish this via a client script using the methods described here: Can You Get A Users Local LAN IP Address Via JavaScript? - Stack Overflow



There is, to my knowledge, no way to do this purely on the server side within a business rule or script include. You would need a client script to run client-side JavaScript that could GlideAJAX the IP back to the server, at which point you could do something interesting with it.



Regards,



Scott Hall


zulhiyatiuwi
Tera Expert

Hello...

I need to get client local IP too. But i'm not good in script. Can you help me to explain it more, please?

Thank you

Brian104
Tera Expert

Wouldn't this work?  gs.getSession().getClientIP();   (Though maybe this method didn't exist 8 years ago...)