Linux Training : Section 7 (Part-1)

Table of contents
Network Components
To check the internet is working in Linux machine or not use: ping www.google.com
Some Important Terminologies
IP
- An IP address (Internet Protocol Address) is a unique number assigned to every device connected to the Internet . This is a numerical label. An IP address is used to identify devices on a network.
Subnet Mask
A Subnet mask is a 32-bit number that masks an IP address, and divides the IP address into network address and host address. Subnet Mask is made by setting network bits to all “1“s and setting host bits to all “0“s.
Gateway
A gateway is a network node that connects two networks with different protocols. It's a hardware device or software program that acts as a bridge between networks.
Static vs DHCP
- A "static IP address" is a fixed, permanent IP address manually assigned to a device, while a "DHCP IP address" is a dynamic IP address automatically assigned by a DHCP server on a network, meaning it can change when a device connects or disconnects; essentially, a static IP stays the same, while a DHCP IP can vary depending on the network connection.
Interface MAC
A MAC address, or Media Access Control address, is a unique identifier for a device that's connected to a network. It's a 12-digit hexadecimal number that's usually found on a device's network interface card (NIC).
Network File and Commands
Interface Configuration files
/etc/nsswitch.conf
/etc/hostname
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-nic
/etc/resolv.conf
Network Commands
ping
- The Linux ping command is a network utility used to test a host's reachability on an Internet Protocol (IP) network.ifconfig
ORip a
- The ifconfig command in Linux is used to manage and view network interface configuration information. It can be used to assign IP addresses, enable or disable interfaces, and more.ifup
orifdown
- The ifup and ifdown commands are used to activate and deactivate network interfaces in Linux.netstat
- The network statistics ( netstat ) command is a networking tool used for troubleshooting and configuration, that can also serve as a monitoring tool for connections over the network. Both incoming and outgoing connections, routing tables, port listening, and usage statistics are common uses for this command.tcpdump
- Tcpdump is a command-line utility that allows you to capture and analyze network traffic going through your system.
NIC Information
The full form of NIC is Network Interface Card » CMD: ethtool enp0s3
Other NICs:
lo
= The loopback device is a special interface that your computer uses to communicate with itself. It is used mainly for diagnostics and troubleshooting, and to connect to servers running on the local machine.
virb0
= The virbr0, or “Virtual Bridge 0“ interface is used for NAT (Network Address Translation). Virtual environments sometimes use it to connect to the outside network.
NIC Bonding
NIC(Network Interface Card) bonding is also known as Network Bonding. It can be defined as the aggregation or combination of multiple NIC into a single bond interface. OR Network bonding is a method of combining or joining two or more network interfaces into a single interface.
It’s main purpose is to provide high availability and redundancy.
NIC Bonding Procedure
Using network adapter setting we’ve added one more network as bridge adapter-
modprobe
bondingmodinfo
bondingas per description, we can say that driver is installed
Create
etc/sysconfig/network-scripts/ifcfg-bond0
Edit
etc/sysconfig/network-scripts/ethernet1
Edit
etc/sysconfig/network-scripts/ethernet2
Restart network =
systemctl restart network
NOTE: Since, network-scripts location is not present, due to this the hands-on were pending.
New Network Utilities
Getting started with NetworkManager
NetworkManager is a service that provides set of tools designed specifically to make it easier to manage the networking configuration on Linux systems and is the default network management service on RHEL9 or RHEL10
It makes network management easier
It provides easy setup of connection to the user
NetworkManager offers management through different tools such as GUI, nmtui and nmcli
Network configuration methods
nmtui
Short for network manager cmd line interface. This tool is useful when access to a graphical environment is not available and can also be used within scripts to make network configuration changes.
nmcli
- Short for network manager text user interface. This tool can be run within any terminal window and allows change to be made by making menu selections and entering data.
nm-connection-editor
- A full graphical management tool providing access to most of the NetworkManager configuration options. It can only be accessed through the desktop or console.
GNOME Settings
- The network screen of the GNOME desktop settings application allows basic network management tasks to be performed.
Hands-On:
Using
nmtui
, we’ve deleted the existing connection-Once, the connection is deleted, the open windows cmd terminal of Linux will also get frizzed.
Now, let’s create a connection using » nmtui » Edit a connection » Add » Team » Add the ports -
NOTE: Since, not able to see the team in this cmd ,due to this the hands-on were pending.
Using nmcli
to configure static IP
Adding secondary statis IP using nmcli
nm-connection-editor
Download Files or Apps
Command =
wget <link>
- wget is the non-interactive network downloader which is used to download files from the server even when the user has not logged on to the system and it can work in the background without hindering the current process.
curl & ping Commands
curl command - let’s say, we want to check for any website then we can use this cmd, it will provide the details in a very depth manner.
To down any package use -o option-
curl -o [URL]
ping command - to check for the site is up or not, it will just give you the basic details like IP address-
Ping: To test if a server is reachable and measure latency. CURL: To fetch data from a URL or test an API.
The ss Command
The
ss
command in Linux is a command-line tool that displays information about network sockets and connections. It's short for "socket statistics".It displays open connections » Find problems » Fix problems
TCP (Transmission Control Protocol) -
It is a set of rules that ensures data is sent successfully between 2 computers over the internet.
We use it in» Web Browsing, Email, File Transfers
UDP (User Datagram Protocol) -
It is a way for sending data over the internet without checking if it arrives correctly.
Does not wait for acknowledgments
Faster, but less reliable
Usage» Live video streaming
UNIX -
It is a way for programs on the same computer to talk to each other
Uses a special file for message exchange
Used in databses, web servers, and local system services without internet
Commands-
ss
» Full detailsss -t
» Display TCP socketsss -u
» Display UDP socketsss -x
» Display UNIX socketsss -l
» Display only listening sockets (these are omitted by default)
Subscribe to my newsletter
Read articles from Aditya Dev Shrivastava directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
