Search This Blog

Thursday 18 April 2019

Network Configuration and Troubleshooting


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.,                DNS, DHCP, ....etc.,   

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.

Class Start End                         Default Subnet mask          Classless Inter Domain                                                                                                                                   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

10. What is 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 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  Address                                                                                   IP  Address  
It is a permanent address.
So we cannot change this address.                                              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.  
It is divided into 6 parts.
                                                                                                   It is two types.
                                                                                                         IPV4 :(It is divided into 4 parts )
                                                                                                         IPV6 : ( It is divided into 16 parts )
 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 which contains the NIC configuration information.
/etc/sysconfig/network-scripts    is the directory which contains the NIC configuration information.  
/etc/sysconfig/network-scripts/ifcfg-<device name>is the file which contains the NIC configuration details.
/etc/sysconfig/network-scripts/ifcfg-<device name>is the file which contains the NIC configuration details.  
/etc/resolve.conf  is the file which contains DNS server IP  and  domain name location.
/etc/resolve.conf  is the file which contains DNS server IP  and  domain name location.  
/etc/sysconfig/network     is the hostname configuration file.
/etc/hostname    is the hostname   configuration file.  
/etc/hosts  is the file which contains the local DNS server IP address.
/etc/hosts      is the file which contains the local DNS server IP address.  

22. How to set the hostname temporarily and permanently?
RHEL - 6 :
# hostname    <fully qualified domain name> (to set the hostname temporarily)
# vim   /etc/sysconfig/network         (to set the hostname permanently)
   HOSTNAME=<fully qualified domain name>
   (save and exit this file)
# service network restart                  (to update the hostname in the network)
# chkconfig  network on                  (to enable the connection at next reboot)

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 # 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.

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.

Other  useful  commands :
# ping  <IP address  or  hostname> (to check the pinging)
Normally the ping command pings continuously until a stop signal reaches by  Ctrl + c, so to              avoid continuous pinging by
# ping  -c  <number><IP address> (to ping upto the specified no of times)
# ipcalc   -m   <IP address) (to find the subnet mask for that specified IP                                                                                              address)
Normally IP addresses are assigned by  ISP (Internet Service Provider)  and  managed by                     IANA   (Internet Assign Number Authority)
# ifconfig (to see or check all the NIC device names  and IP  addresses)
# ethtool    <NIC device name> (to check the network cable is connected or not)
# miitool <NIC device name> (It is also used to check the network cable but it                                                                                       works on physical system not on virtual system                                                                                       and supports  in RHEL - 6 only)
# ip addr  show (to show all NIC devices present on the system)
# hostname (to see the hostname with fully qualified domain name)
# hostname  -i (to see the IP address of the system)
# hostname  -d (to check the domain name of the system)
# hostname  -s (to check the hostname without domain name)
# netstat  -r (to check the default gateway and routing table)
# route (to check the default gateway with routing table)
# ip route (to display the NIC device with default gateway)
# dig   or   # host   or   #nslookup (all are used to resolve the name to IP and IP to name)
# nslookup   <IP address> (to resolve IP to name)
# nslookup  <hostname> (to resolve name to IP)
# host   <IP address> (to resolve IP to name)
# host   <fully qualified domain name> (to resolve name to IP address)
# dig  -x   <IP address> (to resolve IP address to name)
# dig   <fully qualified domain name> (to resolve name to IP address)
# nmcli (Network Manager Command Line Interface used to configure the network setup in RHEL - 7)
# setup (to setup the static network in RHEL - 2, 3, 4, 5 and 6)
# nmtui (to setup the static network in GUI mode for RHEL - 7)
# nmcli device show (It displays all the NIC devices network information of the                                                                         system )
# nmcli device show eth0 (to see all the network devices information of the eth0)
# nmcli connection  or nmcli connection show (to see all the network connection names)
# nmcli connection add con-name  <connection name>  ifname  <NIC device name>  type                                                ethernet(to create a new connection name for eth0)
# nmcli connection show  --activate (it shows which connection is active currently)
# nmcli connection add con-name   <connection name>   ifname   <NIC device name>   type                                            ethernet(to add a connection name to NIC device)
# nmcli connection modify  <connection name>  ipv4.addresses  ' <IP address>/<netmask>                     <default gateway> ' ipv4.dns   <dns server IP address>  ipv4.dsn-search   <domain name>                    ipv4.method   <static/manual>
    (to modify the connection as static and assign the IP, gateway, dns IP, domain name)
