Re: Reconfiguring network interfaces

2008-07-07 Thread David Allen
On Sun, Jul 6, 2008 at 8:12 AM, Mel <[EMAIL PROTECTED]> wrote:
> 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.

LOL.  You've turned what was could have been an awkward scenario and a
cheap and dirty hack into something almost elegant.  Me, I'm just
trying to save some trips but I'm sure there's enough of us who have
encountered a situation where physical access is out of the question
or simply not doable.

My thanks to everyone that replied.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Reconfiguring network interfaces

2008-07-06 Thread Wojciech Puchar

would work, but would require I do that locally.


You could also use the alias featue, adding the new ip, sshing into the new 
ip, and dump the old ip.


** Though I haven't tried this method personally. **


but i did.


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Reconfiguring network interfaces

2008-07-06 Thread Mel
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.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Reconfiguring network interfaces

2008-07-06 Thread Andrew D

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.


You could also use the alias featue, adding the new ip, sshing into the 
new ip, and dump the old ip.


** Though I haven't tried this method personally. **

HTH
cya
Andrew


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: Reconfiguring network interfaces

2008-07-06 Thread Derek Ragona

At 09:06 AM 7/6/2008, 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.



You pretty much need to be on the console rather than ssh'd in to make 
those changes interactively.  You can do them remotely via a cron job or at 
job, but any mistake will require a trip  to  the console.


-Derek

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Reconfiguring network interfaces

2008-07-06 Thread David Allen
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.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"