Thursday, 14 August 2014

Easy Subnetting - Class C

I am going to teach you the easiest method of subnetting in the world.  There simply isn't any easier way to do subnetting than the way I'm about to show you.  I learned this method from Todd Lammle's CCNA Study Guide (a great buy for those of you who may be looking to write the CCNA and need some good study material)

We will start by working in the class C range for now and once you get that down, I will do some other posts for class B and class A as they are just slightly more difficult.

For a class C address we are subnetting in the fourth octet.
All you have to remember is that 256 - # = block size where # is the value in the subnet mask in the fourth octet.

The block size is the number that your subnets increment by!

Let's take a look:

192.168.10.34
255.255.255.224

1. the value in the subnet mask fourth octet is 224 so we do 256-224 = 32 
-now we now know our block size is 32 so we increment by 32 in the fourth octet to get the list of all the subnets

2. write out the subnets
-start at 192.168.10.0 and write out the subnets, we increment by 32 in the fourth octet so:
 192.168.10.32
                  <------------ our host 192.168.10.34 is in here
 192.168.10.64
 192.168.10.96
 ...and so on

3. now write out the hosts on our subnet
192.168.10.32 <--- our subnet address
192.168.10.33
192.168.10.34
192.168.10.35
...
...
192.168.10.61
192.168.10.62
192.168.10.63
192.168.10.64 <---- the next subnet address

4. now we just have to remember that the broadcast address is always one less than the next subnet address - lets look at our subnet again:
192.168.10.32 <--- our subnet address
192.168.10.33
192.168.10.34
192.168.10.35
...
...
192.168.10.61
192.168.10.62
192.168.10.63 <---- our broadcast address for the 192.168.10.32 subnet
192.168.10.64 <---- the next subnet address

5. and finally we just remember that the valid hosts are the addresses between our subnet address and our broadcast address
192.168.10.32 <--- our subnet address
192.168.10.33 <--- first valid host
192.168.10.34
192.168.10.35
...
...
192.168.10.61
192.168.10.62 <--- last valid host
192.168.10.63 <---- our broadcast address
192.168.10.64 <---- the next subnet address


It get's easier just watch - let's try another one.  Remember in class C we're in the 4th octet so don't even worry about the 192.168.10 part just add that after you get the number for the fourth octet

192.168.10.37
255.255.255.240

What's our block size? 256-240 = 16

What are our subnets? .0, .16, .32, .48, and so on

What subnet are we on? 192.168.10.32 (192.168.10.48 being the next subnet)

What's our broadcast address? 192.168.10.47 (one less than the next subnet address)

What are our valid host addresses? 192.168.10.33 to 192.168.10.46

Let's try one last one

192.168.10.17
255.255.255.252

What's our block size? 256-252 = 4

What are our subnets? .0, .4, .8, .12, .16, .20 and so on

What subnet are we on? 192.168.10.16 (192.168.10.20 being the next subnet address)

What is our broadcast address? 192.168.10.19 (one less than the next subnet address)

What are our valid hosts? 192.168.10.17 to 192.168.10.18

Conclusion: it all boils down to your block size.  

Find your block size (256-# in the subnet mask 4th octet)
Find your subnet
Find your broadcast (one less than the next subnet address)
Find your valid hosts (the addresses between your subnet address and your broadcast address)

To get even better at subnetting (and even be able to do it in your head) you should try to memorize the following table as it will allow you to quickly retrieve the information you need right off the top of your head.

Notice that mask + block size always = 256 ;)

128   192   224   240  248  252  254  255 mask
128    64    32    16    8    4    2    1 block size
/25   /26   /27   /28  /29  /30  /31  /32 slash notation

Route Redistribution

The next tutorial I will show you is some simple route redistribution between OSPF and EIGRP.  In this topology I have R1 which is running OSPF in area 0, I have R3 which is running EIGRP in AS 100, and in the middle we have R2 who is running both OSPF and EIGRP and will act as our redistribution router.

The end goal of this tutorial is to be able to reach R3's loopback IP from R1 and reach R1's loopback IP from R3.  We will do this by redistributing OSPF into EIGRP and vice versa to allow connectivity between the two routers.

Here is a picture of the topology:

