473,805 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Finding out IP Address behind NAT

Hi,

I am writing a PHP app for a small business (family member owes me
after this...) but they need to get their box back before I am
finished. They have a DSL with dynamic ip and I need to be able to
SSH in to their box, so I need to write a script that i have run as a
cron job that will email me the current public IP of their DSL modem
(as it will change). I am not sure the best way to go about this....
I was hoping someone could give me a suggestion of a PHP script....

Thanks for any help.

Jan 16 '08 #1
8 4965
KDawg44 wrote:
Hi,

I am writing a PHP app for a small business (family member owes me
after this...) but they need to get their box back before I am
finished. They have a DSL with dynamic ip and I need to be able to
SSH in to their box, so I need to write a script that i have run as a
cron job that will email me the current public IP of their DSL modem
(as it will change). I am not sure the best way to go about this....
I was hoping someone could give me a suggestion of a PHP script....

Thanks for any help.

Don't make it hard on yourself. Check out one of the free dynamic IP
name servers such as dyndns.org.

BTW, there's a good possibility you won't be able to SSH to their box,
but that's not a PHP problem.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Jan 16 '08 #2
Jerry Stuckle wrote:
KDawg44 wrote:
>Hi,

I am writing a PHP app for a small business (family member owes me
after this...) but they need to get their box back before I am
finished. They have a DSL with dynamic ip and I need to be able to
SSH in to their box, so I need to write a script that i have run as a
cron job that will email me the current public IP of their DSL modem
(as it will change). I am not sure the best way to go about this....
I was hoping someone could give me a suggestion of a PHP script....

Thanks for any help.


Don't make it hard on yourself. Check out one of the free dynamic IP
name servers such as dyndns.org.

BTW, there's a good possibility you won't be able to SSH to their box,
but that's not a PHP problem.
If you do want to do it as cronjob as you said, you could do http
request on many of the free online ip address displayer's and parse the
IP out of it.

--
Daniel Ennis
faNetworks.net - Quality Web Hosting and Ventrilo Services
System Administrator / Web Developer
PHP Developer for 6 years
da****@fanetwor ks.net
Jan 16 '08 #3
KDawg44 wrote:
Hi,

I am writing a PHP app for a small business (family member owes me
after this...) but they need to get their box back before I am
finished. They have a DSL with dynamic ip and I need to be able to
SSH in to their box, so I need to write a script that i have run as a
cron job that will email me the current public IP of their DSL modem
(as it will change). I am not sure the best way to go about this....
I was hoping someone could give me a suggestion of a PHP script....

Thanks for any help.
You say cron job - that implies *nix.

Why not write it in shell, and just add a line saying 'mail'

Getting the IP address is trickier: need to interrogate their NAT router.

Thats probably going to be a telnet script or SNMP.

I THINK ther are snmp tools for Linux..

None of this has to do with PHP
Jan 16 '08 #4
On 16 Jan, 11:17, The Natural Philosopher <a...@b.cwrot e:
KDawg44 wrote:
Hi,
I am writing a PHP app for a small business (family member owes me
after this...) but they need to get their box back before I am
finished. They have a DSL with dynamic ip and I need to be able to
SSH in to their box, so I need to write a script that i have run as a
cron job that will email me the current public IP of their DSL modem
(as it will change). I am not sure the best way to go about this....
I was hoping someone could give me a suggestion of a PHP script....
Thanks for any help.

You say cron job - that implies *nix.

Why not write it in shell, and just add a line saying 'mail'

Getting the IP address is trickier: need to interrogate their NAT router.

Thats probably going to be a telnet script or SNMP.

I THINK ther are snmp tools for Linux..

None of this has to do with PHP
If it is a Unix script - then you'll find that most DHCP clients allow
you to hang a script off lease renewals - which is a far batter way of
doing it than using cron (but this is getting way OT) Try asking on a
newsgroup related to your OS for specifics.

C.
Jan 16 '08 #5
The Natural Philosopher wrote:
Getting the IP address is trickier: need to interrogate their NAT
router.
Only if they use NAT. If the machine is directly routed, here's a quick
way of determining the IP address from the command line:

/sbin/ifconfig eth0 | grep -o "inet addr:[0-9\.]*" | sed 's/[^0-9\.]//g'

Where "eth0" is the interface (i.e. network card or virtual network card)
to check.

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.17.14-mm-desktop-9mdvsmp, up 17 days, 6 min.]

