What is Network?
Network is the combination of two or more computers connected together to share their resources each other by means of communication like cable is called Network.
TCP/IP Network Model
The TCP/IP model is a simplified, four-layered set of different layer of protocol. It describes that how the protocols of different layers will communicate internally with each other for transfer data from one computer to other over the internet.
It is specified by RFC 1122. The four layers are:-
Each application has specifications to establish communication, with the help of which clients and servers may communicate across platforms. Common protocols include SSH (remote login), HTTPS (secure web), NFS or CIFS (file sharing), and SMTP (electronic mail delivery).
Transport protocols are TCP and UDP. TCP is a connection-oriented communication, and UDP is a connectionless user datagram protocol. Application protocols use TCP or UDP ports. You can see well-known and registered ports in the /etc/services file.
When a packet transfers over the network, then the service port and IP address make a combination and forms a socket. Each packet has a source socket and a destination socket. You can use this information during monitoring and filtering.
The network layer is also known as internet layer. It carries data from source host to destination hosts. The IPv4 and IPv6 protocols are Internet layer protocols. Each host has an IP address and a prefix used to determine network addresses. Routers are used to connect networks.
The link layer provides the connection to physical media. Types of networks that are most commonly in use are wired Ethernet (802.3) and wireless WLAN (802.11). Each physical device has a hardware address (MAC) which is used to identify the destination of packets.
NETWORK INTERFACE NAMES
On a physical machines there is network interface card (NIC) attached, the name of that NIC card is described with interface names.
Older versions of Red Hat Enterprise Linux used names like eth0, eth1, and eth2 for each network interface. The name eth0 was the first network port detected by the operating system, eth1 the second, and so on.
Newer versions of CentOS/RHEL use a different naming system. Now it doesn’t based on detection order, the names of network interfaces are assigned based on information from the firmware, the PCI bus topology, and type of network device.
Network interface names start with the type of interface:
- Ethernet interfaces begin with en
- WLAN interfaces begin with wl
- WWAN interfaces begin with ww
The rest of the interface name after the type will be based on information provided by the server’s firmware or determined by the location of the device in the PCI topology.
oN indicates that this is an on-board device and the server’s firmware provided index number N for the device. Here eno1 is an on-board Ethernet device1. Many servers will not provide this information.
sN indicates that this device is in PCI hotplug slot N. Here ens3 is an Ethernet card in PCI hotplug slot 3.
What is an IP address
Every Computer will assign with an IP address to identify each one to communicate in the network. The IP address sub components are Classes of an IP address, Subnet masks and Gateway.
Classes of IP address :
In the following bit-wise representation,
- n indicates a bit used for the network ID.
- H indicates a bit used for the host ID.
- X indicates a bit without a specified purpose.
Class A 0. 0. 0. 0 = 00000000.00000000.00000000.00000000 127.255.255.255 = 01111111.11111111.11111111.11111111 0nnnnnnn.HHHHHHHH.HHHHHHHH.HHHHHHHH Class B 128. 0. 0. 0 = 10000000.00000000.00000000.00000000 188.8.131.52 = 10111111.11111111.11111111.11111111 10nnnnnn.nnnnnnnn.HHHHHHHH.HHHHHHHH Class C 192. 0. 0. 0 = 11000000.00000000.00000000.00000000 184.108.40.206 = 11011111.11111111.11111111.11111111 110nnnnn.nnnnnnnn.nnnnnnnn.HHHHHHHH Class D 224. 0. 0. 0 = 11100000.00000000.00000000.00000000 220.127.116.11 = 11101111.11111111.11111111.11111111 1110XXXX.XXXXXXXX.XXXXXXXX.XXXXXXXX Class E 240. 0. 0. 0 = 11110000.00000000.00000000.00000000 255.255.255.255 = 11111111.11111111.11111111.11111111 1111XXXX.XXXXXXXX.XXXXXXXX.XXXXXXXX
What is loopback address?
A special IP number (127.0.0.1) that designate for the software loopback interface of a machine. The IP’s reserve for loopback are 127.0.0.0 and 127.255.255.255 and it will use for internal testing on local machines.
What is multicasting?
The need of Multicasting is to send a single message to a group of recipients. Emailing and Teleconferencing are examples of multicasting. It uses the network infrastructure and standards to send messages.
What are important configuration files in network configuration?
- # cat /etc/hostname (This file keeps the information about the hostname assigned to the system and if we want to change the hostname permanently, we need to change the hostname in this file)
# cat /etc/sysconfig/network-scripts/(This directory keeps the configuration of network devices connected to the system. Examples are ifcfg-eht0, ifcfg-eth1, ifcfg-eth2, …..etc.,)
# cat /etc/hosts(This file is responsible for resolving hostname into IP address locally. ie., local DNS if DNS server is not available)
# cat /etc/resolve.conf(This file keeps the address of the DNS server to which the clients will be accessing to resolve IP address to hostname and hostname to IP address)
How to assign the static IP address to the NIC card?
First see all the devices(NIC or interfaces) available
# nmcli device show
to show connections on the devices.
# nmcli connection show
let’s suppose ens160 is the device name and need to add connection on this device named as ens1601
# nmcli connection con-add "ens1601" ifname ens160 type ethernat
Now to assign IP address, gateway, DNS and configure the network as static or manually.
# nmcli con modify ens1601 ipv4.method manual ipv4.addresses 'ip-address/CIDR' ipv4.gateway 'gateway-ip' ipv4.dns 'DNS-ip'
If you want to use dhcp network.
# nmcli con modify ens1601 ipv4.method auto
To up the connection
# nmcli con up ens1601
To restart networking services.
# systemctl restart NetworkManager or
# nmcli networking stop && nmcli networking start
To show the connection is up or not
# nmcli networking connectivity
To enable network service (it means there is not need to restart network service after machine reboot. it makes automatically con up)
# nmcli enable NetworkManager
In this article we have discussed about IPV4 networking configuration on centos8.