I have struggled with this for a long time. I need to log in to my home machine from work. Easy, but my home computer is on a dialup (ADSL) line without a fixed IP address. Thus when the line is dropped (once a day or so), the machine disappears behind a dynamically assigned new IP address upon redial which I won't see until I get to the computer physically.

On my work computer I have a firewall (iptables) running with a chain called "HOMEGATE" which has three rules, the first lets me through from "home", the second logs the "ping" (see above) and the third simply forwards into the real firewall chain. INPUT and FORWARD are all going to HOMEGATE. Notice that as long as the ip address of home is valid, the pings never reach the second rule, they are accepted by the first (and then dropped because there is no service there obviously)

Home computer pings every ten minutes to port 44444
Work computer's firewall ignores 44444 as long as it is coming from what is currently known as home computer
When the IP address of my home computer changes, the logging does happen and metalog calls a script
The script updates /etc/hosts and the running firewall
ssh thauer@home works again!

I actually liked my solution, maybe pieces can be useful for something related after all: it shows a little bit of how iptables can be used for non-default things and I just learned how to use metalog...

There is one thing which the dyndns service does not do for me: updating my iptables rules on my non-home machine. I have strict firewall rules on that computer which do not allow generic access, but accepts connections from my home machine. Given that iptables stores the rules with ip-addresses, the table gets broken when my home machine gets assigned a new ip address.

There's another option here. You don't have to poll - dhcp has provisions to call your own script, so this can be event-driven. To be honest, I'm running dhcpcd-3.X, so anything I can tell you is hopelessly obsolete. I masked >=dhcpcd-4.X until I could learn how to replace my dhcpcd-3.X scripts. I never got around to it, and I believe I've heard that dhcpcd-5.X is going to do it differently, so I'm hoping to skip dhcpcd-4.X entirely.

With dhcpcd-3.X I was able to specify an executable with this line in /etc/conf.d/net :

Code:

dhcpcd_eth0="-h myName -R -c /usr/local/sbin/dhcpcd.sh"

Whenever dhcpcd did anything significant it would call my dhcpcd.sh with a few arguments, which I could parse and do what was needed.

I'm under the impression that this same type of capability is still in place in newer versions, just implemented differently._________________.sigs waste space and bandwidth

I have net-misc/dhcpcd-5.6.2 on my systems. This has hooks which can be programmed easily. Everytime there is a change in dhcp-process, the files in dhcp-hooks are executed. So you could do the following: