Solved

Obtaining public and private ip addresses

Posted on 2008-10-14
6
271 Views
Last Modified: 2013-12-25
When I go to: http://www.whatismyip.com/ I get my public ip address 69.132.x.x  (the ip address that is assigned to the public interface on my router.  When I go to: http://whatismyip.org/ I get my DHCP assigned private ip address of 192.168.1.41 (this is the address actually assigned to my computer's ethernet card).

I know how to get my public ip address using server side scripting in JSP, PHP or cgi scripts, but I don't know how to get my private ip address.  Originally I thought the only way to do this was with some type of client side scripting, but http://whatismyip.org/ appears to be retrieving the client side ip address using only server side scripting.

How is this done?  
0
Comment
Question by:Troupe75
  • 3
  • 3
6 Comments
 
LVL 39

Expert Comment

by:Adam314
ID: 22712528
When I go to either of those, it shows only my public IP address.

It may be that your web client is providing the information in a header.  What web client are you using?  Can you try using FireFox with the LiveHTTPHeaders add-on?  This will tell you if your web client is providing the information.
0
 

Author Comment

by:Troupe75
ID: 22712561
I've tried it with Firefox, Safari, and curl so I don't think it is coming from the web browser.  I'm not using the LiveHTTPHeaders add-on in Firefox.
0
 
LVL 39

Assisted Solution

by:Adam314
Adam314 earned 500 total points
ID: 22733842
Can you describe your setup a bit more?

What do you get when you do an nslookup on  whatismyip.org at a prompt?
eg: from a prompt: nslookup whatismyip.org
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

Author Comment

by:Troupe75
ID: 22733936
Last login: Wed Oct 15 18:51:33 on console
~  $ nslookup whatismyip.org
Server:            192.168.1.6
Address:      192.168.1.6#53

Non-authoritative answer:
Name:      whatismyip.org
Address: 206.176.224.3


I have a DHCP assigned address.  The network goes through a Barracuda content filter and then Nat through a Firebox firewall to a T1.

I'm not sure how the private address is getting passed out.  When I go one of my websites and look at the logs, it show my public ip (the one on the firebox).  I'm not sure if there is a way to run Apache in a mode that will show the full request headers.
0
 

Accepted Solution

by:
Troupe75 earned 0 total points
ID: 22733961
Ah ha.  I found it.  In the headers my browser is sending there is:

x-forwarded-for       192.168.1.41

They must be grabbing that.  I'm guessing is it being added by the Barracuda or Firebox.
0
 
LVL 39

Expert Comment

by:Adam314
ID: 22734001
Yes, that must be it.  I don't think you could use that very reliably, as I don't think most NAT boxes will add it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Sonicwall Firewall -- automatic nightly 2am speed tests ? 1 58
Windows DHCP server in virtual environment 3 90
voice vlan on meraki using 3CX 3 53
IP Calculator 10 52
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now