/    Sign up×
Community /Pin to ProfileBookmark

How to display the private IP of a client in the browser

I’m trying to create a page that will display, to the user, the internal NAT address of the machine.

The context is this: I’ve bought a laptop for my Mother-in-law and am setting it up so I can support it with the minimum of hassles. So I’m going to give her a default home page on my server with a google search box and a few links that she will commonly use.

This laptop will be behind a home broadband router.

In order to help troubleshoot and support her over the phone, I want to display on her home page the internal address on the broadband router as well as the public external address, which is returned by $REMOTE_ADDR;

Can anyone tell me how to return that internal address in the client’s browser?

Thanks,

Rob

to post a comment
PHP

9 Comments(s)

Copy linkTweet thisAlerts:
@so_is_thisDec 20.2006 — I don't think it is possible for an Internet web page to query an intranet IP address -- for that is what you're really talking about. You could easily provide an intranet web page, however, which could do this. That is, of course, if the intranet browser is IE (using the Windows Script Host from IE JScript).
Copy linkTweet thisAlerts:
@felgallDec 20.2006 — One of the main purposes of NAT is to hide the internal IP address of the individual computers. Also since in most cases those IP addresses will be in one of the three private ranges thay are not accessible to anywhere outside of the private network and require the NAT to give them access to the internet at all. As far as the internet is concerned the IP address of the device doing the NAT is as far as is visible to anyone.

The only time the private IP address would be accessible at all would be if the firewall/NAT wasn't configured correctly.
Copy linkTweet thisAlerts:
@scaiferwauthorDec 20.2006 — One of the main purposes of NAT is to hide the internal IP address of the individual computers. Also since in most cases those IP addresses will be in one of the three private ranges thay are not accessible to anywhere outside of the private network and require the NAT to give them access to the internet at all. As far as the internet is concerned the IP address of the device doing the NAT is as far as is visible to anyone.

The only time the private IP address would be accessible at all would be if the firewall/NAT wasn't configured correctly.[/QUOTE]


I agree, and it's for good reason. The thing is, I don't want the info on the server, only to display in the browser so she can tell me over the phone.

Thinking one step further, I guess what I'm really looking for is some sort of a JavaScript, not PHP. Hmmm.

OK, thanks everyone. I'll pursue that angle.
Copy linkTweet thisAlerts:
@so_is_thisDec 20.2006 — The thing is, I don't want the info on the server, only to display in the browser so she can tell me over the phone.

Thinking one step further, I guess what I'm really looking for is some sort of a JavaScript, not PHP.[/QUOTE]

That is what my post was about.
Copy linkTweet thisAlerts:
@RusevDec 20.2006 — I'm not sure if that will help you, but with MSSQL you can execute commands.

xp_cmdshell {'command_string'} [, no_output]

so you can execute ping and s.o.

Thanks
Copy linkTweet thisAlerts:
@felgallDec 20.2006 — Javascript has no access to any IP address unless you use another language to pass that IP address to it. Since the other languages that it can get the IP address from all run on the server it has no more access to the private IP address than whichever server side language you are using has.
Copy linkTweet thisAlerts:
@scottrickmanDec 20.2006 — Why not forget the whole web page and put a batch file on her desktop that opens a console, issues ipconfig /a and pauses? She can just read the output to you on the phone
Copy linkTweet thisAlerts:
@so_is_thisDec 20.2006 — Since the other languages that it can get the IP address from all run on the server it has no more access to the private IP address than whichever server side language you are using has.[/QUOTE]
Not quite. As I said, the IE browser, in an intranet environment, has access to all of that and more. No server required. But, the batch file idea is simpler and quicker.
Copy linkTweet thisAlerts:
@aussie_girlDec 21.2006 — or you can use Remote Assistance assuming you both have XP
×

Success!

Help @scaiferw spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...