[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ip changed after sometime using dhcp

jqdkf@army.com wrote:


I'm using DHCP to connect to the network, and I use ssh to contral
another machine. The problem is, my ip address is always changing. This
makes my ssh die. I wonder if it is because of my configure file is not
correct or is the common way of DHCP. By the way, I have never changed
the default config file. I'm using dhclient v3.0.1 under sarge.
Thanks in advance.

Since you've not changed the config file, the short leases are most likely comming from the server. You could ask them if the length of the lease you are getting is what they intended, and maybe provide some reasons for increasing the lease. I would be frustrated having the lease expire while the system was still running (unless I'm running 24 hours a day, in which case I'm glad when it doesn't expire). If it's more often than that and the IT people are at all concerned about keeping track of who had what address when (for looking into trouble reports) they must have a large log/database.

You are saying that mid-session your connections from your DHCP'd workstation to the remote system get dropped because the ip address changes, right?

Maybe there's a vpn solution that could work for you. I know that usually cycling a network interface (ifdown/ifup) doesn't drop ssh connections when the ip addresses on each end stay the same. Since the vpn ip addresses can be configured to be the same each time the tunnel is brought up, having that interface cycle (if needed) when the DHCP lease is renewed might work for you.

I'm running dhclient from the dhcp-client 2.0pl5-15. It has a file /etc/dhclient-script which is suppose to execute /etc/dhclient-exit-hooks if that script exists. It seems that the hooks to send an email or cycle a vpn tunnel could be written into dhclient-exit-hooks for the RENEW, REBIND, BOUND and REBOOT situations. Hopefully dhcp-client 3.x has these features as well.

I haven't looked into doing any of this since my lease has lasted over a year.

Good luck with the setup. I hope there's a vpn or some other virtual interface or easier solution that works for you.


Reply to: