Network Configuration in Linux and Troubleshooting

Photo of author
By Jay
— 9 min read
Photo of author
Written by
Photo of author
Verified by
Published On
— 9 min read

Network Configuration

1. What is Network?

A combination of two more computers connected together to share their resources with each other by means of communication like the cable is called Network.


2. What is Networking?

It is a connection between two or more computers to communicate with each other.

3. What are the basic requirements for networking?

(a) NIC (Network Interface Card or controller)

(b) Media (nothing but cables)

(c) Topology

(d) Protocol

(e) IP Addresses

4. Explain NIC cards?

A Network Interface Card or controller is a hardware component that connects a computer to a computer network. Each NIC card will be having MAC (Media Access Controller) address to avoid conflicts between the same NIC adapters. In Linux, these NIC adapter is represented by the word “eth”. For example, if two NIC cards are there in a system then it will be denoted as “etho”, “eth1”, …..etc.,

5. What is media?

Media is nothing but the cable to connect two or systems. Example: RJ 45, CAT 5 and CAT 6, ….etc.,

6. What is topology?

Topology is a design in which the computers in the network will be connected to each other. Examples of topologies are Bus, Ring, Star, Mesh, and Tree topologies.

7. What is a protocol?

A Network Protocol defines rules and conventions for communication between the network devices. Protocols generally use packet-switching techniques to send and receive messages in the form of packets. Example of protocols are TCP/IP (Transmission Control Protocol and Internet Protocol), UPD (User Datagram Protocol) and HTTP (Hyper Text Transfer Protocol), ….etc.,

8. What are the differences between TCP/IP and UDP protocols?

TCP/IPUDP
Transmission Control ProtocolUser Datagram Protocol
It is connection-orientedIt is connectionless
ReliableNon-Reliable
TCP Acknowledgement will be sent/receivedNo Acknowledgement
Slow communicationFast communication
Protocol No. for TCP is 6Protocol No. for UDP is 17
HTTP, FTP, SMTP, ….etc., uses TCPDNS, DHCP, ….etc., uses UDP

9. What is an IP address?

Every Computer will be assigned 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 :

The IP addresses are further divided into classes. The classes are A, B, C, D, and E and the ranges are given below.

Class StartEndDefault SMClessless Inter-domain routing
Class-A0.0.0.0127.255.255.255255.0.0.0/8
Class-B128.0.0.0191.255.255.255255.255.0.0/16
Class-C192.0.0.0223.255.255.255255.255.255.0/24
Class-D224.0.0.0239.255.255.255  
Class-E240.0.0.0255.255.255.255  

10. What is the loopback address?

A special IP number (127.0.0.1) is designated for the software loopback interface of a machine. 127.0.0.0 and

127.255.255.255 is also reserved for loopback and is used for internal testing on local machines.

11. What is multicasting?

Multicasting allows a single message to be sent to a group of recipients. Emailing and Teleconferencing are examples of multicasting. It uses the network infrastructure and standards to send messages.

12. What is a subnet mask?

A subnet mask allows the users to identify which part of an IP address is reserved for the network and which part is available for host use.

13. What is Gateway?

A Gateway is the network point that provides entrance into another network. On the internet a node or

stopping point can be either gateway node or a host (end point) node. Both the computers of internet users and the computer that serve the pages to users are host nodes. The computer that control traffic within your company’s network or at our local internet service provider (ISP) are the gateway nodes.


14. What are important configuration files in network configuration?

# cat /etc/sysconfig/network (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)

15. What are the differences between MAC and IP addresses?

MAC AddressIP Address
It is a permanent address. So we cannot change thisaddress.It is a temporary address. So, we can change this address any no. of times.
It stands for Media Access Control Address.Internet Protocol address.
It is a physical address.It is a logical address.
— : — : — : — : — : — (each 8 bits. So, 8 X 6 = 48 bitsIt is two types.
IPV4 :(It is divided into 4 parts )
— . — . — . —(each 8 bits. So, 8 X 4 = 32 bits
IPV6 :( It is divided into 16 parts )
— . — . — . — . — . — . — . — . — . — . — . — . —
. — . — . —(each 8 bits. So, 8 X 16 = 128 bits.
ifconfig(to see the MAC address)# ifconfig(to see the IP address)

16. How many types of NIC cards are available?

(a) eth0 (1st NIC card) (b) eth1 (2nd NIC card) (c) br0 (Bridge —–> used for communication from physical to virtual) (d) lo (loopback device name and IP address is 127.0.0.1) # ifconfig (to see all the NIC devices connected to the system)

17. How many types of cable connections are available?

(i) Cross cable (to connect two systems directly)

(ii) Straight cable (to connect more systems with the help of a switch)

To check whether the network cable is connected or not by running this command

# ethtool <device name>

Below command is also used to check the network cable but it will not supports RHEL – 7 and only supports RHEL – 6 and it works on the physical system only not on the virtual system

# miitool <device name>

18. In how many ways we can configure the network?

There are two ways to configure the network.

(a) Static Network.

(b) Dynamic Network.

Static Network :

In this way, we assign the IP address and hostname manually. Once we configure the IP address, it will not change.

Dynamic Network:

In this way, we assign the IP address and hostname dynamically. This means the IP address will change at every boot.

19. How to assign the static IP address to the NIC card?

In RHEL – 6 :

# setup
  • Move the cursor to Network configuration and press Enter key
  • Move the cursor to Device configuration and press Enter key)
  • Select the NIC adapter ie., eth0 and press Enter key)
  • Assign the above IP address and other details as per our requirements and move the cursor to “OK” and press Enter key
  • Move the cursor to “Save” to save the changes in device configuration and press Enter key
  • Once again move the cursor to the “Save and Quit” button and press Enter key)
  • Finally move the cursor to the “Quit” button and press Enter key to quit the utility
  • Then restart the network service and check for the IP address by below command
