• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

Linux OS Service ‘network’

by admin

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.

Filed Under: Linux, Linux Services

Some more articles you might also be interested in …

  1. Understanding the /etc/exports File
  2. e2image Command Examples in Linux
  3. How to Disable rpc.quotad Service in CentOS/RHEL 6 and 7
  4. Understanding Device Persistence and Oracle ASMLib
  5. How to use command redirection under Linux
  6. expect Command Examples in Linux
  7. How to Compress and Decompress .bz2 files in Linux Using bzip2 Command
  8. CentOS / RHEL 5,6 : How to Change the timezone
  9. passwd: gkr-pam: couldn’t update the login keyring password: no old password was entered
  10. gzip: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright