Previous Page | Next Page

  1. Introduction
  2. Boot Process
  3. Init and System Initialization
  4. rc.sysinit script
  5. rc script
  6. functions script
  7. Services
  8. apm daemon
  9. network startup
  10. The network script file
  11. The network-functions file
  12. Portmap startup
  13. Random initialization
  14. Syslog initialization
  15. Gated
  16. Atd
  17. cron initialization
  18. pcmcia
  19. inetd daemon
  20. named daemon
  21. lpd daemon
  22. mars-nwe
  23. netfs startup
  24. dhcpd daemon
  25. autofs daemon
  26. keytable daemon
  27. sendmail daemon
  28. gpm daemon
  29. httpd daemon
  30. xfs startup
  31. smb startup
  32. innd startup
  33. linuxconf startup
  34. rc.local script
  35. Init, Getty, Login
  36. The shell
  37. Shutting down
  38. X
  39. Conclusions
  40. App A. rc.sysinit listing
  41. App B. functions listing
  42. App C. rc listing
  43. Credits

Linux network startup

The network startup script is used to bring up network devices found in the /etc/sysconfig directory. It starts by using the /etc/sysconfig/network file to set various networking environment variables. The /etc/sysconfig/network file on my system is:

NETWORKING=yes
FORWARD_IPV4="yes"
HOSTNAME="myhost"
GATEWAY="10.1.1.10"
GATEWAYDEV="eth0"

It therefore sets the environment variables listed to the values specified in the network file. If it can find the required binaries for setting up networking it will enter the /etc/sysconfig/network-scripts directory and look for ifcfg network files which are files for network devices. My ifcfg-eth0 file is:

DEVICE="eth0"
IPADDR="10.1.1.100"
NETMASK="255.255.0.0"
ONBOOT="yes"
BOOTPROTO="none"
IPXNETNUM_802_2=""
IPXPRIMARY_802_2="no"
IPXACTIVE_802_2="no"
IPXNETNUM_802_3=""
IPXPRIMARY_802_3="no"
IPXACTIVE_802_3="no"
IPXNETNUM_ETHERII=""
IPXPRIMARY_ETHERII="no"
IPXACTIVE_ETHERII="no"
IPXNETNUM_SNAP=""
IPXPRIMARY_SNAP="no"
IPXACTIVE_SNAP="no"

The script finds all the network interfaces and stores the list in the variable "interfaces_boot". For each interface the following happens:

  1. ipforwarding is turned on or off depending on the value of "FORWARD_IPV4" in the /etc/sysconfig/network file.
  2. The variable "DEFRAG_IPV4" determines if fragmentation will be turned on or off.
  3. If IPX capability is true for the device, the program ipx_configure and ipc_internal_net is used to configure IPX capability.
  4. The script file /etc/rc.d/network-scripts/ifup is run.

The ifup script continues:

  1. It invokes the function "need_hostname" which calls the system program hostname(1) to determine the hostname.
  2. It checks to be sure the device name was entered on the command line.
  3. It uses the usernetctl(1) function to be sure users are allowed to control this device if the user is not root, user number 0.
  4. The source_config function in the network-functions file which I think checks to see if this device is a child device of a parent such as eth0:1 to the parent eth0.
  5. The script then determines how to get the IP address from a static value or a BOOTP or DHCP server. It uses ipcalc(1) and pump(8) to help do this. The pump(8) command configures the network interface using BOOTP or DCHP.
  6. Then the program ifconfig(8) is used to configure the network device by passing the appropriate device name, ip address, netmask, and broadcast address to the ifconfig program.
  7. The route program is used to add routes to hosts or networks.
  8. The route program is used to setup the default gateway based on the value in the /etc/sysconfig/network file.
  9. If the device is also an IPX device, the script /etc/sysconfig/network-scripts/ifup-ipx is run for the device.

The network-functions script is used to provide functions to both the network and ifup script programs.