From owner-freebsd-questions@FreeBSD.ORG Wed Aug 5 22:41:34 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81333106566B for ; Wed, 5 Aug 2009 22:41:34 +0000 (UTC) (envelope-from mel.flynn+fbsd.questions@mailing.thruhere.net) Received: from mailhub.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 520308FC08 for ; Wed, 5 Aug 2009 22:41:34 +0000 (UTC) Received: from smoochies.rachie.is-a-geek.net (mailhub.rachie.is-a-geek.net [192.168.2.11]) by mailhub.rachie.is-a-geek.net (Postfix) with ESMTP id 966087E818; Wed, 5 Aug 2009 14:41:33 -0800 (AKDT) From: Mel Flynn To: freebsd-questions@freebsd.org Date: Wed, 5 Aug 2009 14:41:32 -0800 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA2; KDE/4.2.4; i386; ; ) References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200908051441.32469.mel.flynn+fbsd.questions@mailing.thruhere.net> Cc: Stefan Miklosovic Subject: Re: sshd and dhcp bind to specific address X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Aug 2009 22:41:34 -0000 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