Anda di halaman 1dari 5

1. Draw a simple network with two Ethernets which are connected by one router. 2.

Add 1 PC to
each Ethernet. 3. Assign IP addresses to each PC and both router interfaces. 4. Select one PC as
the sender and the other PC as the receiver. Both PCs are running a tic-tac-toe game which is
based on UDP. The sender will send a “move” via a UDP packet to the receiver using UDP Port
1942 as the destination port and UDP port 1941 as the source port.
Using the information, you have created and the information given describe, in detail, the life of
the packet as it leaves the game application on the sender until it arrives at the receiver.
Let,

Name IP Address MAC Address Port No.

Sender Device A 10.9.210.143 00:50:56: a3:81:54 1941

Receiver Device B 10.37.124.20 00:0c:29: f0:03: a8 1942

Interface 1 10.255.40.6
Router Router 00:0c:29: f0:03: a8
Interface 2 10.37.253.30

Message Size: Let message send by sender a “move” be 40 bytes.


Consider, both the devices are running tic-tac-toe game based on UDP.
UDP provides process-to-process communication using socket addresses (IP addresses + Port
numbers), the game application makes use of UDP to send a message to the receiving end. The
steps to be followed while a sender tries to send a message to the receiver are described as below
(there is no connection establishment and no connection termination):
In the Application Layer (in Device A):

 The game application sends the message to the transport layer which has to be sent to
the receiver.
In the transport layer (UDP) (in Device A):

 UDP receives the message from the application layer and builds/encapsulates its own
header with the following fields.
 UDP header (8 Bytes) contains the fields:
o Source Port (2 Bytes): 1941
o Destination Port (2 Bytes): 1942
o Total Length (Header + Data) (2 Bytes): 8+40
o Checksum (2 Bytes): It is optional in IPv4
 Filled with 0’s if choose not to calculate it
If choose to calculate: 1's complement of sum of a pseudo UDP header +
UDP datagram.
o UDP sends the datagram to the IP layer.
In the Network Layer (IP) (in Device A): IP layer receives the UDP datagram (payload for IP) from
the transport layer.

 Finding Next HOP (Forwarding Table):


o It takes the subnet of the Destination IP/host as an index and check the forwarding
table (Local subnet)
o Since it is in another subnet, the next hop is a router in between our source and
destination and we will get IP address of a router (router interface - 10.255.40.6).
o MAC address of a router has to be known in order to deliver the packet. Here,
comes the ARP auxiliary protocol.
 Finding MAC Address (ARP Table):
o ARP accepts an IP address of a router from the IP protocol, map the address to the
corresponding link-layer address.
o If it is found, it is used.
o Else, ARP Send a request(broadcast) message to all the devices connected to the
local ethernet layer and fills the MAC address (00:0c:29: f0:03: a8 in our case) once
it gets the reply from intended recipient having that IP address.
 Building IP packet:
o Using the above information and UDP datagram as the payload, IP layer builds the
IP datagram with the following information.
 VER: Version number of IP protocol (4)
 HLEN: Length of the IP header (20 bytes)
 Service Type: referred to as type of service (TOS), which defined how the
datagram should be handled. (0)
 Total Length: Length of IP Header + Data(68 bytes)
 Identification, flags and fragmentation: related to the fragmentation of the
IP datagram when the size of the datagram is larger. In our case unique
number is assigned to Identification. Since there is no fragmentation, flags
are not set and the offset is set to 0.
 Time to Live: Maximum hops (255)
 Protocol: define to which protocol the payload should be delivered. (17)
 Header Checksum: 1's complement of sum of header fields
 Source IP Address: 10.9.210.143(Device A)
 Destination IP Address: 10.37.124.20 (Device B)
 Options: used for network testing and debugging.
 Payload: Packet from the Transport Layer. (UDP Datagram)
 Now, the IP packet is given to the Data Link Layer.
In the Data Link Layer (Ethernet) (in Device A): Responsible for transferring datagram from one
node to adjacent node over a link.

 This Layer receives the IP Packet from the Network layer.


 Building frame:
o It builds the frame with the following fields and IP packet as its payload
 Preamble: used to synchronize receiver, sender clock rates
 SFD: signals the beginning of the frame.
 Destination MAC Address: link- layer address of the destination (router -
00:0c:29: f0:03: a8)
 Source MAC Address: link- layer address of the source (Device A -
00:50:56: a3:81:54)
 Type: Upper-layer protocol whose packet is encapsulated in the frame.
