Ubuntu Systems
  • /etc/resolv.conf specifies the nameservers for resolver lookups. The order of lookup is sequential and accordance to DNS protocol. Local and global DNS entries are added here. Please be advised that these settings could be overwritten by system updates and even reboots. Hence, issues with DNS can mostly be resolved with cmdlet: “sudo dpkg-reconfigure resolvconf“. If this file must be edited, a way of inserting persistent DNS records onto resolv.conf is
    • vim /etc/resolvconf/resolv.conf.d/head >> insert a record such as: nameserver [LOCAL_DNS_IP] >> save file: wq + enter >> Regenerate resolv.config with: sudo resolvconf -u
  • /etc/hosts file is typically used for only administrative purposes and internal network functions of limited scope. Singular entries associating names with IPs are sometimes added here.
  • /etc/nsswitch.conf specifies the lookup order, to be used in conjunction with the hosts entry.
  • /etc/network/interfaces is the manual IP Address configuration method (typically for servers). Here is a sample of an edit of this file:
    • iface eth0 inet static
          address 192.168.30.X
          netmask 255.255.255.0
          gateway 192.168.30.1
          dns-search kimconnect.com
          dns-nameservers 192.168.20.1 192.168.10.1
Lastly, any changes to network configurations should be followed by this command: service network-manager restart
Redhat / CentOS Systems

List all network interfaces:
ls /etc/sysconfig/network-scripts/

Alternative command: ip a

Edit ifcfg-ens192
vi /etc/sysconfig/network-scripts/ifcfg-ens192

Example of a config:

BOOTPROTO=none #meaning static, not DHCP
ONBOOT=yes #load this interface on boot
PREFIX=24 #network mask
IPADDR=192.168.1.25
GATEWAY=192.168.1.254
DEFROUTE=yes #set this as default route
# DNS SERVERS #
DNS1=192.168.1.254
DNS2=192.168.2.254
DNS3=8.8.8.8

Edit hostname:
vi /etc/sysconfig/network

Location of Hosts file (please note that enterprise systems should not have manual entries here):
vi /etc/hosts

View statuses of interfaces
nmcli -p dev

Restart network services:
service network restart
OR
systemctl restart network

Ping:
ping -c 1 {Gateway_IP}

Kernel command-line method:

#Set IP address, gateway, and hostname
ip<client-IP-number>:[<server-id>]:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:{dhcp|dhcp6|auto6|on|any|none|off}

Example:
ip=192.168.180.120:192.168.180.100:192.168.180.1:255.255.255.0::eth0:off

IP addressing command:
ip addr [add|del] {IP_address} dev ifcfg-{?}
default via {gateway_IP} dev ifcfg-{?}

Example:
ip address add 192.168.1.3/24 dev ifcfg-ens192
default via 192.168.1.1 dev ifcfg-ens192
ip addr show dev ifcfg-ens192