Monday, April 25, 2011

Change in IP, reboot? Not with FreeBSD.

There are times when I need to swap a server replacement in for a machine that's gone down.  After changing the IP address in /etc/rc.conf there is a simple set of commands that can be strung together that will keep you from having to wait for a whole system reboot.

Step 1: change the IP address in /etc/rc.conf
ifconfig_re0="inet 10.10.10.49  netmask 255.255.255.0"
becomes
ifconfig_re0="inet 10.10.10.50  netmask 255.255.255.0"
As long as we didn't have to adjust the default router (which is just one other line in the same file) we can save the /etc/rc.conf file and issue these commands:
/etc/rc.d/netif restart && /etc/rc.d/routing restart
Your network will reset and start up with the new settings in the /etc/rc.conf file.  This will terminate any sessions currently open, including your SSH session, if that's how you're connected.

No comments:

Post a Comment