Simplifying the LFS Bootscripts

Ian Molton spyro at
Sun Jan 9 09:41:48 PST 2005

Alexander E. Patrakov wrote:

> E.g., consider this example for two IPv4 addresses and a static route:
> # Begin /etc/sysconfig/network-devices/eth1
> ONBOOT=yes
> up() {
>  ip link set eth1 up
>  ip addr add broadcast dev eth1
>  ip addr add broadcast dev eth1
>  ip route add via
> }
> down() {
>  ip route del via
>  ip addr del broadcast dev eth1
>  ip addr del broadcast dev eth1
>  ip link set eth1 down
> }
> # End /etc/sysconfig/network-devices/eth1

I dont like this.

conceptually, the up and down are merely the parts reading

ip link set eth1 {up,down}

and I personally think its bad practice to -up an inetrface before 
setting up the addresses its going to have assigned to it.

the up and downing should be handled by a generic script or function 
that *only* does that.

I recon the /etc/sysconfig/network-devices/eth1 file should contain:

ADDR= broadcast
ADDR= broadcast

Or something similar.

the dev eth1 is implicit in that the file is named 

and the up and downing process shouldnt be part of the configuration 
file, it should be part of the script that interprets the file.

IOW, the script would be passed the up/down parameter, and would read 
/etc/sysconfig/network-devices/eth1 to discover that it should up or 
down the interface. it could also add / delete the addresses.

Also your proposal leaves open a wide margin for sut-n-paste errors in 
that people will copy the 'add' lines and use them for the 'del' lines 
too, just changing the add to a del (or more likely, forgetting to).

-1 here.

More information about the lfs-dev mailing list