Pages

Friday, December 18, 2015

Working with Network on CentOS/RHEL 07 - Part 01


IP Networks versus non-IP Networks

IP based networks:- These are all networks that communicate via Internet Protocol addresses, which is the standard for the Internet and for most internal networks today. This generally includes Ethernet,  Cable Modems, DSL Modems, dial up modems, Wi-Fi, VPN connections and more.
Non-IP based networks:- These are usually very specific niche networks, but one in particular has grown in usage enough to warrant mention here and that is InfiniBand. Because InfiniBand is not an IP network, many features and configurations normally used on IP networks are not applicable to InfiniBand.

Introduction to NetworkManager

In Red Hat Enterprise Linux 7, the default networking service is provided by NetworkManager, which is a dynamic network control and configuration daemon that attempts to keep network devices and connections up and active when they are available.
-  NetworkManager - The default networking daemon
nmtui - A simple curses-based text user interface (TUI) for NetworkManager
nmcli - A command-line tool provided to allow users and scripts to interact with NetworkManager
control-center - A graphical user interface tool provided by the GNOME Shell
nm-connection-editor - A GTK+ 3 application available for certain tasks not yet handled by control-center

NetworkManager Daemon Installation and Initial Configuration

- Installing NetworkManager Daemon

[root@localhost ~]# yum install  NetworkManager.x86_64

- You can determine whether the NetworkManager daemon is running by usging below command:

[root@testvm07002 network-scripts]# systemctl status NetworkManager.service
NetworkManager.service - Network Manager
   Loaded: loaded (/usr/lib/systemd/system/NetworkManager.service; enabled)
   Active: active (running) since Wed 2015-04-15 11:00:16 EDT; 19s ago
Main PID: 2944 (NetworkManager)
   CGroup: /system.slice/NetworkManager.service
           ├─2944 /usr/sbin/NetworkManager --no-daemon
           ├─2992 /sbin/dhclient -d -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp0s9.pid -lf /var/lib/NetworkManager/dhclient-bb53a5ca-2dc3-4ebe-ba35-ad3664475fa9-enp0s9.lease -cf /var/lib/NetworkManager/dhclient-enp0s9.conf enp0s9
           └─2994 /sbin/dhclient -d -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-enp0s10.pid -lf /var/lib/NetworkManager/dhclient-4474b5b1-e576-45bd-babb-c3ce22d41166-enp0s10.lease -cf /var/lib/NetworkManager/dhclient-enp0s10.conf enp0s10

Apr 15 11:00:18 testvm07002 NetworkManager[2944]: <info>   nameserver '192.168.0.1'
Apr 15 11:00:18 testvm07002 NetworkManager[2944]: <info>   domain name 'in.ril.com'
Apr 15 11:00:18 testvm07002 NetworkManager[2944]: <info> Activation (enp0s10) Stage 5 of 5 (IPv4 Configure Commit) scheduled...
Apr 15 11:00:18 testvm07002 NetworkManager[2944]: <info> Activation (enp0s10) Stage 5 of 5 (IPv4 Commit) started...
Apr 15 11:00:18 testvm07002 NetworkManager[2944]: <info> (enp0s10): device state change: ip-config -> ip-check (reason 'none') [70 80 0]
Apr 15 11:00:18 testvm07002 NetworkManager[2944]: <info> Activation (enp0s10) Stage 5 of 5 (IPv4 Commit) complete.
Apr 15 11:00:18 testvm07002 NetworkManager[2944]: <info> (enp0s10): device state change: ip-check -> secondaries (reason 'none') [80 90 0]
Apr 15 11:00:18 testvm07002 NetworkManager[2944]: <info> (enp0s10): device state change: secondaries -> activated (reason 'none') [90 100 0]
Apr 15 11:00:18 testvm07002 NetworkManager[2944]: <info> Activation (enp0s10) successful, device activated.
Apr 15 11:00:21 testvm07002 NetworkManager[2944]: <info> startup complete


- Adding and removing NetworkManager daemon from server startup by using below commands, First we will have a look on what all services are enabled to get started in server bootup process

[root@localhost ~]# ll /etc/systemd/system/multi-user.target.wants/
total 0
lrwxrwxrwx. 1 root root 38 Nov  1 04:01 auditd.service -> /usr/lib/systemd/system/auditd.service
lrwxrwxrwx. 1 root root 44 Nov  1 03:58 avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service
lrwxrwxrwx. 1 root root 37 Nov  1 03:58 crond.service -> /usr/lib/systemd/system/crond.service
lrwxrwxrwx. 1 root root 42 Nov  1 04:01 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service
lrwxrwxrwx. 1 root root 37 Nov  1 04:00 kdump.service -> /usr/lib/systemd/system/kdump.service
lrwxrwxrwx. 1 root root 39 Nov  1 04:01 postfix.service -> /usr/lib/systemd/system/postfix.service
lrwxrwxrwx. 1 root root 40 Nov  1 03:58 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
lrwxrwxrwx. 1 root root 39 Nov  1 03:59 rsyslog.service -> /usr/lib/systemd/system/rsyslog.service
lrwxrwxrwx. 1 root root 36 Nov  1 04:01 sshd.service -> /usr/lib/systemd/system/sshd.service
lrwxrwxrwx. 1 root root 37 Nov  1 04:01 tuned.service -> /usr/lib/systemd/system/tuned.service

- Now we will get the service enabled to get started in server bootup process using below command, It simply adds links to respective folder of systemctl.

[root@localhost ~]# systemctl enable NetworkManager.service
ln -s '/usr/lib/systemd/system/NetworkManager.service' '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service'
ln -s '/usr/lib/systemd/system/NetworkManager.service' '/etc/systemd/system/multi-user.target.wants/NetworkManager.service'
ln -s '/usr/lib/systemd/system/NetworkManager-dispatcher.service' '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'

- Same can be cross checked using below command for presence in the particular folder

[root@localhost ~]# ll /etc/systemd/system/multi-user.target.wants/
total 0
lrwxrwxrwx. 1 root root 38 Nov  1 04:01 auditd.service -> /usr/lib/systemd/system/auditd.service
lrwxrwxrwx. 1 root root 44 Nov  1 03:58 avahi-daemon.service -> /usr/lib/systemd/system/avahi-daemon.service
lrwxrwxrwx. 1 root root 37 Nov  1 03:58 crond.service -> /usr/lib/systemd/system/crond.service
lrwxrwxrwx. 1 root root 42 Nov  1 04:01 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service
lrwxrwxrwx. 1 root root 37 Nov  1 04:00 kdump.service -> /usr/lib/systemd/system/kdump.service
lrwxrwxrwx. 1 root root 46 Mar 26 16:11 NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
lrwxrwxrwx. 1 root root 39 Nov  1 04:01 postfix.service -> /usr/lib/systemd/system/postfix.service
lrwxrwxrwx. 1 root root 40 Nov  1 03:58 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
lrwxrwxrwx. 1 root root 39 Nov  1 03:59 rsyslog.service -> /usr/lib/systemd/system/rsyslog.service
lrwxrwxrwx. 1 root root 36 Nov  1 04:01 sshd.service -> /usr/lib/systemd/system/sshd.service
lrwxrwxrwx. 1 root root 37 Nov  1 04:01 tuned.service -> /usr/lib/systemd/system/tuned.service

- To Disable the service for getting started in server bootup use below commands, which simply removes the links from respective folder of systemctl.
                                                                                                                                          
[root@localhost ~]# systemctl disable NetworkManager.service
rm '/etc/systemd/system/multi-user.target.wants/NetworkManager.service'
rm '/etc/systemd/system/dbus-org.freedesktop.NetworkManager.service'
rm '/etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service'

- You can stop NetworkManager daemon using below command:

[root@localhost ~]# systemctl stop NetworkManager.service

- You can start NetworkManager daemon using below command:

[root@localhost ~]# systemctl start NetworkManager.service

- You can restart NetworkManager daemon using below command:

[root@localhost ~]# systemctl restart NetworkManager.service

No comments:

Post a Comment