As with all my previous tutorials, all router interfaces are up/up, IP's have been configured, and the routers are all aware of their directly connected networks.  Here is the output of the 'show ip int brief' and 'show ip route' commands from all three routers:

R1#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.1     YES manual up                    up
FastEthernet0/1            unassigned      YES unset  administratively down down
Loopback0                  10.10.10.1      YES manual up                    up
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R1#

R2#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.2     YES manual up                    up
FastEthernet0/1            192.168.2.1     YES manual up                    up
R2#show
*Aug 14 12:41:06.303: %SYS-5-CONFIG_I: Configured from console by console
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1
R2#

R3#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            unassigned      YES unset  administratively down down
FastEthernet0/1            192.168.2.2     YES manual up                    up
Loopback0                  30.30.30.1      YES manual up                    up
R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.2.0/24 is directly connected, FastEthernet0/1
     30.0.0.0/24 is subnetted, 1 subnets
C       30.30.30.0 is directly connected, Loopback0
R3#

Step 1 - Configure OSPF R1-R2


First we need to configure OSPF on both R1 and R2 and establish and adjacency between them:

R1(config)#router ospf 1
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0

R2(config)#router ospf 1
R2(config-router)#network 192.168.1.0 0.0.0.255 area 0
R2(config-router)#
*Aug 14 12:44:53.343: %OSPF-5-ADJCHG: Process 1, Nbr 10.10.10.1 on FastEthernet0/0 from LOADING to FULL, Loading Done

Step 2 - Configure EIGRP R2-R3

Now we need to configure EIGRP on both R2 and R3 to establish a neighbor relationship between them.  Don't forget to turn off auto-summarization:

R2(config)#router eigrp 100
R2(config-router)#network 192.168.2.0 0.0.0.255
R2(config-router)#no auto-summary

R3(config)#router eigrp 100
R3(config-router)#network 192.168.2.0 0.0.0.255
R3(config-router)#no auto-summary
*Aug 14 12:50:29.391: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 192.168.2.1 (FastEthernet0/1) is up: new adjacency

Step 3 - Advertise R1 Loopback into OSPF

Now we need to tell R2 how to reach the 10.10.10.0/24 network by advertising it into OSPF on R1

R1(config)#router ospf 1
R1(config-router)#network 10.10.10.0 0.0.0.255 area 0

Now if we check R2, we can see the route to the 10.10.10.0/24 network that was learned from R1

R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/32 is subnetted, 1 subnets
O       10.10.10.1 [110/2] via 192.168.1.1, 00:00:04, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1
R2#

Step 4 - Advertise R3 Loopback into EIGRP

Now we need to tell R2 how to reach the 30.30.30.0/24 network by advertising it into EIGRP on R3

R3(config)#router eigrp 100
R3(config-router)#network 30.30.30.0 0.0.0.255

Now if we check R2, we can see the route to the 30.30.30.0/24 network that was learned from R3
R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/32 is subnetted, 1 subnets
O       10.10.10.1 [110/2] via 192.168.1.1, 00:05:34, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
C    192.168.2.0/24 is directly connected, FastEthernet0/1
     30.0.0.0/24 is subnetted, 1 subnets
D       30.30.30.0 [90/156160] via 192.168.2.2, 00:00:49, FastEthernet0/1
R2#

So far so good - we can see on R2 that it has received an OSPF route to the 10.10.10.0/24 network from R1, and it has received an EIGRP route to the 30.30.30.0/24 network from R3.

This is where we have a dilemma.  R2 knows about both the OSPF and EIGRP routes from R1 and R3 respectively, but because they are routes that are learned from two separate routing protocols, the EIGRP route isn't being sent to R1, and the OSPF route isn't being sent to R3.

R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R1#

R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.2.0/24 is directly connected, FastEthernet0/1
     30.0.0.0/24 is subnetted, 1 subnets
C       30.30.30.0 is directly connected, Loopback0
R3#


Route redistribution to the rescue!  All we have to do is redistribute the OSPF route into EIGRP, and the EIGRP route into OSPF.  

Step 5 - Redistribute EIGRP into OSPF (1-way redistribution)

Keep in mind that because R2 is the only router that is running both protocols, this is where we do the redistribution.  There is no redistribution configuration that needs to be done on R1 or R3 - only R2.

Let's start by redistributing EIGRP into OSPF:

