|
|
#1 |
|
Triple-A Player
Join Date: Jan 2002
Location: .-tHE mOON-.
Posts: 70
|
Hi,
I browsed through several threads and hints concerning how to report your IP to an e-mail account / FTP server and I also checked several IP-Reporting utilities but they do not fulfil my needs. 1) Check if DHCP is up, if not release and re-init the DHCP, if IP has changed ->2 2) Report IP to an FTP.server does any1 know how to script this so cron could run it !? well here is why ... The problem with my ISP (Cable) is that from time to time (weekly) they shutdown a router or something so my DCHP lease is dropped and OS X is assigning an ip itself (169.xx.xx.xx). No Problem if I am around. But what if I am away ? Even-worse they changed afterwards my IP to something different ... |
|
|
|
|
|
#2 |
|
Triple-A Player
Join Date: Jan 2002
Location: .-tHE mOON-.
Posts: 70
|
Ok I know how to renew the DHCP,
sudo ipconfig set en0 BOOTP sudo ipconfig set en0 dhcp but I have no idea how to compare the ip |
|
|
|
|
|
#3 |
|
Moderator
Join Date: Jan 2002
Posts: 10,677
|
Are you sure your firewall isn't blocking the BootP DHCP renew request replies?
|
|
|
|
|
|
#4 |
|
League Commissioner
Join Date: Jan 2002
Posts: 5,536
|
why bother comparing the IP? just splat it up and drive on.
|
|
|
|
|
|
#5 | |||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2002
Location: .-tHE mOON-.
Posts: 70
|
Well, I am pretty sure the DHCP request is not blocked by my Firewall, because after renewing the DHCP request. I have my old IP address again. From time to time my ISP decides to change my IP.
Well, if the connection is dropped and I don't get a new IP I have the 169.xx.xx.xx (selfasigned one) - which I can not post, obviously. Then and only then I need to renew the DHCP (happens from time to time that I need to renew the DHCP 4-5 times). So in fact I have to check whether my IP is 169.xx.xx.xx and then renew until I have a 81.xx.xx.xx. But you are right as soon as I have a valid I don't have to compare but simply "splat it up"
|
|||||||||||||||||||
|
|
|
|
|
#6 |
|
Triple-A Player
Join Date: Jan 2002
Location: .-tHE mOON-.
Posts: 70
|
Ok .. after a small fight with the csh shell, and I have to admit the Manuals on the net are very helpful - I succeeded
![]() what do you think to my little script ... #!/bin/csh ipconfig getifaddr en0 > IP set uno = `awk -F . '{print $1}' IP` echo $uno" as first IP Numba" if ( $uno == '192') then echo "We Are Laned" else if ( $uno == '169') then echo "We don't have a DHCP Connection" echo "tryin to re-establish" while ( $uno == '169') sudo ipconfig set en0 BOOTP echo "tryin to reach DHCP Server in few sex" sleep 3 sudo ipconfig set en0 DHCP sleep 12 ipconfig getifaddr en0 > IP set uno = `awk -F . '{print $1}' IP` end echo "We have a Connection back" echo "Copying IP to FTP Server" ncftpput -E -u <Login> -p <Password> <Ftp.Server> <ServerFolder:/IP/> <File:IP> endif ofcorse I get rid of the echos for the the final-cron-job-script but they helped to script it
|
|
|
|
|
|
#7 | |||||||||||||||||||
|
Moderator
Join Date: Jan 2002
Posts: 10,677
|
Does 'Form time to time' happen to coincide with the DHCP lease renewal time? A 169.foo address is what the machine resorts to when a DHCP renew request is not answered. I'd make sure that you're allowing UDP packets from the DHCP server's port 67 to your your port 68. |
|||||||||||||||||||
|
|
|
|
|
#8 | |||||||||||||||||||
|
Triple-A Player
Join Date: Jan 2002
Location: .-tHE mOON-.
Posts: 70
|
sorry I don't understand |
|||||||||||||||||||
|
|
|
|
|
#9 |
|
Moderator
Join Date: Jan 2002
Posts: 10,677
|
An IP address assigned by a DHCP server has a 'lifespan'. Minutes, hours, days. For example, 3 days. I turn my computer on today at 10 AM, at 10AM 3 days later, my computer knows that the lifespan alloted for it's IP address is up and that it needs to request a renewal of that lifespan or a new address. If the local firewall is blocking the reply from the router/DHCP server, then the request goes out and is never 'answered' according to the computer and it'll assign itself a 169.foo address.
I was curious if "From time to time" was a reproducible timeframe that you might not have noticed before because you weren't looking for it. Last edited by yellow; 09-07-2003 at 07:44 AM. |
|
|
|
|
|
#10 |
|
Triple-A Player
Join Date: Jan 2002
Location: .-tHE mOON-.
Posts: 70
|
no .. it has a random behaviour. Stood online for weeks and another day the DHCP got dropped after a few hours ...
|
|
|
|
![]() |
|
|