Gnocchi all'Amatriciana al Forno
http://tobyinkster.co.uk/blog/2008/0...llamatriciana/
Jan 16 '08 #6
>Don't make it hard on yourself. Check out one of the free dynamic IP
>name servers such as dyndns.org.
Yup. And there are models of Adsl modems that will do automated dyndns
updates (you don't even need a dyndns updater on the PC).
If you do want to do it as cronjob as you said, you could do http request
on many of the free online ip address displayer's and parse the IP out of
it.
For instance in cron I use:
/bin/wget -q -O - http://www.whatismyip.com/automation/n09230945.asp
No filtering necessary
--
Guillaume Dargaud
http://www.gdargaud.net/
"Military solutions are problems."
Jan 16 '08 #7
Guillaume Dargaud wrote:
>>Don't make it hard on yourself. Check out one of the free dynamic IP
name servers such as dyndns.org.

Yup. And there are models of Adsl modems that will do automated dyndns
updates (you don't even need a dyndns updater on the PC).
>If you do want to do it as cronjob as you said, you could do http request
on many of the free online ip address displayer's and parse the IP out of
it.

For instance in cron I use:
/bin/wget -q -O - http://www.whatismyip.com/automation/n09230945.asp
No filtering necessary
That's an even neater trick.
Jan 17 '08 #8
On 16 Jan, 03:06, Jerry Stuckle <jstuck...@attg lobal.netwrote:
KDawg44 wrote:
Hi,
I am writing a PHP app for a small business (family member owes me
after this...) but they need to get their box back before I am
finished. They have a DSL with dynamic ip and I need to be able to
SSH in to their box, so I need to write a script that i have run as a
cron job that will email me the current public IP of their DSL modem
(as it will change). I am not sure the best way to go about this....
I was hoping someone could give me a suggestion of a PHP script....
Thanks for any help.

Don't make it hard on yourself. Check out one of the free dynamic IP
name servers such as dyndns.org.

BTW, there's a good possibility you won't be able to SSH to their box,
but that's not a PHP problem.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
I use noip.com for a similar service.
Jan 17 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
2210
by: Picture Dots | last post by:
Ok - I want to check a string for @ in it (Im checking to see if a string that should contain an email holds a @ ) How would I go about this? preg_match? ereg? strstr?Examples? Also - how would I find any non alpha numeric characters in a string so I can give the user an error message. I dont want any characters besides alpha-numeric in the strings.
9
1716
by: Lauren Wilson | last post by:
Hi Folks, We've been using Crypto ++32 to control licensed access to our widely distributed Access 2K app. Unfortunately, Sampson Multimedia appears to be out of business. Does anyone out there have recommendations for an alternate method of locking our MDE files to allow only licensed access? We simply want to allow the user to install the program and get a
10
2777
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows 2003 Server or ADO or ODBC issue, I am posting this on all of the three newsgroups. That's the setup: Windows 2003 Server with IIS and ASP.NET actiavted Access 2002 mdb file (and yes, proper rights are set on TMP paths and path,
10
1422
by: iwdu15 | last post by:
hi, im making a program that uses the IP address of the computer its on, but i dont kno how to programmaticly find it.....can anyone point me in the rite direction? thanks -- -iwdu15
9
2318
by: Chris | last post by:
How do I find and print to screen the IP address of the computer my python program is working on?
7
3324
by: Brian Cryer | last post by:
What I'm looking for is a way to tell if two sessions are from the same physical PC or from different PCs (within the same organisation say). This is with the view to possibly enforcing license restrictions, i.e. limiting the number of pcs that user account can connect from (say to 1 perhaps 2) but not the number of open sessions that user can have. So, with that in mind I was wondering whether it was possible to obtain the local IP...
17
3792
by: abhimanyu.v | last post by:
Hi Guys, I have one doubt. The test program is given below. It uses two way of finding out the offset of a variable in structure. I executed the program and found the same result. My question is what is difference between 1) (unsigned long) &((struct foobar *)0)->foo and
6
3408
by: BA | last post by:
Hi Everyone, I have an application that sits behind a server farm, the application needs to pass its NLB IP address in the message that it sends to another service. From C# code, how can I determine the IP address of the network load balanced machine that the message is generated from? So, in essence, I have server1, server2 and server3 sitting behind the NLB IP address 100.1.2.100, then I have server4 and server5 sitting behind NLB...
275
12437
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
0
9718
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10614
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9186
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7649
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5544
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3847
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.