R2(config)#router ospf 1
R2(config-router)#redistribute eigrp 100 subnets

What we've done so far is what's called 1-way redistribution.  We've redistributed the EIGRP route into OSPF which we can confirm by checking the route table of R1.  We can see both the 192.168.2.0/24 and 30.30.30.0/24 routes are learned on R2.  They are OSPF external type 2 routes as you can see from the 'E2' beside each route:

R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
O E2 192.168.2.0/24 [110/20] via 192.168.1.2, 00:00:21, FastEthernet0/0
     30.0.0.0/24 is subnetted, 1 subnets
O E2    30.30.30.0 [110/20] via 192.168.1.2, 00:00:21, FastEthernet0/0

However if we check R3, we still don't know about the OSPF routes to R1:

R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.2.0/24 is directly connected, FastEthernet0/1
     30.0.0.0/24 is subnetted, 1 subnets
C       30.30.30.0 is directly connected, Loopback0
R3#

Let's fix that

Step 6 - Redistribute OSPF into EIGRP (2-way redistribution)

We have to redistribute the OSPF routes into EIGRP so that R3 can learn those routes from R1 and we can achieve end-to-end connectivity:

R2(config)#router eigrp 100
R2(config-router)#redistribute ospf 1

Now let's check R3 to see if he's learned the OSPF routes from R1:

R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

C    192.168.2.0/24 is directly connected, FastEthernet0/1
     30.0.0.0/24 is subnetted, 1 subnets
C       30.30.30.0 is directly connected, Loopback0
R3#

Uh oh...why aren't we learning the OSPF routes from R1?  This is because when redistributing any external protocol into EIGRP, you MUST specify the default metrics to use (aka. K values) on those routes in order for them to work properly.  I'll get more into K values and EIGRP metrics another time.  For now let's just try the redistribution command again but this time we'll specify the default metrics:

R2(config)#router eigrp 100
R2(config-router)#redistribute ospf 1 metric 10000 1 255 1 1500

Now let's take a look at R3 and see if we've learned the OSPF routes from R1:

R3#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/32 is subnetted, 1 subnets
D EX    10.10.10.1 [170/258816] via 192.168.2.1, 00:00:38, FastEthernet0/1
D EX 192.168.1.0/24 [170/258816] via 192.168.2.1, 00:00:38, FastEthernet0/1
C    192.168.2.0/24 is directly connected, FastEthernet0/1
     30.0.0.0/24 is subnetted, 1 subnets
C       30.30.30.0 is directly connected, Loopback0
R3#

All is right with the world - we can see the routes to 10.10.10.0/24 and 192.168.1.0/24 are being learned from R1 and we know they are EIGRP external routes from the 'EX' beside each route.

Now let's verify if we can get from R1 to R3 and back:

R1#ping 30.30.30.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 30.30.30.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 40/81/156 ms
R1#

...and we are DONE.  That is redistribution in it's simplest form.  

I hope you enjoyed this tutorial and if you have any comments, feedback, or a specific topic that you would like me to cover, please leave a message below.

Thanks!

Basic iBGP Peering

Here is a quick tutorial on how to establish a iBGP session between two neighboring routers.

Here is a snapshot of the topology I will be using:

All interfaces are up/up and all IP addresses have been configured.  Here is the output of the 'show ip int brief' and 'show ip route' commands on each router so you can see where I'm starting from:

R1#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.1     YES manual up                    up
FastEthernet0/1            unassigned      YES unset  administratively down down
Loopback0                  10.10.10.1      YES manual up                    up

R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R1#

R2#show ip int brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.2     YES manual up                    up
FastEthernet0/1            unassigned      YES unset  administratively down down
Loopback0                  20.20.20.1      YES manual up                    up

R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     20.0.0.0/24 is subnetted, 1 subnets
C       20.20.20.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R2#

Step 1 - Basic BGP Configuration

I should mention now that we are configuring 'iBGP' or 'internal' BGP because both of these routers sit within the same autonomous system (65000).  If we were to peer two routers that were in different autonomous systems, we would be configuring 'eBGP' or 'external' BGP.  The process is practically identical either way, I just thought I'd clarify that we are setting up iBGP in this tutorial.

Here are the commands you need to bring up a basic peering session between R1 and R2:

R1(config)#router bgp 65000
R1(config-router)#neighbor 192.168.1.2 remote-as 65000

R2(config)#router bgp 65000
R2(config-router)#neighbor 192.168.1.1 remote-as 65000

After a moment you should see the BGP session come up:

R1(config-router)#
*Aug 14 11:16:06.427: %BGP-5-ADJCHANGE: neighbor 192.168.1.2 Up
R1(config-router)#

R2(config-router)#
*Aug 14 11:16:07.059: %BGP-5-ADJCHANGE: neighbor 192.168.1.1 Up
R2(config-router)#

In this case we have used the IP address of the neighboring routers fa0/0 interface to establish the session however with iBGP it is common practice to use loopback IP's to establish peering sessions.

Let's try removing the configuration we just made and re-establishing the session using the loopback0 IP of each router.

Step 2 - Re-establish Session with Loopbacks


R1(config)#no router bgp 65000
R1(config)#
*Aug 14 11:24:40.063: %BGP-5-ADJCHANGE: neighbor 192.168.1.2 Down BGP protocol initialization
R1(config)#router bgp 65000
R1(config-router)#neighbor 20.20.20.1 remote-as 65000

R2(config)#no router bgp 65000
R2(config)#router bgp 65000
R2(config-router)#neighbor 10.10.10.1 remote-as 65000

At this point you're probably sitting there quietly waiting...waiting...waiting...but nothing is happening.  Why isn't the peering session coming up?


Let's issue the 'show ip bgp summary' command on both routers and see what we get:

R1#show ip bgp summary
BGP router identifier 10.10.10.1, local AS number 65000
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
20.20.20.1      4 65000       0       0        0    0    0 never    Active
R1#

R2#show ip bgp summary
BGP router identifier 20.20.20.1, local AS number 65000
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.10.10.1      4 65000       0       0        0    0    0 never    Active
R2#

You'll notice that each router has a neighbor listed but look at the 'Up/Down' column.  Anytime you see 'never' in this column it's usually a good indicator that something is wrong.

It's because the loopback IP that you use to establish the session with the neighboring router MUST BE REACHABLE (ie. it must be in the routing table) otherwise the router will not establish a BGP session.

Let's go ahead and try configuring a static route on each router, telling it how to get the loopback IP of the neighboring router:

R1(config)#ip route 20.20.20.0 255.255.255.0 192.168.1.2

R2(config)#ip route 10.10.10.0 255.255.255.0 192.168.1.1

Hmmmmmmmm...we're still not getting the session to come online.  This is because we need to configure the loopback0 interface of each router to be the source for BGP updates.  I won't get into the details of why this needs to be done because it is beyond the scope of this simple tutorial but I promise I will go over this topic again in more detail when we get into the more complex configurations of BGP.

For now let's just specify the update source on each router:

R1(config)#router bgp 65000
R1(config-router)#neighbor 20.20.20.1 update-source loopback0
R1(config-router)#

R2(config)#router bgp 65000
R2(config-router)#neighbor 10.10.10.1 update-source loopback0
R2(config-router)#

And voila!  The peering session finally comes up on each router:

R1(config-router)#
*Aug 14 11:56:00.243: %BGP-5-ADJCHANGE: neighbor 20.20.20.1 Up

R2(config-router)#
*Aug 14 11:56:00.835: %BGP-5-ADJCHANGE: neighbor 10.10.10.1 Up

Step 4 - Verification

Now we will issue the 'show ip bgp summary' command on each router again and see what we get in the Up/Down column:

R1#show ip bgp summary
BGP router identifier 10.10.10.1, local AS number 65000
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
20.20.20.1      4 65000      24      24        1    0    0 00:11:43        0
R1#

R2#show ip bgp summary
BGP router identifier 20.20.20.1, local AS number 65000
BGP table version is 1, main routing table version 1

Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
10.10.10.1      4 65000      25      25        1    0    0 00:12:03        0
R2#


Basic OSPF Configuration and Route Advertisement

So I figured I'd start off this new blog with a very basic tutorial on how to establish an OSPF adjacency between two neighboring routers. I will also demonstrate how to advertise networks from one OSPF router to the other and vice versa. I will be using the following topology:
The end goal of this tutorial is to get connectivity from R1 to R2 via it's loopback0 address, and from R2 to R1 via it's loopback0 address.  I have already pre-configured the IP addresses on each FastEthernet interface along with the loopback0 interface of each router. All interfaces are up/up and each router can see the 192.168.1.0/24 network in its routing table because it's a directly connected network.

