[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

better /etc/init.d/network



Hi,

The /etc/init.d/network script created by the debian installation is very
simple and not flexible enough if you need to manage complex networks with
many interfaces.

I have written a generic network interface management command, net, which
can be used to start/stop/show/configure network interfaces, and a smarter
replacement for the /etc/init.d/network script.

The net command makes use of configuration files stored in /etc/network/
which contain the various interface options. For example my eth0 is:

  # /etc/network/eth0
  IPADDR=192.168.0.1
  NETMASK=255.255.255.0
  NETWORK=192.168.0.0
  BROADCAST=192.168.0.255
  GATEWAY=192.168.0.1

The command can be used in the following ways (more info in the man page):

  # Start the network, typically from init(8)
  net start

  # Start some specific interfaces
  net start eth0 eth1:0

  # Start an interface with command-line options
  net start -i eth0 -a 192.168.1.1 -n 192.168.1.0 \
	-b 192.168.1.255 -m 255.255.255.0

  # Stop all the interfaces, typically from init(8)
  net stop

  # Stop some specific interfaces
  net stop lo eth0

  # Restart the network
  net restart

  # Restart a specific interface
  net restart eth1

  # Show network status
  net status

  # Same as above (default action)
  net

  # Show the status of a specific interface
  net status eth1

  # Create or modify an interface configuration file
  net config eth0

The advantage is that you can now start/stop specific interfaces with simple
commands using predefined configs, while the old script could only be used
to start the entire network and couldn't stop or restart it or part of it.

The new /etc/init.d/network script just calls the /usr/sbin/net command,
which does all the real work, with the proper args, just start or stop, and
all the configuration options are now stored as separate config files.

The package can be installed over an slink system because the preinst script
can convert automatically the old network file to the new eth0 config.

The package is available at the following location:

  http://www.cs.unitn.it/~dz/debian/net_1.0-1_all.deb

Please have a look and see if it can added to the main debian distribution.

-- 
Massimo Dal Zotto

+----------------------------------------------------------------------+
|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+


Reply to: