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

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • 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. How to Reinstall Corrupted Library with yum
  2. How to install and configure sosreport under CentOS / RHEL
  3. How to disable a specific command for a specific user in Linux
  4. How to enable the automatic extension for a thin LVM volume
  5. CentOS / RHEL 7 : How to set date, time / NTP and timezone using timedatectl
  6. Linux Interview Questions – Linux Printing (CUPS)
  7. How to allow or deny telnet login to specific users only in CentOS/RHEL
  8. Understanding OpenSSH Configuration Files
  9. How systemd-tmpfiles cleans up /tmp/ or /var/tmp (replacement of tmpwatch) in CentOS / RHEL 7
  10. Understanding rsyslog Actions

You May Also Like

Primary Sidebar

Recent Posts

  • What are different Oracle Database Vault Roles
  • Unable to export realm protected table using data pump
  • Beginners Guide to Oracle Database Vault
  • How to Disable IPv6 on Ubuntu 18.04 Bionic Beaver Linux
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary