---
# System prepended metadata

title: Network Layer
tags: [computer network]

---

# Network Layer
###### tags: `computer network`

## Service of Network Layer
* Send Packet from one source subnet to another destination subnet

What the network layer does is to ***route*** the packet (sometimes called datagram) from source to destination with the optimal path by the ***routing algorithm***

## Packet
![](https://i.imgur.com/Ogy3PSd.png)

## IP Address
![](https://i.imgur.com/fYcH2Ka.png)


## Routing Algorithm
What the routing algorithm focus on are ***forwarding*** and ***routing***.
* forwarding: forward input packet to which output within a router
* routing: the overall routing within the network architecture
There are two types of routing, ***adaptive and non-adaptive***. For adpative routing (or dynamic routing), there are algorithm such as Distance Vector Routing and Link-State Routing
![](https://i.imgur.com/8wmTDcz.png)

## Distance Vector Routing (Bellmond-ford)
For full algorithm description, please refer to slide.

Here, I would like to discuss more on the issue of Distance Vector Routing. Count-to-Infiniity Issue. For explanation, one could refer to [here](https://www.youtube.com/watch?v=C2_6womzsrk&ab_channel=FardinSaad)

Some solution would be add Time-to-Live to packet to avoid a packet is passing between two node for a large amount of time.