Interview Questions on Linux Networking with Answers

1. How do you perform NIC teaming?

For more details: Step by Step Guide to configure NIC Teaming in Linux

2. What is the difference between TCP and UDP protocol?

  • TCP is a connection oriented protocol and contain the information of sender as well as receiver.
  • Eg: HTTP.FTP, Telnet
  • TCP is slower than UDP due to its error checking mechanism
  • UDP protocols are connection less packets have no information to where they are going. These type of ports are generally used for broadcasting.
  • For eg: DNS, DHCP
  • UDP are faster


3. What are the benefits of NIC Teaming?

  • Fault Tolerance
  • Failover


4. Mention all the network configuration files you would check to configure your ethernet card

  • /etc/sysconfig/network-scripts/ifcfg-eth*
  • /etc/sysconfig/network
  • /etc/resolv.conf
  • /etc/nsswitch.conf


5. What is the the use of /etc/resolv.conf?

It contains the details of nameserver i.e details of your DNS server. This DNS server is used to resolve hostname with IP address. If you have configured your local DNS server then it can help resolve your local hostnames and if you are using external DNS such as from Google ( then you will be able to access internet

6. What is the use of /etc/hosts file?

To map any hostname to its relevant IP

7. What is the command to check all the open ports of your machine?

Follow the below link for more details
How to get a list of open ports in Linux?

8. What is the command to check all the listening ports and services of your machine?

# netstat -ntlp


9. How can you make a service run automatically after boot?

Enable the service to boot automatically with systemctl

# systemctl enable

To check if the service is enabled or disabled

# systemctl is-enabled


10. What are the different run levels of linux? And how can you configure your script to run only when the system boots into GUI and not to any other runlevel

  • 0 power off
  • 1 single user
  • 2 multi user without network
  • 3 multiuser with network
  • 4 development purpose
  • 5 GUI
  • 6 Restart

The legacy commands used with RHEL 6 and earlier with Sysv scripts

chkconfig --level 5 service_name on
chkconfig --level 1234 service_name off

Now with RHEL 7, we use systemd instead of sysv scripts. Learn more about the comparison and difference between traditional System V and Systemd 

11. What is a 3 way handshake protocol? Give an example of it

SYN - system 1 sends SYN signal to remote system
SYN-ACK - remote system receives the syn signal and sends ack signal
ACK - system again receives ack signal from remote system and connection is established
For Example: When you ping to a machine you are sending a SYN signal which is ACK by the remote machine then it sends a SYN ACK signal back to the host machine. Then the host machine receives SYN ACK and sends the ACK signal back to confirm the same.

12. What are the possible ways to open a port

This question is tricky and can be broken into different questions, such as:
Should I open a port in firewall?
Should I open a port using some service?
I have covered all these basic questions in detail with examples: Easy steps to open a port in Linux RHEL/CentOS 7/8

13. How to run a service as some specific user

You can use "User" and "Group" argument in your systemd unit file with the respective user which must be used to execute the service.
For more details with examples: How to run systemd service as specific user and group in Linux

14: What are the different possible ways to configure network in Linux?

There are many ways to configure network, you can choose based on your preference and requirement


15. What is network bridge? How do we configure a bridged network?

A network bridge is a Link Layer device which forwards traffic between networks based on MAC addresses and is therefore also refer to as a Layer 2 device. Bridge networking (also known as network bridging or virtual network switching) will place virtual machine network interfaces on the same network as the physical interface.
For more details: How to create or configure network bridge in CentOS / RHEL 7/8
For more interview questions
Interview Questions with Answers