From owner-freebsd-questions@FreeBSD.ORG Sun Jul 6 15:12:43 2008 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 D7DD3106567A for ; Sun, 6 Jul 2008 15:12:43 +0000 (UTC) (envelope-from fbsd.questions@rachie.is-a-geek.net) Received: from snoogles.rachie.is-a-geek.net (rachie.is-a-geek.net [66.230.99.27]) by mx1.freebsd.org (Postfix) with ESMTP id 897688FC0A for ; Sun, 6 Jul 2008 15:12:43 +0000 (UTC) (envelope-from fbsd.questions@rachie.is-a-geek.net) Received: from localhost (localhost [127.0.0.1]) by snoogles.rachie.is-a-geek.net (Postfix) with ESMTP id 8D5581CD94; Sun, 6 Jul 2008 07:12:42 -0800 (AKDT) From: Mel To: freebsd-questions@freebsd.org Date: Sun, 6 Jul 2008 17:12:40 +0200 User-Agent: KMail/1.9.7 References: <2daa8b4e0807060706s4e5f8aedqe2ce00ca33bd1b46@mail.gmail.com> In-Reply-To: <2daa8b4e0807060706s4e5f8aedqe2ce00ca33bd1b46@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200807061712.41120.fbsd.questions@rachie.is-a-geek.net> Cc: David Allen Subject: Re: Reconfiguring network interfaces 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: Sun, 06 Jul 2008 15:12:44 -0000 On Sunday 06 July 2008 16:06:49 David Allen wrote: > I need to make several wholesale changes to a few different systems, > and I'd prefer to do it over SSH without losing connectivity where > possible. I know I can use ifconfig, or edit /etc/rc.conf directly > and reboot, but is there a canonical way to make the changes in > /etc/rc.conf and "reload" those changes to ensure everything is in a > known state? From what I can determine, running netif stop/start > would work, but would require I do that locally. So, you want to make changes to a machine and confirm they're correct, but when they're not, the old settings should be restored: 0) make sure sshd listens on all ip's ('INADDR_ANY'), not preconfigured set. # cp -p /etc/rc.conf /etc/rc.conf.BEFORE_CHANGE # ${EDITOR} /etc/rc.conf # cp -p /etc/rc.conf /etc/rc.conf.CHANGES Then this script, say /root/bin/testrc.sh: ===================================================================== #!/bin/sh /etc/rc.d/netif stop sleep 1 /etc/rc.d/netif start # sleep for 5 minutes, should be ample time to re-establish the ssh # connection. sleep 300 # We were not killed, this means the connection is faulty cp -p /etc/rc.conf.BEFORE_CHANGE /etc/rc.conf /etc/rc.d/netif stop sleep 1 /etc/rc.d/netif start ===================================================================== Then run as: daemon -p /var/run/testrc.pid /root/bin/testrc.sh When you can log back in, simply: kill `cat /var/run/testrc.pid` ; rm /var/run/testrc.pid And rm /etc/rc.conf.BEFORE_CHANGE if you feel comfy. If you couldn't log back in, inspect /etc/rc.conf.CHANGES and adjust, rm the pid file, rince and repeat. -- Mel Problem with today's modular software: they start with the modules and never get to the software part.