---
# System prepended metadata

title: Daniil Sinelnik INR Lab

---

:::success
# INR Lab OSPF
### Name: Daniil Sinelnik
:::


## Task 1: Prepare your network topology

<center>
    
![image](https://hackmd.io/_uploads/Syemi6QHa.png)
Network topology
</center>

There are 3 routers - R1, R2 and R3. Interfaces ether1 and ether2 of each router are individually assigned an IP address on the network 10.0.0.0/24. Theoretically, they should all be able to communicate with each other.

Interfaces with the name ether3 for each router lead to a different subnet with just one VPC in it.

* R1 is responsible for the subnet 192.168.1.0/24 and has an IPv4 address of 192.168.1.1/24 on that network.
* R2 is responsible for the subnet 192.168.2.0/24 and has an IPv4 address of 192.168.2.1/24 on that network.
* R3 is responsible for the subnet 192.168.3.0/24 and has an IPv4 address of 192.168.3.1/24 on that network.

**Configuration of the networks**

<center>
    
![image](https://hackmd.io/_uploads/BJl13pXr6.png)
R1.

![image](https://hackmd.io/_uploads/B1Beh6Qra.png)
R2.

![image](https://hackmd.io/_uploads/r1eZnTXH6.png)
R3.
</center>

## Task 2: Deployment

:::info
1. Which interface you will select as the OSPF router ID and why?
2. What is the difference between advertising all the networks VS manual advertising (per interface or per subnet)? Which one is better?
3. If you have a static route in a router, how can you let your OSPF neighbors know about it? Approve and show it on practice.
4. Enable OSPF with authentication between the neighbors and verify it.
5. Bonus: if one of the routers has multiple subnets, try to use route summarization.
:::

:::info
Which interface you will select as the OSPF router ID and why?
:::

OSPF router-id is just a string and does not have to be an IP address tied to a particular interface. However, a good practice is to assign the OSPF router-id based on the router loopback interface.

Loopback interface is a logical interface that is always available as long as the router has at least 1 physical interface running and that interface can route the traffic to the loopback interface. It is also an interface that very changes its IP address after being assigned one. This makes the value of the routers loopback address a good condidate for the router-id value and Mikrotik by default uses assigns router-id for the OSPF instance based on the available loopback interfaces.

Here is how I created loopback interfaces, assigned IP addresses to them and set router-ids on my routers:

<center>
    
![image](https://hackmd.io/_uploads/SkWJap7HT.png)
R1
    
![image](https://hackmd.io/_uploads/BJt1aaQBT.png)
R2
    
![image](https://hackmd.io/_uploads/BJggTTmr6.png)
R3
</center>

:::info
What is the difference between advertising all the networks VS manual advertising (per interface or per subnet)? Which one is better?
:::

Advertising all the networks means that the router advertises all the networks that are advertised to it.

Manual advertising means that the administrator can choose which networks the router should advertise and through which interfaces.

From the definitions above it seems that manual advertising is the more general option, which allows the administrator to configure the network exactly the way they want.

On the other such configuration may be tedious and/or error-prone, so for simpler use cases broadcasting is usually preferrable.

:::info
If you have a static route in a router, how can you let your OSPF neighbors know about it? Approve and show it on practice.
:::

In Mikrotik you can configure a static route using the routing ospf static-neighbor command. Here I used it to explicitly say that host 10.0.0.2 on the interface ether1 is the OSPF neighbor of my router.

If I want to allow only the specific routes to be redistributed in Mikrotik v7 I can use the `ip route filter add` command.

<center>
    
![image](https://hackmd.io/_uploads/B1JwppmST.png)
</center>

:::info
Try to deploy OSPF with authentication between the neighbors.
:::

Here is how I configured the interface templates the routers. Interface templates allow to configure:

* authentication type and credentials that are used to advertise and accept advertisement.
* the type of advertisement (broadcast, point-to-point, etc.)
* the networks to advertise
* the interfaces that should advertise those networks

All the routers are using `md5` authentication with a `password` of `password` and the broadcast type of advertisement.

<center>
    
![image](https://hackmd.io/_uploads/ry5ipTXB6.png)
R1
    
![image](https://hackmd.io/_uploads/rkbhTaQSa.png)
R2
    
![image](https://hackmd.io/_uploads/HkK3paQSa.png)
R3
</center>

:::info
Bonus: if one of the routers has multiple subnets, try to use route summarization.
:::

I dont jave a router with multiple subnets.

## Task 3: Verification

:::info
1. How can you check if you have a full adjacency with your router neighbor?
2. How can you check in the routing table which networks did you receive from your neighbors?
3. Use traceroute to verify that you have a full OSPF network.
4. Which router is selected as DR and which one is BDR ?
5. Check what is the cost for each network that has been received by OSPF in the routing table.
:::

:::info
How can you check if you have a full adjacency with your router neighbor?
:::


I can do this using the routing ospf neighbor print command. In particular, the state field for each neighbor shows the adjacency type. For all routers and neighbors this value is Full.

<center>
    
![image](https://hackmd.io/_uploads/SyoUCp7S6.png)
R1
    
![image](https://hackmd.io/_uploads/Sylw06XH6.png)
R2
    
![image](https://hackmd.io/_uploads/BkUPCpXBp.png)
R3
</center>

:::info
How can you check in the routing table which networks did you receive from your neighbors?
:::

`ip route print`. The routes received from the OSPF neigbors have the `o` flag in the first column, alongside `D` which stands for `dynamic` and `A` which stands for `active`:

<center>
    
![image](https://hackmd.io/_uploads/SyHRRpQBa.png)
R1

![image](https://hackmd.io/_uploads/r1pR0TQH6.png)
R2
    
![image](https://hackmd.io/_uploads/BkPkkRQHp.png)
R3
</center>

:::info
Use traceroute to verify that you have a full OSPF network
:::


<center>
    
![image](https://hackmd.io/_uploads/Byafk0XHa.png)
Using from R1 to all hosts
    
![image](https://hackmd.io/_uploads/r1LmJAXHp.png)
R2 to all
    
![image](https://hackmd.io/_uploads/SJxSyAQB6.png)
R3 to all
</center>

:::info
Which router is selected as DR and which one is BDR?
:::

To do this I need to run the same command as the one in task 3.a. In this case the dr field is the designated router, and the bdr field is the backup designated router.

:::info
Check what is the cost for each network that has been received by OSPF in the routing table.
:::

This can be done using the routing route print command with the ospf filter. The calculated cost should be in the DISTANCE column. Note that I am using the release candidate version of Mikrotik (v7.4rc2), so the information may be computed incorrectly. Although it is correct that the distance to all the hosts should be the same, the origin of the exact value 110 remains unknown to me.

<center>
    
![image](https://hackmd.io/_uploads/BJ33kC7r6.png)
R1
    
![image](https://hackmd.io/_uploads/BJxGlRXr6.png)
R2
    
![image](https://hackmd.io/_uploads/SJSfxAQHa.png)
R3
</center>
