Tuesday, 4 October 2016

Scenarios Based Q&A

Scenario 1:
========


Refer the above diagram.
Scenario Two PC’s are connected to a switch. PC1 (192.168.1.2) is connected to port 2 on the switch and PC2 (192.168.1.3) is connected to port 3 on the switch

Questions
1. Does the switch need an IP address for PC1 to communicate with PC2
2. What would be the mac-address learned by the switch on port 2
3. If the PC on port is disconnected, would the mac-address table be flushed
4. If PC1 requires to communicate with PC2, what is required from PC2
5. Is a router required for PC1 to communicate with PC2
6. In the above diagram, how many mac-addresses would be available in the mac-address table of the switch after PC1 communicates with PC2.
7. What should be the value of default gateway on the TCP/IP adapter settings on the respective PC’s for communication between them to be successfully?

Answers
1. An IP address is not required. The PC’s are both on the same network and can communicate directly.
2. The mac-address of PC1 would be learnt by the switch on port 2
3. The mac-address table would not be flushed. The mac-address entry corresponding to the specific port would be removed
4. PC1 needs to know the mac-address of PC2 to construct the frame and send the data. For this , PC1 sends an ARP request to PC2.
5. Both the PC’s are on the same network. So a router is not required.
6. The mac-addresses of PC1 and PC2 would be available on both the switches.
7. A default gateway is not required for communication to be successfully since both the PC’s are on the same network


Scenario 2:
========


IP address of PC1 – 192.168.1.1/24
IP address of PC2 – 192.168.1.2/24
IP address of PC3 – 192.168.2.1/24
PC1, PC2 and PC3 are connected to port 2, port 3 and port 4 on the switch. Port 2, Port 3 and Port 4 are members of VLAN 2.

Questions:
1. If PC1 pings PC3, will a response be received.
2. If an ARP Packet intended for PC2 is initiated by PC1, will it reach PC3.
3. Can PC1 ping PC2 without a default gateway configured on it’s TCP IP adapter settings.
4. If Port 3 is made a member of VLAN 3 would PC1 be able to ping PC2.

Answers:
1. Although PC1 and PC2 reside on the same VLAN, the IP networks are different . So a response would not be received.
2. All the devices are on the same VLAN , which is the same broadcast domain. ARP is a Layer 2 broadcast. So the ARP packet will also reach PC3.
3. PC1 and PC2 reside on the same IP network as well as on the same VLAN. So a default gateway would not be required.
4. When port 3 is made a member of VLAN 3, PC1 would be unable to ping PC2 although they reside on the same IP Network. This is because , to communicate between VLAN’s , a layer 3 or gateway device would be required.

Scenario 3:
========

Scenario User 1 and User 2 is connected to the internet. User 1 is located in India and User 2 is located in Kenya. The Web Server is located in US and the DNS Server in Singapore.

Questions:
1. User 1 types www.tcpipguru.com on the browser window. What would be the destination port number when the DNS request is sent to the DNS Server by user 1.
2. User 2 pings www.tcpipguru.com. Is the DNS Server required for the ping to be successful.
3. What has to be established before HTTP data can be sent or received from user 1 to the Web Server.
4. User 1 and User 2 simultaneously types www.tcpipguru.com on the browser of the respective computers. How does the server differentiate between the connections.
5. Will the communication be disrupted between the Web Server and the users if the DNS Server goes down during the data transfer between the web server and the user.
6. User 1 opens two instances of the website www.tcpipguru.com on his computer. How does the Web Server differentiate between the communication.

Answers:
1. DNS works on UDP port 53. The DNS request would be sent to UDP port 53 on the DNS server.
2. For ping to be successful, the name www.tcpipguru.com has to be resolved into an IP address for which a DNS Server is required.
3. User1′s computer has to establish a TCP 3 way handshake between the client and the sever before data can be sent or received.
4. The server differentiates the connection based on the tcp source port numbers and source IP address in the incoming packet.
5. The DNS server is required only for retrieving the IP address associated with a name. Once the IP address is retrieved, the DNS server is not required, until the next time the user tries to access the website and the information is not available in the local DNS cache of the computer.
6. The tcp source port numbers for both the connections would be different based on which the server would differentiate the connections.