# nmcli connection delete   <connection name> (to delete the specified connection)
# nmcli connection modify  <connection name>  ipv4.method  <static/manual>
               (to modify dynamic connection to static connection)
# nmcli connection up  <connection name> (to activate  or  up the specified connection)
# nmcli connection down  <connection name> (to disable or down the specified connection)
# nmcli connection show   <connection name> (to see the information about the specified                                                                                                  NIC device)
# ping   -I <NIC  device name><IP address> (to check the connection from NIC device to IP                                                                                          address)
# hostname    <fully qualified domain name> (to set the hostname temporarily)
# hostnamectl   set-hostname   <fully qualified domain name>       (to set the hostname                                                                                                                         permanently in RHEL - 7)

# nmcli connection reload     (to reload the configuration of the connection if any changes on                                                                 it and it reloads all configuration files)
# nmcli connection reload   /etc/sysconfig/network-scripts/ifcfg-<NIC device name>         
                                                              (to reload a single file)
# hostnamectl  status (it displays full details of the hostname and works in RHEL - 7 only)
# nmcli networking off (to disable all the connections at a time)
# nmcli device status (to display all NIC device connections statuses)
# nmcli connection modify  <connection name>  +  ipv4.dns  <secondary dns server IP>
                                                    (to add a secondary dns server IP to the existing connection)
# netstat   -ntulp      (to check how many open ports are there in local system)
# ss   -ntulp ( " " )
# nmap (to check how many open ports are there in remote system)
# tracepath (it displays the routing information)
# miitool   <NIC device name> (to check the network cable is connected or not)
# ethtool <NIC device name> ( " " )
# ifconfig (to check the NIC card is enable or not)
# ifup   <NIC  device name> (to enable or up the NIC card)
#ifdown   <NIC device name> (to disable or down the NIC card)
# route  -n (to check the gateway)
# cat  /etc/resolve.conf (to check the dns server information)
# cat  /etc/sysconfig/network-scripts/ifcfg-<NIC device name>
                                                                          (to  see the NIC device information)
# hostname   or  cat  /etc/sysconfig/network (to check the hostname in RHEL - 6)
# hostnamectl  status   or   cat  /etc/hostname (to check the hostname in RHEL - 7)
# ping   <IP address> (to check the connection communication)
# chkconfig    --list (to list all the services which are running at boo time in RHEL - 6 & 7)
# systemctl   list-unit-files(to list all the processes which are running at boot time in RHEL - 7)
# chkconfig    --level   <service name>(it will set the service at run level 3 when the system is                                                                                booting)
# service   --status-all (to see the list of all the processes which are currently running)
# ls  /etc/init.d (is the location of all the services and deamons  in RHEL - 6)
# ls  /usr/lib/systemd/system (is the location of all the services and deamons  in RHEL - 7)
#  /etc/rc.local (is the last script to be run when the system is booting)
                                        (If we enter as   sshd    stop  at the last line of the script file then                                                              sshd   will be stopped even though that sshd  is enabled)
# service sshd status (to check the sshd status)
# service   --service -all (to see the process  ID  of all the services)
# netstat   -ntulp (to see all the services with port no., status, process  ID and                                                                      all open ports in local system, routing table and NIC device                                                                    information)
-n   ----->   port no.  (numeric  no) -t   ----->tcp protocol
-u   ----->   upd protocol -l    ----->   port  is listening or not
-p   ----->   display the process  ID
# netstat    -r (to see all routing table information)
# netstat    -i (to see all the NIC cards information)
# nmap (to see the network mapping  ie.,  open ports list on remote                                                                       system)

No comments:

Post a Comment