Service Name
network
Description
The ‘network‘ service activates or deactivates all network interfaces configured to start at boot time. The traditional TCP/IP v4 networking is always enabled if networking is used. The newer TCP/IP v6 may be selectively enabled here. The default system hostname is also provided here but may be later changed as individual network interfaces are started.
Individual network interfaces, often referred to as a “NIC”, each have a configuration file in the /etc/sysconfig/network-scripts directory. By convention, each network interface configuration file is named ifcfg-[name] and are located using a wildcard pattern ifcfg-* search. The content of an NIC configuration file varies according to the type of interface and network. For example, a configuration for an Ethernet card that uses static IP address scheme, might look like this:
# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 HWADDR=00:50:56:96:0F:0E TYPE=Ethernet UUID=81e55568-4ed4-4d44-86dd-3f0272f48919 ONBOOT=yes NM_CONTROLLED=no BOOTPROTO=none IPADDR=10.10.10.10 NETMASK=255.255.255.0 GATEWAY=10.10.10.1
In practice, network configuration files are rarely edited by hand. Instead, the system-config-network tool is used.
Service Control
To manage the network service on subsequent shutdowns and reboots, use the chkconfig command.
# chkconfig network on # chkconfig --list network network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
To disable the service permanently across reboots:
# chkconfig network off
To control the network service immediately, use the service comamnd:
# service network Usage: /etc/init.d/network {start|stop|restart|reload|status}
The table below describes each available command:
Command | Description |
---|---|
start | Initiate the network environment by starting IPv6 networking (if enabled); apply the sysctl(8) settings; start the local loopback interface; IPX network; VLAN network; and then all other devices configured as ONBOOT=yes in their /etc/network/ifcfg-[nic] configuration file; setup static routing; finalize IPv6 startup; rerun sysctl(8) for any interface-specific settings. |
stop | Ignored if the root file system (/) is a network device; stop all network file systems such as NFS; initiate IPv6 shutdown; shutdown for all CIPE, bridge, or VLAN devices; stop IPX services; shutdown loopback device; finalize IPv6 shutdown. |
restart | Equivalent to a stop and then a start command sequence. |
reload | Equivalent to a stop and then a start command sequence. |
status | Display a list of currently-configured and currently-active devices. |
Service Configuration
The /etc/sysconfig/network file controls the overall operation of the network service. An example is shown below:
# cat /etc/sysconfig/network NETWORKING=yes NETWORKING_IPV6=yes HOSTNAME=geeklab.example.com
This example enables IPv6 networking. IPv4 is always enabled when NETWORKING=yes is used. The HOSTNAME entry sets the DNS host name.