# service network restart
  • If the change is not reflected with the above service, then restart the network managerby by below command
#service NetworkManager restart

To see the IP address of the NIC card

# ifconfig

to check whether the IP is pinging or not

# ping < IP address >

In RHEL – 7 :

To see all the network connections:

# nmcli connection show

To see the network details if already configured manually or dynamically:

# nmcli device show

To add the network connection:

# nmcli connection add con-name "System eth0" ifname eth0 type ethernet

To assign the IP address, gateway, DNS, domain name and configure the network as static or manually

# nmcli connection modify "System eth0" ipv4.addresses '<IP address>/<netmask><gateway>' ipv4.dns <dns server IP address> ipv4.dns-search <domain name> ipv4.method <static or manually>

To up the connection:

# nmcli connection up "System eth0"

To restart the network service:

# systemctl restart network

To enable the network service:

# systemctl enable network

To see the IP address of the NIC card:

# ifconfig

To check whether the IP is pinging or not:

# ping <IP address>

20. What are the differences between RHEL – 6 and RHEL – 7 network configuration files?

RHEL -6RHEL – 7
/etc/sysconfig/network-scripts is the directory/etc/sysconfig/network-scripts is the directory
which contains the NIC configuration information.which contains the NIC configuration information.
/etc/sysconfig/network-scripts/ifcfg-<device name>/etc/sysconfig/network-scripts/ifcfg-<device name>
is the file which contains the NIC configuration details.is the file which contains the NIC configuration details.
/etc/resolve.conf is the file which contains DNSserver IP and domain name location./etc/resolve.conf is the file which contains DNSserver IP and domain name location.
/etc/sysconfig/network is the hostnameconfiguration file./etc/hostname is the hostname configuration file.
/etc/hosts is the file which contains the local DNSserver IP address./etc/hosts is the file which contains the local DNSserver IP address.

21. What are the differences between Dynamic and Static configuration information?

Dynamic configuration informationStatic configuration information
Device =<NIC device name>Device =<NIC device name>
HWADDR=02:8a:a6:30:45HWADDR=02:8a:a6:30:45
Bootproto=DHCPBootproto=none (means static network)
Onboot=yes (yes means whenever we restart the
system this connection will be activated and no means whenever we restart the system the connection will be deactivated)
Onboot=yes
Type=EthernetType=Ethernet
Userctl=yes/no —-> If it is yes all normal users can
disable the NIC card and If it is no except root user
nobody can disable the NIC card.
Userctl=yes/no —-> If it is yes all normal users can
disable the NIC card and If it is no except root user
nobody can disable the NIC card.

22. How to set the hostname temporarily and permanently?

RHEL – 6 :

To set the hostname temporarily:

# hostname <fully qualified domain name>

To set the hostname permanently:

# vim /etc/sysconfig/network
HOSTNAME=<fully qualified domain name>

To update the hostname in the network:

# service network restart

To enable the connection at next reboot:

# chkconfig network on

RHEL – 7 :

To set the hostname temporarily:

# hostname <fully qualified domain name>

To set the hostname permanently:

# hostnamectl set-hostname <fully qualified domain name>

To update the hostname in the network:

# systemctl restart network

To enable the connection at the next reboot:

# systemctl enable network

23. How to troubleshoot if the NIC is not working?

(a) First check whether the NIC card is present or not by # ifconfig command.

(b) If present then checks the status of the NIC card as enabled or disabled click on the System menu on the status bar, then select the Network Connections menu.

(c) Click on the IPV4 settings tab, select the device eth0 or any other, and select Enable button, then Apply and OK.

(d) Open /etc/sysconfig/network-scripts/ifcfg-eth0 file and check Userctl=yes or no. If it is yes make it no, then check Onboot= yes or no. If it is no make it as yes and save that file.

(e) If not present then check the status of the NIC card is enabled or disabled by clicking on the System menu on the status bar, then selecting the Network Connections menu.

(f) Click on IPV4 settings tab, select the device eth0 or any other and select Enable button, then Apply and OK.

In RHEL 6

Assign the IP address to the system and restart the network service and enable the service at next reboot

# setup
# service network restart
# chkconfig network on

In RHEL – 7

Assign the IP address to the system and restart the network service and enable the service at next reboot

# nmcli
# systemctl restart network
# systemctl enable network

(h) Then up the connection by

In RHEL 6

# ifconfig eth0 up

In RHEL – 7

# nmcli connection up <connection name>

(i) Even though it is not working may be the fault in NIC card. If so, contact the hardware vendor by taking permission from higher authorities.

Related Posts


About Author

Photo of author

Jay

I specialize in web development, hosting solutions, and technical support, offering a unique blend of expertise in crafting websites, troubleshooting complex server issues, and optimizing web performance. With a passion for empowering businesses and individuals online, I provide in-depth reviews, tech tutorials, and practical guides to simplify the digital landscape. My goal is to deliver clear, reliable, and insightful content that helps readers make informed decisions and enhance their online presence.

Leave a Comment