4.Network Configuration and Trouble Shooting
4.Network Configuration and Trouble Shooting
1. What is Network?
Combination of two more computers connected together to share their resources each other by
means of communication like 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 about NIC card?
A Network Interface Card or controller is 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 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 "eho","eth1", .....etc.,
5. What is media?
Media is nothing but 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 network will be connected to each other.
Example for topologies are Bus, Ring, Star, Mesh, Tree topologies.
7. What is protocol?
A Network Protocol defines rules and conventions for communication between the network
devices. Protocols are generally use packet switching techniques to send and receive messages in
the form of packets.
Example for 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/IP UDP
Transmission Control Protocol User Datagram Protocol
It is connection oriented It is connection less
Reliable Non-Reliable
TCP Acknowledgement will be sent / received No Acknowledgement
Slow communication Fast communication
Protocol No. for TCP is 6 Protocol No. for UDP is 17
HTTP, FTP, SMTP, ....etc., uses TCP DNS, 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, E and the ranges are
given below.
Classless Inter Domain
Start End Default Subnet mask
Class Routing
Class A 0.0.0.0 127.255.255.255 255.0.0.0 /8
Class B 128.0.0.0 191.255.255.255 255.255.0.0 /16
Class C 192.0.0.0 223.255.255.255 255.255.255.0 /24
Class D 224.0.0.0 239.255.255.255
Class E 240.0.0.0 255.255.255.255
ifconfig (to see the MAC address) # ifconfig (to see the IP address)
16. How many types of NIC cards 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 available?
(i) Cross cable (to connect two systems directly)
(ii) Straight cable (to connect more systems with the help of switch)
# ethtool <device name> (to check the network cable is connected or not)
# miitool <device name> (It is also used to check the network cable but it will not
supports RHEL - 7 and only supports RHEL - 6 and it also works on physical
system only not on virtual system)
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 "Save & Quit" button and press Enter key)
(Finally move the cursor to "Quit" button and press Enter key to quit the utility)
(Then restart the network service and check for the IP address by # service network restart
command)
(If the change is not reflected with the above service, then restart the network manager by
# service NetworkManager
restart command)
# ifconfig (to see the IP address of the NIC card)
# ping < IP address > (to check whether the IP is pinging or not)
In RHEL - 7 :
# nmcli connection show (to see all the network connections)
# nmcli device show (to see the network details if already configured manually or
dynamically)
# nmcli connection add con-name "System eth0" ifname eth0 type ethernet (to add the
network connection)
# 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 assign IP address, gateway, dns, domain name and
configure the network as static or manually)
# nmcli connection up "System eth0" (to up the connection)
# systemctl restart network (to restart the network service)
# systemctl enable network (to enable the network service)
# ifconfig (to see the IP address of the NIC card)
# ping < IP address > (to check whether the IP is pinging or not)
20. What are the differences between RHEL - 6 and RHEL - 7 network configuration files?
RHEL – 6 RHEL - 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 DNS /etc/resolve.conf is the file which contains DNS
server IP and domain name location. server IP and domain name location.
/etc/sysconfig/network is the hostname
/etc/hostname is the hostname configuration file.
configuration file.
/etc/hosts is the file which contains the local DNS /etc/hosts is the file which contains the local DNS
server IP address. server IP address.
21. What are the differences between Dynamic and Static configuration information?
Dynamic configuration information Static configuration information
Device =<NIC device name> Device =<NIC device name>
HWADDR=02:8a:a6:30:45 HWADDR=02:8a:a6:30:45
Bootproto=DHCP Bootproto=none (means static network)
Onboot=yes (yes means whenever we restart the
system this connection will be activated and no
Onboot=yes
means whenever we restart the system the
connection will be deactivated)
Type=Ethernet Type=Ethernet
Userctl=yes/no ----> If it is yes all normal users can Userctl=yes/no ----> If it is yes all normal users can
disable the NIC card and If it is no except root user disable the NIC card and If it is no except root user
nobody can disable the NIC card. nobody can disable the NIC card.
RHEL - 7 :
# hostname <fully qualified domain name> (to set the hostname
temporarily)
# hostnamectl set-hostname <fully qualified domain name> (to set the hostname
permanently)
# systemctl restart network (to update the hostname in the
network)
# systemctl enable network (to enable the connection at
next reboot)
23. How to troubleshoot if the NIC is notworking?
(a) First check the NIC card is present or not by # ifconfig command.
(b) If present thencheck the status of the NIC card is enabled or disabledby click on System
menu on the status bar, then select Network Connections menu.
(c) Click on 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 check Userctl=yes or no. If it is yes
make it as no, then check Onboot= yes or no. If it is no make it as yes and save that file.
(e) If not present thencheck the status of the NIC card is enabled or disabled by click on System
menu on the status bar, then select Network Connections menu.
(f) Click on IPV4 settings tab, select the device eth0 or any other and select Enable button, then
Apply and OK.
(g) Using # setup (in RHEL - 6) or # nmcli (in RHEL - 7) commands assign the IP address to
the system and restart the network service by # service network restart (in RHEL - 6) or #
systemctl restart network (in RHEL - 7) commands and enable the service at next reboot by
# chkconfig network on (in RHEL - 6) or # systemctl enable network (in RHEL - 7)
commands.
(h) Then up the connection by # ifconfig eth0 up (in RHEL - 6) or # nmcli connection up
<connection name> commands.
(i) Even though it is not working may be the fault in NIC card. If so, contact the hardware vendor
by taking the permissions from higher authorities.
24. What is bonding and how to configure bonding? (from RHEL - 6)
What is link aggregation or bridging or teaming and how to configure teaming? (from RHEL - 7)
Bonding or Teaming or Bridging:
Collection of multiple NIC cards and make them as single connection (virtual) NIC card is called
bonding.
It is nothing but backup of NIC cards.
In RHEL - 6 it is called as Bonding or Bridging.
In RHEL - 7 it is called as Teaming or Link aggregation.
There are 3 types of backup in Bonding or Teaming.
(a) Mode 0 -----> Round Robbin
(b) Mode 1 -----> Activebackup
(c) Mode 3 -----> Broadcasting
Mode 0 :
It provides load balancing and fault tolerance.
Data will be shared by both NIC cards in round robbin.
If one NIC card failed then another NIC card will be activated to communicate with the server
So, there is a load balancing and fault tolerance features.
Mode 1 :
Activebackup means only one NIC card is activated at a time and another one is in down state.
So, there is no load balancing.
But if one NIC card is failed then another NIC card will be activated automatically.
Mode 3 :
In this mode broadcasting is done.
In this the same data will be transferred through two NIC cards.
So there is no load balancing.
But if one NIC card is failed then second NIC card will be activated automatically.
So, all the 3 modes are supports only fault tolerance, but round robbin is the only one mode that
provides load balancing.
Requirements to configure :
(i) Minimum two NIC cards.
(ii) One IP address.
(iii) Connection type is bond (in RHEL - 6) and team (in RHEL - 7) not the ethernet type.
Here no need to assign the IP addresses for two NIC cards and we are giving only one IP
address to bond or team.
Bonding configuration : (in RHEL - 6)
(i) # vim /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
IP ADDR=<IP address>
TYPE=ethernet
NETMASK=255.225.225.0 or <IP address class netmask>
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=yes
BONDING_OPTS="mode0 or mode1 or mode3 miimon=50" (Save and exit
this file)
(ii) vim /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes (Save and exit this file)
(iii) vim /etc/sysconfig/network-scripts/ifcfg-eth2
DEVICE=eth2
ONBOOT=yes
BOOTPROTO=none
USERCTL=no
MASTER=bond0
SLAVE=yes (Save and exit this file)
(iv) To add virtual NIC cards eth1 and eth2 :
# setup -----> Networking -----> Device configuration -----> New Device ----->
eth1
Name : eth1
Device : eth1 (save and exit this setup)
# setup -----> Networking -----> Device configuration -----> New Device ----->
eth2
Name : eth2
Device : eth2 (save and exit this setup)
(v) Adding bond0 connection :
# setup -----> Networking -----> Device configuration -----> New Device ----->
bond0
Name : bond0
Device : bond0
IP address : <IP address>
Netmask : 255.255.255.0
Default gateway : <gateway IP address> (save and exit this setup)
# ifdown bond0
# ifdown eth1
# ifdown eth2
# ifup bond0
# service NetworkManager stop
# service network restart
# chkconfig network on
# service NetworkManager restart
# cat /proc/net/bonding/bond0 (to check the bonding
information)
# watch -n 1 cat /proc/net/bonding/bond0 (to check the bonding information for
every 1 minute)
# echo "eth1" > /sys/devices/virtual/net/bond0/bonding/active_slave (to put the
eth1 NIC in active state)
Teaming configuration :
(i) Add the team0 connection by
# nmcli connection add con-name team0 ifname team0 type team
config ' { "runner" : { "name" : "roundrobbin" or "activebackup" or
"broadcasting" }} '
(ii) Add the two NIC cards one by one to the above created connection by
# nmcli connection add con-name port1 ifname eth1 type team-slave master
team0
# nmcli connection add con-name port2 ifname eth2 type team-slave master
team0
(iii) Assign the static IP address to the team0 connection by
#nmcli connection modify team0 ipv4.addresses <IP address>/<netmask>
ipv4.method static
(iv) Up the connection by
# nmcli connection up team0
(v) To see the team0 connection up details by
# teamdctl team0 state
(vi) To check the connection communication by
# ping -I team0 <IP address>
(vii) To down the one NIC card in team0 by
# nmcli connection down port1
(viii) teamdctl team0 state (to check the team0 NIC card up or down details)
25. 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.
Example : 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 example : DNS, DHCP
UDP are faster
26. What are the benefits of NIC Teaming?
(i) Load balancing
(ii) Fault Tolerance
(iii) Failover
27. Mention all the network configuration files you would check to configure your ethernet card?
(i) /etc/sysconfig/network-scripts/ifcfg-eth*
(ii) /etc/sysconfig/network
(iii) /etc/resolve.conf
(iv) /etc/nsswitch.conf
28. What is the use of /etc/resolve.conf?
It contains the details of nameserver, i.e., details of your DNS server which helps us connect to
Internet.
29. What is the use of /etc/hosts file?
To map any hostname to its relevant IP address.
30. What is the command to check all the open ports of your machine?
#nmap localhost
31. What is the command to check all the open ports of remote machine?
# nmap <IP address or hostname of the remote system>
32. What is the command to check all the listening ports and services of your machine?
# netstat -ntulp
33. How can you make a service run automatically after boot?
# chkconfig <service name> on
34. What are the 6 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
# chkconfig --level 5 service_name on
# chkconfig --level 1234 service_name off
35. 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.
36. What are the possible ways to check if your system is listening to port 67?
# nmap localhost | grep 67
# netstat -ntulp | grep 67
37. Explain about IPV6?
It's length is 128 bits. It's netmask is 64
# nmcli connection modify "System eth0" ipv6.addresses 2005:db8:0:1::a00:1/64 ipv6.method
static
(to add the IPV6 version of IP address to the
connection "System eth0" )
# nmcli connection modify "System eth0" ipv4.addresses '172.25.5.11/24 172.25.5.254'
ipv4.dns
172.25.254.254 ipv4.dns-search example.com ipv4.method static ipv6. addresses
2005:ac18::45/64
ipv6.method static (to assign ipv4 and ipv6 IP addresses to "System eth0
connection)
# nmcli connection down "System eth0" (to down the "System eth0" connection)
# nmcli connection up "System eth0" (to up the "System eth0" connection)
38. How to troubleshoot if the network is not reaching?
(i) First check the network cable is connected or not by # ethtool <NIC device name>
command. if connected then check the IP address is assigned or not by # ifconfig <NIC device
name> command.
(ii) Then check the system uptime by # uptime command.
(iii) Then check the network services status by # service network status and # service
NetworkManager status commands.
(iv) Then check the network service at Run Level by # Chkconfig --list network
command.
(v) Then check whether the source network and destination network are in the same
domain or not.
(v) Then finally check the routing table by # route -n command.