Monday, October 17, 2016

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.,  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.
                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.
--- : --- : --- : --- : --- : ---  (each 8 bits. So, 8 X 6 = 48 bits
It 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 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                     (to check the network cable is connected or not)
                # miitool                      (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                                  (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-    is the file which contains the NIC configuration details.
/etc/sysconfig/network-scripts/ifcfg-    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.

21.          What are the differences between Dynamic and Static configuration information?
Dynamic configuration information
Static configuration information
Device =
Device =
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  means whenever  we restart the system the connection will be deactivated)
Onboot=yes
Type=Ethernet
Type=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 :
                # hostname    (to set the hostname temporarily)
                # vim   /etc/sysconfig/network                                           (to set the hostname permanently)
                   HOSTNAME=
                   (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                                    (to set the hostname temporarily)
                # hostnamectl  set-hostname     (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                              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=
                                TYPE=ethernet
                                NETMASK=255.225.225.0 or
                                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 :
                                   Netmask : 255.255.255.0
                                   Default gateway :                      (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  /  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  
                (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
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    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       command. if                 connected then check the IP address is assigned or not by  # ifconfig       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                                     (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                                       (to ping upto the specified no of times)
                # ipcalc   -m  
                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                                              (to check the network cable is connected or not)
                # miitool                                               (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                                                      (to resolve IP to name)
                # nslookup                                                      (to resolve name to IP)
                # host                                                              (to resolve IP to name)
                # host                              (to resolve name to IP address)
                # dig  -x                                                           (to resolve IP address to name)
                # dig                                (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    ifname    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      ifname      type  ethernet
                                                                                                                                (to add a connection name to NIC device)
                # nmcli connection modify    ipv4.addresses  ' / '    
            ipv4.dns     ipv4.dsn-search      ipv4.method  
                                                                (to modify the connection as static and assign the IP, gateway, dns IP, domain name)
                # nmcli connection delete                (to delete the specified connection)
                # nmcli connection modify    ipv4.method    (to modify dynamic connection                                                                                                                                                                                            to static connection)
                # nmcli connection up                      (to activate  or  up the specified connection)
                # nmcli connection down                 (to disable or down the specified connection)
                # nmcli connection show                  (to see the information about the specified NIC device)
                # ping   -I      (to check the connection from NIC device to IP address)
                # hostname    (to set the hostname temporarily)
                # hostnamectl   set-hostname          (to set the hostname permanently in RHEL - 7)
                NOTEWhenever we change any parameters in   /etc/sysconfig/network-scripts/ifcfg-   file, then we have to reload that file and again we have to up the connection  (nothing but activate the connection by   # nmcli  connection  reload    command.
                # 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-           (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    +  ipv4.dns          (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                                               (to check the network cable is connected or not)
                # ethtool                                                              (                               "                              "                              )
                # ifconfig                                                                                               (to check the NIC card is enable or not)
                # ifup                                                                   (to enable or up the NIC card)
                #ifdown                                                (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-    (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                                                              (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                  (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)
                Note :  By default this command will not available. So, first install the  nmap  package  by  # you install nmap -y
                # nmap      (to see all the services which are running in the specified remote system)
                # nmap    (to see the running services on specified remote systems)
                # nmap    172.25.0.11 - 50                                 (to see the running service on 172.25.0.11  to  172.25.0.50 systems)
                # nmap    -p    80             (to see the http port is running or not on specified remote system)
                # nmap    -p   80 - 90      (to see port no's  80  to  90  are running or not on remote systems)
                # nmap   -sp   172.25.0.0/24             (to see all the systems which are in upstate ie., 172.25.0.1, 172.25.0.2,      
              (where  s -- scan  &  p -- ping)                                                                 172.25.0.3, ......upto   172.25.0.254 systems)
                Open a file, write all the systems IP addresses, save & exit the file. Example has given below,
                # vim   coss
                                172.25.2.50
                                172.25.3.50
                                172.25.4.50  ....etc.,   (save and exit this file)
                # nmap    -iL   coss                        (to scan all the IP addresses by reading the coss file)(where   -i  ---->  input,  -L  ---->   list)
                # nmap    --iflist                                    (to see all the routing table information in the network)
                # nmap   172.25.0.10 - 20    --exclude   172.25.0.15     (to scan all the systems from  172.25.0.10  to  172.25.0.20                                                                                                                                systems  and  excluding  172.25.0.15  system)
                # nmcli connection show  --active                      (to control the network connections)
                # ip link                                                                  (to check the network connection)

                # ping   -I   eth1                              (to check the 2nd NIC card connection)

No comments:

Linux, CCNA and MCSE Questions: User Managment

Linux, CCNA and MCSE Questions: User Managment