Fake Static IP... (shell script)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Fake Static IP... (shell script)
# 1  
Old 02-21-2007
Error Fake Static IP... (shell script)

I'm working on a script that runs on remote hosts and sends their dynamic IP address' to a server (which of course has statics).

All the client computers run linux (as does the server).

basically... the idea was:

1) Host a webpage on the server with a php script that displays only the IP address of the client.
I accomplished this with code: <?php echo $_SERVER['REMOTE_ADDR']; ?>

2) run a script (in a cron job) that queries the the server for its current IP, then checks it against the the last known IP. If its changed, it sends the updated IP address to the server. (the use the lynx domain.com/ip --dump command to get my public IP)


-- So... I have two questions. (maybe more)...


1) What do you guys think the best solution is to get the IP and hostname back to the server? I have shell access to all computers, so I thought scp at first... but a few of the computers have users I don't necessarily trust, so I really didn't want to use scp in a script...

2) I also would like to make a url forward to that computer... How can I for example:
"ssh user@domain.com/remote1" and have the php script (or any kind of script) redirect (...route) me to the remote hosts IP?

This is something I've been working on for a while... I realize it may not be the most elegant approach, but its what I came up with after much, much deliberation. So any Ideas... experinces... advise will be greatly appreciated!

Btw, This might be the first time I've ever posted an actual question about linux or anything for that matter. I can always find the answers I need by searching and reading... even if it takes weeks to figure out one little thing. So I wouldn't ask If I felt I could just google it and find the answers.

Last edited by heith; 02-22-2007 at 02:01 AM.. Reason: add icon so I would draw your attention :)
# 2  
Old 02-22-2007
fsip

Did I post this in the right section?

I've been checking these forums every 3 hours for days... Reading these forums I can tell there are a lot of crazy smart people here... can just one of you through me a bone? Smilie

Last edited by heith; 02-25-2007 at 06:44 AM.. Reason: need help...
# 3  
Old 02-27-2007
The Script...

ok, I don't think I explained it well enough.

I think it will be easier if I just paste the script... then you can pick it apart.

Code:
#!/bin/bash
BASEDIR=~/scripts/fsip	##The name of the folder you keep all your text files 
NEWIP=$BASEDIR/newip	##Location of the text file that will store the address of the CLIENT
SERVER=example.com       		##Name of the server that hosts the IP   	
RHOME=/home/fsip/ 	##Target Directory on the server (the location of the SERVER script)   	
GETIP=example2.com/ip		##The server[s] that send back the Clients public IP. (calls a webpage with this php code: <?php echo $_SERVER['REMOTE_ADDR']; ?>)
PUBIP=`lynx -dump $GETIP`	##Getting the CLIENT's current ip address  (of course this requires lynx... elinks should work too)
#-----------------------------------------------------------------------------------------------
if [ "$PUBIP" != "$NEWIP" ]; then
echo $PUBIP > $NEWIP
scp $NEWIP $SERVER:$RHOME/`hostname`-ip.txt
fi

---------------EDIT------------------

If anyone cares... (which I doubt because no one took the time to respond) I
came up with a better solution with the help of a php guru.

If you interested in a fake static IP, email me.

Last edited by heith; 03-02-2007 at 10:41 AM.. Reason: typo
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Programming

Even the Static cURL Library Isn't Static

I'm writing a program which uses curl to be run on Linux PCs which will be used by a number of different users. I cannot make the users all install curl on their individual machines, so I have tried to link curl in statically, rather than using libcurl.so. I downloaded the source and created a... (8 Replies)
Discussion started by: BrandonShw
8 Replies

2. UNIX for Dummies Questions & Answers

fake network address....

Good morning! Why would having a fake network device be useful? Thanks in advance Bigben (0 Replies)
Discussion started by: bigben1220
0 Replies

3. Shell Programming and Scripting

Unix script to segregate dynamic and static content of a web application

I need to deploy a JAVA application on two separate servers: 1. Web server (IBM HTTP Web Servers (IHS)) 2. Application Server (WebSphere Application Server WAS7.0) The static content will have to be deployed and handled on Web server. These would include GIFs, HTML, CSS, etc files.... (0 Replies)
Discussion started by: chani27
0 Replies

4. IP Networking

I need HELP to Set up Coyote Linux router with 1 static IP & 64 internal static IP

hello, i need help on setting my coyote linux, i've working on this for last 5 days, can't get it to work. I've been posting this message to coyote forum, and other linux forum, but haven't get any answer yet. Hope someone here can help me...... please see my attached picture first. ... (0 Replies)
Discussion started by: dlwoaud
0 Replies

5. Shell Programming and Scripting

Static variable in shell

Hi All, I want a static variable in shell script. I have a script in which I want to send mail on certain condition and it happens that when that condition is met it start mailing as i have set my cron job to execute every 15 mins. And what i want is to run that script after every 15... (4 Replies)
Discussion started by: Yagami
4 Replies

6. UNIX for Advanced & Expert Users

Static variable in shell

Hi All, I want a static variable in shell script. I have a script in which I want to send mail on certain condition and it happens that when that condition is met it start mailing as i have set my cron job to execute every 15 mins. And what i want is to run that script after every 15... (1 Reply)
Discussion started by: Yagami
1 Replies

7. Shell Programming and Scripting

Fake deletion of files

Hi, This is possibly an odd request to do with permissions as I seem to have tied myself up with these! I have the following directory (see below) that contains files that the 'usergrp' user needs to be able to 'delete' files from. drwxr-s--- 2 usergrp usergrp 512 16 Feb 14:37... (2 Replies)
Discussion started by: Peejay
2 Replies

8. Solaris

system Fake IPs

hi all ; I am using solaris 8 over SPARC . i was given the role to administer a webmail server running Iplanet 4.2 i was told also that this server is running a website . this server has 2 fake IPs . My question is how i can know these fake IPs and how they are mapped . cheers (2 Replies)
Discussion started by: ppass
2 Replies
Login or Register to Ask a Question