CSCI 157: UNIX Power Utilities and Shell Programming
Laboratory Assignment 6
1. TURN-IN a hard copy of the following:
- On all homework please include
- Your Name
- Course Number
- Date
- ecst login name
- No questions from the book this lab
- Write one of the scripts described below
- Use ANY language such as perl, python, ruby, tcl, expect, bash, csh, tcsh, ksh, sh, php
- TURN-IN printout of script
- Have a soft copy on your ecst account so you can demo it
Dynamic IP Script
- Script should use ifconfig to get IP address of machine.
- Script should get this IP address to display on a web page on your ECST account or other Unix account somehow.
- Most likely methods are by uploading a file through SFTP or FTP.
- Executing a command through SSH.
- Making a request to a CGI or PHP page with the updated IP address as a parameter.
- Probably would use wget for this.
- Would write the CGI script or PHP code yourself (pretty easy)
- Can we run CGI code or PHP on the ECST machines? Maybe not?
- IP address on webpage should not include all of the other output from ifconfig
- This script can be written entirely on the computers at school by
having a lab computer upload its IP address somehow to tiglon,
pretending your home directory is not being shared over NFS and that
you have to do the same things someone would do if they were doing it
from a computer at home.
- You can also do this on a home computer.
- You can do this using bash or perl on a Windows computer even and update the IP address on the Unix system. Windows ipconfig is similar to ifconfig.
- Additional details given in lab.
Updates: 3-3-2004
- I realized after class no explanation was given as to what an IP
address is or what dynamic DNS is. Nobody asked andI assumed everyone knew. If you need clarification or explanation please email me and let me know.
- Also, please don't hesitate
to email me with any other problems or questions. If the labs are
too difficult for some of you let me know so that we can make sure you
get enough guidance so that they won't be too difficult or time
consuming. You can turn-in any of the scripts we have done so far
in lab next week if you haven't turned them in yet.
- Script doesn't need to use ifconfig, a much nicer way was pointed out by Chris during lab.
- Use a small php script that when it runs it will tell you what your IP address is.
- As Chirs pointed out this is nicer than using ifconfig since if
you use one of those dsl modem/router/switch things then it will tell
you the IP address of that device instead of your IP address on your
internal network.
- You put this in a file named ip.php in your webspace on tiglon,
make it executable, and then point your browser to it or use wget to
see it work.
- <?php echo $_SERVER["REMOTE_ADDR"]; ?>
- This is a handy little script.
- Website Chris mentioned in class http://freedns.afraid.org/
- It would be neat to see different kinds of solutions
- What does a solution done purely in perl look like?
- How much harder is it to use ifconfig to the the ipaddres?
- How about one that uploads the IP address using FTP, or SFTP or SSH or by way of a perl cgi or by using another php script?
- Any working solution gets full credit so you can be creative.
- If you get at least a partially working solution by the due date we can get it the rest of the way working during lab.