Step 1 - Basic OSPF Configuration


R1(config)#router ospf 10
R1(config-router)#router-id 10.10.10.1
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0

R2(config)#router ospf 20
R2(config-router)#router-id 20.20.20.1
R2(config-router)#network 192.168.1.0 0.0.0.255 area 0

Note that the process ID I used on R2 is different than that of R1.  This is simply to demonstrate that the process ID is locally significant meaning it doesn't matter to R2 what R1's proceed ID is and vice versa.  However there are a few rules that must be followed in order for neighbors to form an OSPF adjacency:

Both OSPF routers must be configured in the same area
Both OSPF router interfaces must be on the same subnet
Both OSPF routers must have unique router ID's
Both OSPF routers must have the same hello and dead timer values

If you have done everything correctly so far you should see the OSPF adjacency come up between the two routers as evidenced by the following message on each router:

R1(config-router)#
*Aug 14 09:42:37.655: %OSPF-5-ADJCHG: Process 10, Nbr 20.20.20.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
R1(config-router)#

R2(config-router)#
*Aug 14 09:42:38.195: %OSPF-5-ADJCHG: Process 20, Nbr 10.10.10.1 on FastEthernet0/0 from LOADING to FULL, Loading Done
R2(config-router)#

Step 2 - Verify OSPF Adjacency


You can verify that you have established an OSPF adjacency with your neighboring router by using the 'show ip ospf neighbor' command.  Below is the output of this command on each router:

R1#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
20.20.20.1        1   FULL/BDR        00:00:35    192.168.1.2     FastEthernet0/0
R1#

R2#show ip ospf neighbor
Neighbor ID     Pri   State           Dead Time   Address         Interface
10.10.10.1        1   FULL/DR         00:00:36    192.168.1.1     FastEthernet0/0
R2#

Step 3 - Route Advertisement


At this point you will notice that if you issue the 'show ip route' command on each router, nothing has changed.  We still only see the directly connected networks - furthermore, if we ping from R1 to R2's loopback0 address, we cannot get there.  You should know that this is because we don't have a route to that network in our routing table.  

R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R1#ping 20.20.20.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.20.20.1, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)

What we need to do to establish this connectivity is to advertise the loopback0 routes into OSPF so that R1 tells R2 how to get to the 10.10.10.0/24 network and R2 tells R1 how to get to the 20.20.20.0/24 network.  
R1(config)#router ospf 10
R1(config-router)#network 10.10.10.0 0.0.0.255 area 0
R1(config-router)#

R2(config)#router ospf 20
R2(config-router)#network 20.20.20.0 0.0.0.255 area 0
R2(config-router)#

Now if we check the routing table of reach router, we will see that R1 now as an OSPF route to the 20.20.20.0/24 network and R2 has an OSPF route to the 20.20.20.0/24 network.  

R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     20.0.0.0/32 is subnetted, 1 subnets
O       20.20.20.1 [110/2] via 192.168.1.2, 00:00:10, FastEthernet0/0
     10.0.0.0/24 is subnetted, 1 subnets
C       10.10.10.0 is directly connected, Loopback0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R1#

R2#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     20.0.0.0/24 is subnetted, 1 subnets
C       20.20.20.0 is directly connected, Loopback0
     10.0.0.0/32 is subnetted, 1 subnets
O       10.10.10.1 [110/2] via 192.168.1.1, 00:02:21, FastEthernet0/0
C    192.168.1.0/24 is directly connected, FastEthernet0/0
R2#

Step 4 - Final Verification

Now that we are advertising the required routes into OSPF, we should be able to ping from R1 to R2 at 20.20.20.1 and R2 to R1 at 10.10.10.1

R1#ping 20.20.20.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 20.20.20.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 8/76/184 ms
R1#

R2#ping 10.10.10.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 12/74/224 ms
R2#

...and that's it!  We're done.  I will be getting into much more complicated tutorials and labs but for now we'll start off with the easy stuff and gradually work our way into the more difficult stuff as we go along.

Thanks for reading and I hope you found this post helpful and informative.  If you have any questions or feedback etc. please leave a comment down below.