Scenario 4:
========
What port does ping use !!


The article explains the reason as to why there are not ports associated with ping.
In the above diagram , there are two PC’s , PC1 and PC2. When PC1 initiates a ping to PC2, the ping packet is constructed on PC1. The source IP address of the IP header carrying the ping packet would be PC1′s IP address and destination IP address is that of PC2.

Ping uses ICMP at the network layer for communication. Ping does not use any transport layer protocols like TCP or UDP. It is a protocol which does not have a TCP or UDP header. ICMP does not use any port numbers unlike applications which use TCP or UDP. ICMP uses sequence numbers for tracking ICMP packets.
When PC1 pings PC2, the ICMP header generated by PC1 would contain sequence number, which would be used to track the packet. So when PC2 generates the response , the sequence number would be used and not port numbers.


How ICMP Redirect Messages Work?

ICMP redirect messages are used by routers to notify the hosts on the data link that a better route is available for a particular destination.

 For example, the two routers R1 and R2 are connected to the same Ethernet segment as Host H. The default gateway for Host H is configured to use router R1. Host H sends a packet to router R1 to reach the destination on Remote Branch office Host 10.1.1.1. Router R1, after it consults its routing table, finds that the next-hop to reach Host 10.1.1.1 is router R2. Now router R1 must forward the packet out the same Ethernet interface on which it was received. Router R1 forwards the packet to router R2 and also sends an ICMP redirect message to Host H. This informs the host that the best route to reach Host 10.1.1.1 is by way of router R2. Host H then forwards all the subsequent packets destined for Host 10.1.1.1 to router R2.





























This debug message shows router R1, as in the network diagram, sending an ICMP redirect message to Host H (172.16.1.1).

R1#
debug ip icmp


ICMP packet debugging is on

*Mar 18 06:28:54: ICMP:redirect sent to 172.16.1.1 for dest 10.1.1.1, use gw 172.16.1.200

R1#
Router R1 (172.16.1.100) sends a redirect to Host H (172.16.1.1) to use router R2 (172.16.1.200) as the gateway to reach the destination 10.1.1.1.

When Are ICMP Redirects Sent?

Cisco routers send ICMP redirects when all of these conditions are met:

The interface on which the packet comes into the router is the same interface on which the packet gets routed out.

The subnet or network of the source IP address is on the same subnet or network of the next-hop IP address of the routed packet.

The datagram is not source-routed.

The kernel is configured to send redirects. (By default, Cisco routers send ICMP redirects. The interface subcommand no ip redirects can be used to disable ICMP redirects.)

Note: ICMP redirects are disabled by default if Hot Standby Router Protocol (HSRP) is configured on the interface. In Cisco IOS Software Release 12.1(3)T and later, ICMP Redirect is allowed to be enabled on interfaces configured with HSRP. For more information, refer to HSRP Support for ICMP Redirects section of Hot Standby Router Protocol Features and Functionality.

For example, if a router has two IP addresses on one of its interfaces:

  interface ethernet 0

  ip address 171.68.179.1 255.255.255.0

  ip address 171.68.254.1 255.255.255.0 secondary
If the router receives a packet that is sourced from a host in the subnet 171.68.179.0 and destined to a host in the subnet 171.68.254.0, the router does not send an ICMP redirect because only the first condition is met, not the second.



The original packet for which the router sends a redirect still gets routed to the correct destination.

2 comments:

  1. please post more scenario based questions

    ReplyDelete
  2. great work sir and please provide more scenario based questions

    ReplyDelete

Note: only a member of this blog may post a comment.