6. Reconfiguration

In order to make the configurations permanent, add these lines to /etc/rc.d/rc.local , so that they are executed each time that the server is rebooted:

bash# vi /etc/rc.d/rc.local
### configure network interfaces
/usr/local/config/network.sh

### configure iptables (firewall and port forwarding)
/usr/local/config/firewall/iptables.sh

For updating the configuration of the server without rebooting (e.g. when something is modified in the configuration files), the script reconfig.sh (Section 6.1, “reconfig.sh”) is used. Steps needed in case of reconfiguration are these:

  1. Copy network.cfg.1 or network.cfg.2 to network.cfg, in order to enable this configuration and disable the other.

  2. If needed, make any modifications in the firewall configuration scripts.

  3. Run the script reconfig.sh in order to change the network configuration immediately, or reboot.

[Note]Note

In case that configuration files of httpd and samba have changed, then these services have to be restarted as well:

bash# /sbin/service httpd restart
bash# /sbin/service smb restart
[Caution]Caution

In case that the server is accessed and managed remotely, it is quite possible to lock yourself out, e.g. if you make a wrong configuration of the network interfaces or a mistake in the configuration of the firewall. To avoid such troubles, be cautious about new configurations and test them before making them permanent. A script like test.sh (Section 6.2, “test.sh”) can be used to test a new configuration. It enables the new configuration, and after a certain time (say 60 secs) it goes back to the old (tried and true) configuration. During this time you can test the new configuration and make sure that it is OK.

6.1. reconfig.sh

#!/bin/bash
### reconfigure the network after changing
### any configuration variables

path=$(dirname $0)

### configure network interfaces
$path/network.sh

### configure iptables (firewall and port forwarding)
$path/firewall/iptables.sh

6.2. test.sh

#!/bin/bash
### This script is for testing any new configurations.
### When the server is accessed and managed remotely,
### something may go wrong and it is possible to lock
### yourself out. To avoid such troubles, this script
### tests any new configs and after a certain time
### (e.g. 60 secs) it goes back to the old (tried and true)
### configuration. During the sleep time you can test
### the new configuration and make sure that it is OK.

mv network.cfg.2 network.cfg
./reconfig.sh
sleep 60
mv network.cfg.1 network.cfg
./reconfig.sh