(0x0800)
 Data: data encapsulated from the upper-layer protocols (IP packet)
 CRC: 1's complement of sum of calculated over the addresses, types, and
data field.
 Now, the Ethernet frame is given to the Physical Layer for transmitting.

In the Physical Layer (between Device A and Router Interface - 1): Electrically transmits the
frame

 This Layer receives the Ethernet frame from the Data Link layer.
o It uses CSMA/CD as a transmission method
o It senses the medium
o If the medium is free, transmits the frame and keep on sensing.
o If collision occurs, it retransmits the frame (Exponential Back-off method).

In LAN A (all devices connected to):

 The Ethernet frame is received by all the nodes in the Ethernet.


 CRC is checked by all and sends it to layer 2.
 At Layer 2(of all devices connected to LAN A):
o Layer 2 checks whether the destination MAC address matches with local MAC
address.
o If it not matches it simply ignores, else it checks for the “Type field”, its “IP”, so it
passes the packet to the IP layer by stripping off the Ethernet Header.
 At Network layer (Router):
o This Layer receives the IP Packet from the Data Link layer.
o It checks for the IP checksum in the IP header. If it is corrupted the packet is
discarded.
o If not, Network layer will validate the packet is destined for router where it
compares the IP Destination address in the packet with its own IP addresses.
o In our case, it doesn’t match router’s IP, since it is destined for Device B.
o Finding next Hop:
 Using Longest match method searches through the forwarding table.
 In our case, it could find the next hop as our Device B (IP address), where
the packet is destined for.
o Finding MAC Address:
 Using ARP, the MAC address of next hop can be found.
o Updating IP Packet:
 TTL field has to be decrement by 1 for each hop. So, it is decremented to
254.
 Header Checksum of IP has to be updated, since one of the values for
calculating it has been changed. (TTL)
o Now, it is pass on to the Data Link Layer for transmission.

 At Layer 2(Router):
o This Layer receives the IP Packet from the Network layer.
o Building New Ethernet frame: Since, layer 2 connection is between 2 adjacent
host, every time for each new connection between 2 adjacent host, new ethernet
frame has to be build.
 Preamble: used to synchronize receiver, sender clock rates
 SFD: signals the beginning of the frame.
 Destination MAC Address: link- layer address of the destination station
(Device B)
 Source MAC Address: link- layer address of the source station(router)
 Type: Upper-layer protocol whose packet is encapsulated in the frame.
(0x0800)
 Data: data encapsulated from the upper-layer protocol (IP packet)
 CRC: 1's complement of sum of calculated over the new addresses, types,
and data field.
o Now, the new Ethernet frame is given to the Physical Layer for transmitting.
In the Physical Layer (between Router Interface 2 and Device B): Electrically transmits the frame

 This Layer receives the new Ethernet frame from the Data Link layer.
o It uses CSMA/CD as a transmission method
o It senses the medium
o If the medium is free, transmits the frame and keep on sensing.
o If collision occurs, it retransmits the frame (Exponential Back-off method).
In LAN B (all devices connected to):

 The new Ethernet frame is received by all the nodes in the Ethernet2.
 CRC is checked by all and sends it to layer 2.
 At Layer 2(of all devices connected to LAN B):
o Layer 2 checks whether the destination MAC address matches with local MAC
address. In our case it matches.
o Then, it checks for the “Type field”, its “IP”, so it passes the packet to the IP layer
by stripping off the new Ethernet Header from the segment.
In the Network Layer (in Device B):

 This Layer receives the IP Packet from the Data Link layer.
 It checks for the IP checksum in the IP header.
 It compares IP destination address with its own IP address, it matches.
 It checks to which protocol the packet has to be delivered by looking the “Type field”. It
is UDP.
 It passes the UDP Datagram to the UDP process after stripping off the IP Header from the
segment.
In the Transport Layer (in Device B):

 Checks the checksum for error. If the checksum does not include pseudo header
and if the IP header is corrupted, the datagram may deliver to the wrong host. On
the other hand, if the protocol value is changed, UDP drops the packet.
 Assuming there are no such cases, the transport layer strip off the UDP header
from the data and sends it to the application layer.
In the Application Layer (in Device B):

 It receives the original data. Packet life ends here!!!

Anda mungkin juga menyukai