Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Aug 2009 14:41:32 -0800
From:      Mel Flynn <mel.flynn+fbsd.questions@mailing.thruhere.net>
To:        freebsd-questions@freebsd.org
Cc:        Stefan Miklosovic <miklosovic.freebsd@gmail.com>
Subject:   Re: sshd and dhcp bind to specific address
Message-ID:  <200908051441.32469.mel.flynn%2Bfbsd.questions@mailing.thruhere.net>
In-Reply-To: <f99a79ec0908051411w7d735dfdhe82c232de6177a53@mail.gmail.com>
References:  <f99a79ec0908051411w7d735dfdhe82c232de6177a53@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wednesday 05 August 2009 13:11:08 Stefan Miklosovic wrote:

> my pc gets ip address from dhcp server,
> but on my pc, there is running
> sshd.
>
> I want to make ssh to listen to only one
> ip address, but if ip changes due to dhcp,
> ssh server do not work properly.
>
> I know, that dhcp is able to assign ip address
> to client from some range e.g. 192.168.0.1-254
> It is possible to do the same with ssh in case
> that it is not possible to do it only with one ip?
>
> I want a solution which would work every time,
> not only some specific one.

Create a script called /etc/dhclient-exit-hooks. Check the dhclient-script 
manpage for some info on the available variables. From there you can work out 
if $new_ip_address is different from $old_ip_address, rewrite /etc/sshd_config 
with the new ip address and restart sshd.
-- 
Mel



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908051441.32469.mel.flynn%2Bfbsd.questions>