Window size value : This is the value to receive from other side. (Window size is advertising the RCV buffer space available for the device, how much memory is allocated for the session)

 

The maximum field for TCP window size = 65535 or 0xFFFF because it is a 2 byte field.  There is a method to make it bigger by negotiating the window using the scaling option. 

 

I can see in the SYN packet option – Window Scale = 7.  This tells the server it wants to use this option and multiply the window size by 128. And Server agree in the SYN+ACK with the same option = 7.  This tells the client it also will be using the scaling option.

Window scale number 7 means that 2^7 = 128. This number is never changed until fininshing converstation.

 

 

After this negotiation, I can look at packet 3 in the TCP section at the Window you will see it shows (211 x 128 = 27008) 

From Server, I can see the window scale option is enabled like below

 

And middle of the packets, I can see the widnow size more than 65535. 76288 is the sample to use scale option. 

 

This is normal case to show how the scale option is used.

 

 

[Without Window scaling option Case]

 

This is the sample case to show what the window scale dose not work. In the first syn packet, there is the option. However the syn-ack paket does not have this option like below.

This below is syn-ack packet. There is no window scale option.

So, the last ack packet decide to send packet without the window scale option.

In wireshark, -2 mean that there is no window scale option definition. Please note that -2 always means "no window scale option". If there is no packet syn, syn-ack and ack due to capturing middle of packets, the wireshark determind -2 even if the window size is more than 65535.

 

 

 

 

Sometimes, I need to see the packet with wireshark tool. I have to calculate sequence numbers. I have learned the IP packet size is 1540 (MSS is 1460). However, I can see the more size in the packet. This post is good for me.

 

 

This is whole diagram to understand my situation. This is the reason why I need to capture the packet with switch port.

 

Please look at the first Syn packet. There is MSS is 8961. In blow, I wrote the MSS size is 1460. However, the wireshark show more than 8961. 

 

How to calculate sequence number of the TCP/IP packets?

How to calculate sequence number of the TCP/IP packets? I am the network engineer. Recently, I have some change to remember the sequence number of the TCP/IP packets. Someone include me think that t..

createnetech.tistory.com

Thus, this is not perfect number. 

 

 

 

[ Reference ]

[ 1 ] https://packetbomb.com/how-can-the-packet-size-be-greater-than-the-mtu/

[ 2 ] https://createnetech.tistory.com/25?category=672583

 

1. Simple OSPF Parameters to Use

Before configuring the OSPF, I will handle some concept necessary to configure. For interface configuration, there is some term of network type. In this blog, those are compared simply.

In the above, DR/BDR terms are shown. If you did not study about the OSPF, it is not easy. DR has the role to share the OSPF information between the routers and switches. In this blog, it show simple diagram to explain about these.

DR make simple to share routing table information. Because of this, it is useful in Broadcast network. Howerver, I confuse about the Point to Multipoint concept. It looks like Broadcast. I refers this blog. It is different I need to annount the neighbor IP address with "Neighbor" or "Frame-relay" options.

 

2. Unnumbered Interfaces | net.ipv4.conf.<interface name>.rp_filter value=0

In fact, I did not realize this concept. I met the error message "Please remove network command first" during configure OSPF with FRR. In this post, there are some explain about this.

Unnumberd Interface improve the performance. I need to edit "net.ipv4.conf.<interface name>.rp_filter value=0" in the "/etc/sysctl.conf"

Because of this "unnumbered interface existance", FRRouting give some limitation. After network definition in router ospf part, I can not activate the interface for OSPF.

 

 

Reference

[ 1 ] https://docs.cumulusnetworks.com/cumulus-linux-37/Layer-3/Open-Shortest-Path-First-OSPF/

[ 2 ] https://www.freeccnaworkbook.com/workbooks/ccna/configuring-ospf-network-types

[ 3 ] https://www.fir3net.com/Networking/Protocols/ospf-the-dr-and-bdr-roles.html

[ 4 ] https://packetlife.net/blog/2008/jun/19/ospf-network-types/

[ 5 ] http://www.getnetworking.net/tutorials/ospf-point-to-multipoint-over-frame-relay

[ 11 ] https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/iproute_ospf/configuration/xe-16/iro-xe-16-book/iro-cfg.html

Recently, I have some questions about the ECMP load-balancing on CISCO switch. I have already known that the traffic will be distrubute according to each interfaces. However, I can not understand the method for this. This is good chance for me to learn.

 

I have read this instruction. I read some terms, "Per Destination" and "Per Packet". In this instruction. It will be more useful to understand.

By this instruction, I can see the configuration paramter on interface like below.

For this verification, I will set up the GNS simulator like below. There are 3 links connected each other.

I will see the wireshark packet over each interface.

 

 

1. Per-Destination Algorithm 

 

"Per-Desination" is default configuration. Therefore, it is now shown when I enter the CLI "ip load-sharing per-destination".

This algorithm is more similar with hashing method. The traffic will transfer over same interface. R1 has 3 loopback IP address, 1.1.1.1, 1.1.1.2 and 1.1.1.3. I will do ICMP with source. The traffic will use different links. However, It will be the same link when the source and destination are same.

 

[R1# ping 2.2.2.2 source 1.1.1.1 repeat 1]

R1 send ICMP request over Fa 2/1 and received over Fa 2/3.

 

[R1# ping 2.2.2.2 source 1.1.1.2 repeat 1]

R1 send ICMP request over Fa 2/2 and received over Fa 2/1.

 

[R1# ping 2.2.2.2 source 1.1.1.3 repeat 1]

R1 send ICMP request over Fa 2/2 and received over Fa 2/1.

 

Now I will do again in 10 minutes. It will be the same result. 

[R1# ping 2.2.2.2 source 1.1.1.2 repeat 1]

R1 send ICMP request over Fa 2/2 and received over Fa 2/1.

 

2. Select load-sharing algorithm for "Per-Destination"

 

This configuration give some option between R1 and R2. "Per-Destination" is the hashing algorithm. Thus R1 and R2 will show the same result. Because of this, some link can be intensive. For example, R1 --> Link 1 --> R2, R2 --> Link 1 --> R1 can be happend. Thus "Universal algorithm" make more dynmic distrubution on each switch with difference link.

 

3. Per Packet Algorithm.

 

I will configure like below on R1 and R2 switch.

After then, I will try to ping to R2. R2 has loopback IP address, 2.2.2.2/32. 

I will get the result like below. This result show that the traffic are distributed by packet, even if it is single connection (source-destination IP address pair)

[FastEthernet 2/1]

[FastEthernet 2/2]

[FastEthernet 2/3]

 

 

Reference

[ 1 ] https://networkengineering.stackexchange.com/questions/27914/example-of-ecmp-uses-hashing-technique

[ 2 ] https://www.cisco.com/c/en/us/td/docs/switches/datacenter/sw/4_2/nx-os/unicast/configuration/guide/l3_cli_nxos/l3_manage-routes.html#wp1114960

[ 3 ] https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/ipswitch_cef/configuration/15-mt/isw-cef-15-mt-book/isw-cef-load-balancing.html#GUID-303F07B8-A52B-4BD3-A1F8-54DF24493D8E

How does the OSPF cost work? 

 

In this post, I will handle the OSPF cost (OSPF cost and auto-cost reference-bandwidth). Normally, I use the OSPF with default setting. 

 

1. Pre-requisite.

 

This is my environment to re-produce. I will write the simple configuration with default values.

s1 (1.1.1.1/32)

s2 (2.2.2.2/32)

s3 (3.3.3.3/32)

feature ospf

interface Ethernet1/1

  no switchport

  ip address 100.21.1.11/16

  ip router ospf 1 area 0.0.0.0

  no shutdown

 

interface Ethernet1/3

  no switchport

  ip address 100.31.1.13/16

  ip router ospf 1 area 0.0.0.0

  no shutdown

 

interface loopback0

  ip address 1.1.1.1/32

  ip router ospf 1 area 0.0.0.0

  

router ospf 1

  router-id 1.1.1.1

feature ospf

interface Ethernet1/1

  no switchport

  ip address 100.21.2.11/16

  ip router ospf 2 area 0.0.0.0

  no shutdown

 

interface Ethernet1/2

  no switchport

  ip address 100.32.2.12/16

  ip router ospf 2 area 0.0.0.0

  no shutdown

 

interface loopback0

  ip address 2.2.2.2/32

  ip router ospf 2 area 0.0.0.0

 

router ospf 2

  router-id 2.2.2.2

feature ospf

interface Ethernet1/2

  no switchport

  ip address 100.32.3.12/16

  ip router ospf 3 area 0.0.0.0

  no shutdown

 

interface Ethernet1/3

  no switchport

  ip address 100.31.3.13/16

  ip router ospf 3 area 0.0.0.0

  no shutdown

 

interface loopback0

  ip address 3.3.3.3/32

  ip router ospf 3 area 0.0.0.0

 

router ospf 3

  router-id 3.3.3.3

 

2. Verify default status.

 

With default values, I can see the routing table over s1.

s1# show ip route

1.1.1.1/32, ubest/mbest: 2/0, attached

    *via 1.1.1.1, Lo0, [0/0], 00:39:21, local

    *via 1.1.1.1, Lo0, [0/0], 00:39:21, direct

2.2.2.2/32, ubest/mbest: 1/0

    *via 100.21.2.11, Eth1/1, [110/41], 00:35:38, ospf-1, intra

3.3.3.3/32, ubest/mbest: 1/0

    *via 100.31.3.13, Eth1/3, [110/41], 00:33:43, ospf-1, intra

100.21.0.0/16, ubest/mbest: 1/0, attached

    *via 100.21.1.11, Eth1/1, [0/0], 00:36:44, direct

100.21.1.11/32, ubest/mbest: 1/0, attached

    *via 100.21.1.11, Eth1/1, [0/0], 00:36:44, local

100.31.0.0/16, ubest/mbest: 1/0, attached

    *via 100.31.1.13, Eth1/3, [0/0], 00:34:24, direct

100.31.1.13/32, ubest/mbest: 1/0, attached

    *via 100.31.1.13, Eth1/3, [0/0], 00:34:24, local

100.32.0.0/16, ubest/mbest: 2/0

    *via 100.21.2.11, Eth1/1, [110/80], 00:33:43, ospf-1, intra

    *via 100.31.3.13, Eth1/3, [110/80], 00:33:43, ospf-1, intra

I can see the 2 kinds of values, [110/41] and [110/80]. The first value is the preference which is called as the administrative distance. In this instruction, there is the table list. In my case, I used the OSPF protocol which has 110 value as the default distance values.

The second value is the metric which means the cost. The smaller value for the cost has higher priority

From [110/41] and [110/80], "41" and "80" are the metric cost. Before calcuate these values, I need to understand the "auto-cost referece-bandwidth".

 

3. About auto-cost referece-bandwidth.

 

The cost is obtained by "auto-cost reference-bandwidth / interface bandwidth". In this instruction, it show how to configure this auto-cost reference-bandwidth. This is overview.

In my case, I used the Cisco Nexus image. Therefore, the default value is like below from this instruction.

I can verify this value with command, "show ip ospf". This is the sample from s1.

s1# show ip ospf

 Routing Process 1 with ID 1.1.1.1 VRF default

 Routing Process Instance Number 1

 Stateful High Availability enabled

 Graceful-restart is configured

   Grace period: 60 state: Inactive

   Last graceful restart exit status: None

 Supports only single TOS(TOS0) routes

 Supports opaque LSA

 Administrative distance 110

 Reference Bandwidth is 40000 Mbps

 SPF throttling delay time of 200.000 msecs,

   SPF throttling hold time of 1000.000 msecs,

   SPF throttling maximum wait time of 5000.000 msecs

 LSA throttling start time of 0.000 msecs,

   LSA throttling hold interval of 5000.000 msecs,

   LSA throttling maximum wait time of 5000.000 msecs

 Minimum LSA arrival 1000.000 msec

 LSA group pacing timer 10 secs

 Maximum paths to destination 8

 Number of external LSAs 0, checksum sum 0

 Number of opaque AS LSAs 0, checksum sum 0

 Number of areas is 1, 1 normal, 0 stub, 0 nssa

 Number of active areas is 1, 1 normal, 0 stub, 0 nssa

 Install discard route for summarized external routes.

 Install discard route for summarized internal routes.

   Area BACKBONE(0.0.0.0)

        Area has existed for 02:52:56

        Interfaces in this area: 3 Active interfaces: 3

        Passive interfaces: 0  Loopback interfaces: 1

        No authentication available

        SPF calculation has run 9 times

         Last SPF ran for 0.001811s

        Area ranges are

        Number of LSAs: 6, checksum sum 0x30590

Reference Bandwidth is 40000 Mbps. In s1, ethernet 1/1 and ethernet 1/3 have 1Gbps Bandwidth

s1# show inter et 1/1
Ethernet1/1 is up
admin state is up, Dedicated Interface
  Hardware: 100/1000/10000 Ethernet, address: 0cfc.6a48.f207 (bia 0cfc.6a48.f208 )
  Internet Address is 100.21.1.11/16
  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec
  reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, medium is broadcast
  full-duplex, 1000 Mb/s

 

s1# show inter et 1/3
Ethernet1/3 is up
admin state is up, Dedicated Interface
  Hardware: 100/1000/10000 Ethernet, address: 0cfc.6a48.f207 (bia 0cfc.6a48.f20a )
  Internet Address is 100.31.1.13/16
  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec
  reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, medium is broadcast
  full-duplex, 1000 Mb/s

Thus, 40000 Mbps / 1000 Mbps = 40. This is the cost. I can verify the value only with command "show ip ospf interface" also. The below is the sample from s1.

s1# show ip ospf interface

 Ethernet1/1 is up, line protocol is up

    IP address 100.21.1.11/16

    Process ID 1 VRF default, area 0.0.0.0

    Enabled by interface configuration

    State BDR, Network type BROADCAST, cost 40

    Index 2, Transmit delay 1 sec, Router Priority 1

    Designated Router ID: 2.2.2.2, address: 100.21.2.11

    Backup Designated Router ID: 1.1.1.1, address: 100.21.1.11

    1 Neighbors, flooding to 1, adjacent with 1

    Timer intervals: Hello 10, Dead 40, Wait 40, Retransmit 5

      Hello timer due in 00:00:04

    No authentication

    Number of opaque link LSAs: 0, checksum sum 0

 Ethernet1/3 is up, line protocol is up

    IP address 100.31.1.13/16

    Process ID 1 VRF default, area 0.0.0.0

    Enabled by interface configuration

    State BDR, Network type BROADCAST, cost 40

    Index 3, Transmit delay 1 sec, Router Priority 1

    Designated Router ID: 3.3.3.3, address: 100.31.3.13

    Backup Designated Router ID: 1.1.1.1, address: 100.31.1.13

    1 Neighbors, flooding to 1, adjacent with 1

    Timer intervals: Hello 10, Dead 40, Wait 40, Retransmit 5

      Hello timer due in 00:00:03

    No authentication

    Number of opaque link LSAs: 0, checksum sum 0

 loopback0 is up, line protocol is up

    IP address 1.1.1.1/32

    Process ID 1 VRF default, area 0.0.0.0

    Enabled by interface configuration

    State LOOPBACK, Network type LOOPBACK, cost 1

    Index 1

 

 

I need to calculate these values. In this instruction, it show how to calculate and select the path.

 

4. Analysis the OSPF routing cost.

 

In s1 switch, [110/41] and [110/80] are the values as the cost. 

I need to see more detail. "3.3.3.3" is the loopback interface. This IP address can be obtain with 2 path. "81" and "41" are the cost values. "41" is lower values. This is selected.

 

5. (Option 1) Adjust the Interface Bandwidth to change the path.  

 

There are many method to determine the path. Most simple way is the change the interface bandwidth and speed. I change the interface bandwidth like below. Please read this instruction.

s1 (1.1.1.1/32)

s3 (3.3.3.3/32)

s1(config)# inter et 1/3

s1(config-if)# bandwidth 100000

s3(config)# inter et 1/3

s3(config-if)# bandwidth 100000

After then, I can check the interface bandwidth status

s1# show ip ospf inter et 1/3
 Ethernet1/3 is up, line protocol is up
    IP address 100.31.1.13/16
    Process ID 1 VRF default, area 0.0.0.0
    Enabled by interface configuration
    State BDR, Network type BROADCAST, cost 400
    Index 3, Transmit delay 1 sec, Router Priority 1
    Designated Router ID: 3.3.3.3, address: 100.31.3.13
    Backup Designated Router ID: 1.1.1.1, address: 100.31.1.13
    1 Neighbors, flooding to 1, adjacent with 1
    Timer intervals: Hello 10, Dead 40, Wait 40, Retransmit 5
      Hello timer due in 00:00:03
    No authentication
    Number of opaque link LSAs: 0, checksum sum 0

 

s3# show ip ospf interface ethernet 1/3
 Ethernet1/3 is up, line protocol is up
    IP address 100.31.3.13/16
    Process ID 3 VRF default, area 0.0.0.0
    Enabled by interface configuration
    State DR, Network type BROADCAST, cost 400
    Index 3, Transmit delay 1 sec, Router Priority 1
    Designated Router ID: 3.3.3.3, address: 100.31.3.13
    Backup Designated Router ID: 1.1.1.1, address: 100.31.1.13
    1 Neighbors, flooding to 1, adjacent with 1
    Timer intervals: Hello 10, Dead 40, Wait 40, Retransmit 5
      Hello timer due in 00:00:06
    No authentication
    Number of opaque link LSAs: 0, checksum sum 0

Now, I can see the routing table changed like below.

s1# show ip route

1.1.1.1/32, ubest/mbest: 2/0, attached

    *via 1.1.1.1, Lo0, [0/0], 00:07:12, local

    *via 1.1.1.1, Lo0, [0/0], 00:07:12, direct

2.2.2.2/32, ubest/mbest: 1/0

    *via 100.21.2.11, Eth1/1, [110/41], 00:06:11, ospf-1, intra

3.3.3.3/32, ubest/mbest: 1/0

    *via 100.21.2.11, Eth1/1, [110/81], 00:05:29, ospf-1, intra

100.21.0.0/16, ubest/mbest: 1/0, attached

    *via 100.21.1.11, Eth1/1, [0/0], 00:07:13, direct

100.21.1.11/32, ubest/mbest: 1/0, attached

    *via 100.21.1.11, Eth1/1, [0/0], 00:07:13, local

100.31.0.0/16, ubest/mbest: 1/0, attached

    *via 100.31.1.13, Eth1/3, [0/0], 00:07:12, direct

100.31.1.13/32, ubest/mbest: 1/0, attached

    *via 100.31.1.13, Eth1/3, [0/0], 00:07:12, local

100.32.0.0/16, ubest/mbest: 1/0

    *via 100.21.2.11, Eth1/1, [110/80], 00:05:29, ospf-1, intra

 

6. (Option 2) Adjust the auto-cost reference bandwidth to change the path.

 

Auto-cost reference-bandwidth is the global parameter. Therefore, I change this value on s1 switch. There is no effect. Also there is no effect even if I change the value on s2 switch.

In this post, I will show how this value is changed.

s1(config)# router ospf 1
s1(config-router)# auto-cost reference-bandwidth 10000
s1(config-router)# exit

I can verify the ospf information 

s1# show ip ospf

 Routing Process 1 with ID 1.1.1.1 VRF default

 Routing Process Instance Number 1

 Stateful High Availability enabled

 Graceful-restart is configured

   Grace period: 60 state: Inactive

   Last graceful restart exit status: None

 Supports only single TOS(TOS0) routes

 Supports opaque LSA

 Administrative distance 110

 Reference Bandwidth is 10000 Mbps

Therefore, the routing table will be changed like below.

s1# show ip route

1.1.1.1/32, ubest/mbest: 2/0, attached

    *via 1.1.1.1, Lo0, [0/0], 00:18:15, local

    *via 1.1.1.1, Lo0, [0/0], 00:18:15, direct

2.2.2.2/32, ubest/mbest: 1/0

    *via 100.21.2.11, Eth1/1, [110/11], 00:02:25, ospf-1, intra

3.3.3.3/32, ubest/mbest: 1/0

    *via 100.31.3.13, Eth1/3, [110/11], 00:02:25, ospf-1, intra

100.21.0.0/16, ubest/mbest: 1/0, attached

    *via 100.21.1.11, Eth1/1, [0/0], 00:18:16, direct

100.21.1.11/32, ubest/mbest: 1/0, attached

    *via 100.21.1.11, Eth1/1, [0/0], 00:18:16, local

100.31.0.0/16, ubest/mbest: 1/0, attached

    *via 100.31.1.13, Eth1/3, [0/0], 00:18:15, direct

100.31.1.13/32, ubest/mbest: 1/0, attached

    *via 100.31.1.13, Eth1/3, [0/0], 00:18:15, local

100.32.0.0/16, ubest/mbest: 2/0

    *via 100.21.2.11, Eth1/1, [110/50], 00:02:25, ospf-1, intra

    *via 100.31.3.13, Eth1/3, [110/50], 00:02:25, ospf-1, intra

 

7. (Option 3) Adjust the ip ospf cost to change the path.

 

This is more effective way. However, I do not recommand this way. Because this can make complexity. In this instruction, it show how to configure. This configuration will be done on each interface.

s1(config)# inter ethernet 1/3
s1(config-if)# ip ospf cost 100
s1(config-if)# exit

 

This is the result on s1 switch

s1# show ip ospf interface ethernet 1/3

 Ethernet1/3 is up, line protocol is up

    IP address 100.31.1.13/16

    Process ID 1 VRF default, area 0.0.0.0

    Enabled by interface configuration

    State BDR, Network type BROADCAST, cost 100

    Index 3, Transmit delay 1 sec, Router Priority 1

    Designated Router ID: 3.3.3.3, address: 100.31.3.13

    Backup Designated Router ID: 1.1.1.1, address: 100.31.1.13

    1 Neighbors, flooding to 1, adjacent with 1

    Timer intervals: Hello 10, Dead 40, Wait 40, Retransmit 5

      Hello timer due in 00:00:03

    No authentication

    Number of opaque link LSAs: 0, checksum sum 0

Now, the path will be adjusted like below.

The routing table for s1 will be changed like below.

s1# show ip route

1.1.1.1/32, ubest/mbest: 2/0, attached

    *via 1.1.1.1, Lo0, [0/0], 00:24:35, local

    *via 1.1.1.1, Lo0, [0/0], 00:24:35, direct

2.2.2.2/32, ubest/mbest: 1/0

    *via 100.21.2.11, Eth1/1, [110/41], 00:04:23, ospf-1, intra

3.3.3.3/32, ubest/mbest: 1/0

    *via 100.21.2.11, Eth1/1, [110/81], 00:01:52, ospf-1, intra

100.21.0.0/16, ubest/mbest: 1/0, attached

    *via 100.21.1.11, Eth1/1, [0/0], 00:24:36, direct

100.21.1.11/32, ubest/mbest: 1/0, attached

    *via 100.21.1.11, Eth1/1, [0/0], 00:24:36, local

100.31.0.0/16, ubest/mbest: 1/0, attached

    *via 100.31.1.13, Eth1/3, [0/0], 00:24:35, direct

100.31.1.13/32, ubest/mbest: 1/0, attached

    *via 100.31.1.13, Eth1/3, [0/0], 00:24:35, local

100.32.0.0/16, ubest/mbest: 1/0

    *via 100.21.2.11, Eth1/1, [110/80], 00:01:52, ospf-1, intra

This is the OSPF cost concept.

 

Reference

 

[ 1 ] https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/15986-admin-distance.html

[ 2 ] http://www.informit.com/articles/article.aspx?p=26129&seqNum=7

[ 3 ] https://www.computernetworkingnotes.com/ccna-study-guide/ospf-metric-cost-calculation-formula-explained.html

[ 4 ] https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus5500/sw/command/reference/unicast/n5500-ucast-cr/n5k-ospf_cmds_a.pdf

[ 5 ] https://www.ciscolive.com/c/dam/r/ciscolive/us/docs/2012/pdf/BRKARC-3472.pdf

[ 6 ] https://www.cisco.com/c/en/us/td/docs/switches/datacenter/sw/5_x/nx-os/interfaces/configuration/guide/if_cli/if_layer3int.html

[ 7 ] https://community.cisco.com/t5/networking-documents/how-to-configure-ospf-cost/ta-p/3133153

How to work BGP synchronize and next hop self with Nexus?

 

I have already written about BGP concept simply in this another blog in Korean. For the BGP synchronization, I have also written in this blog in Korean. For Next hop self concept, this blog will be helpful. Please do not worry even if you can not read Korean. In this post, I will reproduce this synchorization and next-hop-self with nexus switches.

 

1. Pre-requisite

 

This is my environment for this post. I will configure step by step with below. For "OSPF1 + AS1" part

s1 (lo1 110.0.0.1)

s2 (lo1 110.0.0.2)

s3 (lo1 110.0.0.3)

feature ospf

feature bgp

interface Ethernet1/2

  no switchport

  ip address 100.21.1.12/16

  ip router ospf 1 area 0.0.0.1

  no shutdown

interface Ethernet1/3

  no switchport

  ip address 100.31.1.13/16

  ip router ospf 1 area 0.0.0.1

  no shutdown

interface loopback0

  ip address 110.0.0.1/32

  ip router ospf 1 area 0.0.0.1

router ospf 1

  router-id 110.0.0.1

feature ospf

feature bgp

interface Ethernet1/1

  no switchport

  ip address 100.42.2.11/16

  no shutdown

interface Ethernet1/2

  no switchport

  ip address 100.21.2.12/16

  ip router ospf 1 area 0.0.0.1

  no shutdown

interface loopback0

  ip address 110.0.0.2/32

  ip router ospf 1 area 0.0.0.1

router ospf 1

  router-id 110.0.0.2

router bgp 1

  router-id 110.0.0.2

  log-neighbor-changes

  address-family ipv4 unicast

    network 110.0.0.2/32

  neighbor 100.42.4.11

    remote-as 2

    log-neighbor-changes

    update-source loopback0

    address-family ipv4 unicast

  neighbor 110.0.0.3

    remote-as 1

    update-source loopback0

    address-family ipv4 unicast

feature ospf

feature bgp

interface Ethernet1/1

  no switchport

  ip address 100.63.3.11/16

  no shutdown

interface Ethernet1/3

  no switchport

  ip address 100.31.3.13/16

  ip router ospf 1 area 0.0.0.1

  no shutdown

interface loopback0

  ip address 110.0.0.3/32

  ip router ospf 1 area 0.0.0.1

router ospf 1

  router-id 110.0.0.3

router bgp 1

  router-id 110.0.0.3

  address-family ipv4 unicast

    network 110.0.0.3/32

  neighbor 100.63.6.11

    remote-as 3

    update-source loopback0

    address-family ipv4 unicast

  neighbor 110.0.0.2

    remote-as 1

    update-source loopback0

    address-family ipv4 unicast

For "OSPF2 + AS2" part

s4 (lo1 110.0.0.4)

s5 (lo1 110.0.0.5)

feature ospf

feature bgp

interface Ethernet1/1

  no switchport

  ip address 100.42.4.11/16

  no shutdown

interface Ethernet1/2

  no switchport

  ip address 100.54.4.12/16

  ip router ospf 2 area 0.0.0.2

  no shutdown

interface loopback0

  ip address 110.0.0.4/32

router ospf 2

  router-id 110.0.0.4

router bgp 2

  router-id 110.0.0.4

  log-neighbor-changes

  address-family ipv4 unicast

    network 110.0.0.4/32

  neighbor 100.42.2.11

    remote-as 1

    log-neighbor-changes

    address-family ipv4 unicast

  neighbor 110.42.2.11

    address-family ipv4 unicast

feature ospf

feature bgp

interface Ethernet1/2

  no switchport

  ip address 100.54.5.12/16

  ip router ospf 2 area 0.0.0.2

  no shutdown

interface loopback0

  ip address 110.0.0.5/32

  ip router ospf 2 area 0.0.0.2

router ospf 2

  router-id 110.0.0.5

For "OSPF3 + AS3" part

s6 (lo1 110.0.0.6)

s7 (lo1 110.0.0.7)

feature ospf

feature bgp

interface Ethernet1/1

  no switchport

  ip address 100.63.6.11/16

  no shutdown

interface Ethernet1/2

  no switchport

  ip address 100.76.6.12/16

  ip router ospf 3 area 0.0.0.3

  no shutdown

interface loopback0

  ip address 110.0.0.6/32

router ospf 3

  router-id 110.0.0.6

router bgp 3

  router-id 110.0.0.6

  log-neighbor-changes

  address-family ipv4 unicast

    network 110.0.0.6/32

  neighbor 100.63.3.11

    remote-as 1

    address-family ipv4 unicast

feature ospf

feature bgp

interface Ethernet1/2

  no switchport

  ip address 100.76.7.12/16

  ip router ospf 3 area 0.0.0.3

  no shutdown

interface loopback0

  ip address 110.0.0.7/32

  ip router ospf 3 area 0.0.0.3

router ospf 3

  router-id 110.0.0.7

This is simple configuration. At this time, it is not perfect in traffic flow. In some case, it can not send each other. For example, S4 (110.0.0.4) and S6 (110.0.0.6) can not transfer the packets each other.

 

2. About BGP synchroization.

 

To verify the BGP synchronization, I have to look the BGP table on S3 switch.

s3# show ip bgp

BGP routing table information for VRF default, address family IPv4 Unicast

BGP table version is 16, Local Router ID is 110.0.0.3

Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best

Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i

njected

Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - b

est2

   Network            Next Hop            Metric     LocPrf     Weight Path

*>i110.0.0.2/32       110.0.0.2                         100          0 i

*>l110.0.0.3/32       0.0.0.0                           100      32768 i

  i110.0.0.4/32       100.42.4.11                       100          0 2 i

*>e110.0.0.6/32       100.63.6.11                                    0 3 i

This is so strange. Because I did not "no synchorization" in BGP configuration, "110.0.0.4" should not be displayed. In this blog, the concept of the synchronization will be explained.

I used nexus switch image for this generation. In this instruction, there are default settings. By these values, the BGP table on S3 switch displayed S4 information.

 

3. About Next-Hop-Self.

 

This is not vaild status, even if the BGP table show S4 information. It looks like normal. 

s3# show ip bgp

BGP routing table information for VRF default, address family IPv4 Unicast

BGP table version is 16, Local Router ID is 110.0.0.3

Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best

Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i

njected

Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - b

est2

   Network            Next Hop            Metric     LocPrf     Weight Path

*>i110.0.0.2/32       110.0.0.2                         100          0 i

*>l110.0.0.3/32       0.0.0.0                           100      32768 i

  i110.0.0.4/32       100.42.4.11                       100          0 2 i

*>e110.0.0.6/32       100.63.6.11                                    0 3 i

I need to check the "Next Hop" status. "100.42.4.11" is the IP address between S2 and S4. In the routing table on S3, there is no information.

s3# show ip route

IP Route Table for VRF "default"

'*' denotes best ucast next-hop

'**' denotes best mcast next-hop

'[x/y]' denotes [preference/metric]

'%' in via output denotes VRF 

100.21.0.0/16, ubest/mbest: 1/0

    *via 100.31.1.13, Eth1/3, [110/80], 1d03h, ospf-1, intra

100.31.0.0/16, ubest/mbest: 1/0, attached

    *via 100.31.3.13, Eth1/3, [0/0], 1d04h, direct

100.31.3.13/32, ubest/mbest: 1/0, attached

    *via 100.31.3.13, Eth1/3, [0/0], 1d04h, local

100.63.0.0/16, ubest/mbest: 1/0, attached

    *via 100.63.3.11, Eth1/1, [0/0], 1d04h, direct

100.63.3.11/32, ubest/mbest: 1/0, attached

    *via 100.63.3.11, Eth1/1, [0/0], 1d04h, local

110.0.0.1/32, ubest/mbest: 1/0

    *via 100.31.1.13, Eth1/3, [110/41], 1d03h, ospf-1, intra

110.0.0.2/32, ubest/mbest: 1/0

    *via 100.31.1.13, Eth1/3, [110/81], 1d03h, ospf-1, intra

110.0.0.3/32, ubest/mbest: 2/0, attached

    *via 110.0.0.3, Lo0, [0/0], 1d04h, local

    *via 110.0.0.3, Lo0, [0/0], 1d04h, direct

110.0.0.6/32, ubest/mbest: 1/0

    *via 100.63.6.11, [20/0], 1d02h, bgp-1, external, tag 3

It is not valid because the nexthop is not valid. To resolve this, there is the 2 ways. First, add the static route. Second, Next-hop-self.

# Add static route on s3

s3(config)# ip route 100.42.0.0/16 110.0.0.1

And then, I can see the BGP table. The status should be changed by valid.

s3# show ip bgp

BGP routing table information for VRF default, address family IPv4 Unicast

BGP table version is 17, Local Router ID is 110.0.0.3

Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best

Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i

njected

Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - b

est2

   Network            Next Hop            Metric     LocPrf     Weight Path

*>i110.0.0.2/32       110.0.0.2                         100          0 i

*>l110.0.0.3/32       0.0.0.0                           100      32768 i

*>i110.0.0.4/32       100.42.4.11                       100          0 2 i

*>e110.0.0.6/32       100.63.6.11                                    0 3 i

Now, I will configure "next-hop-self" on s2 switch after remove static route on s3 switch.

# Remove static route on s3

s3(config)# no ip route 100.42.0.0/16 110.0.0.1 

 

# Add next hop self configuratoin on s2

s2(config)# router bgp 1
s2(config-router)# neighbor 110.0.0.3
s2(config-router-neighbor)# address-family ipv4 unicast
s2(config-router-neighbor-af)# next-hop-self
s2(config-router-neighbor-af)# end

Now look at the s3 switch with "show ip bgp" command

s3# show ip bgp

BGP routing table information for VRF default, address family IPv4 Unicast

BGP table version is 19, Local Router ID is 110.0.0.3

Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best

Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i

njected

Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - b

est2

   Network            Next Hop            Metric     LocPrf     Weight Path

*>i110.0.0.2/32       110.0.0.2                         100          0 i

*>l110.0.0.3/32       0.0.0.0                           100      32768 i

*>i110.0.0.4/32       110.0.0.2                         100          0 2 i

*>e110.0.0.6/32       100.63.6.11                                    0 3 i

There are 2 change. First, the status is changed as the valid. Second the next hop ip address is changed from "100.42.4.11" to "110.0.0.2". This "next-hop-self" feature make the "ebgp" existance clear. Now I will do again in s3 switch for next step.

s3(config)# router bgp 1

s3(config-router)# nei 110.0.0.2

s3(config-router-neighbor)# address-family ipv4 unicast

s3(config-router-neighbor-af)# next-hop-self

s3(config-router-neighbor-af)# exit

 

4. Troubleshooting.

 

Look at routing table and bgp table on the s4 switch and s6 switch. From s4 switch,

s4# show ip route

IP Route Table for VRF "default"

'*' denotes best ucast next-hop

'**' denotes best mcast next-hop

'[x/y]' denotes [preference/metric]

'%' in via output denotes VRF 

100.42.0.0/16, ubest/mbest: 1/0, attached

    *via 100.42.4.11, Eth1/1, [0/0], 1d04h, direct

100.42.4.11/32, ubest/mbest: 1/0, attached

    *via 100.42.4.11, Eth1/1, [0/0], 1d04h, local

100.54.0.0/16, ubest/mbest: 1/0, attached

    *via 100.54.4.12, Eth1/2, [0/0], 1d04h, direct

100.54.4.12/32, ubest/mbest: 1/0, attached

    *via 100.54.4.12, Eth1/2, [0/0], 1d04h, local

110.0.0.2/32, ubest/mbest: 1/0

    *via 100.42.2.11, [20/0], 1d02h, bgp-2, external, tag 1

110.0.0.3/32, ubest/mbest: 1/0

    *via 100.42.2.11, [20/0], 1d02h, bgp-2, external, tag 1

110.0.0.4/32, ubest/mbest: 2/0, attached

    *via 110.0.0.4, Lo0, [0/0], 1d04h, local

    *via 110.0.0.4, Lo0, [0/0], 1d04h, direct

110.0.0.5/32, ubest/mbest: 1/0

    *via 100.54.5.12, Eth1/2, [110/41], 00:40:49, ospf-2, intra

110.0.0.6/32, ubest/mbest: 1/0

    *via 100.42.2.11, [20/0], 00:03:43, bgp-2, external, tag 1

s4# show ip bgp

BGP routing table information for VRF default, address family IPv4 Unicast

BGP table version is 12, Local Router ID is 110.0.0.4

Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best

Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i

njected

Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - b

est2

   Network            Next Hop            Metric     LocPrf     Weight Path

*>e110.0.0.2/32       100.42.2.11                                    0 1 i

*>e110.0.0.3/32       100.42.2.11                                    0 1 i

*>l110.0.0.4/32       0.0.0.0                           100      32768 i

*>e110.0.0.6/32       100.42.2.11                                    0 1 3 i

From s6 switch,

s6# show ip route

IP Route Table for VRF "default"

'*' denotes best ucast next-hop

'**' denotes best mcast next-hop

'[x/y]' denotes [preference/metric]

'%' in via output denotes VRF 

100.63.0.0/16, ubest/mbest: 1/0, attached

    *via 100.63.6.11, Eth1/1, [0/0], 1d04h, direct

100.63.6.11/32, ubest/mbest: 1/0, attached

    *via 100.63.6.11, Eth1/1, [0/0], 1d04h, local

100.76.0.0/16, ubest/mbest: 1/0, attached

    *via 100.76.6.12, Eth1/2, [0/0], 1d04h, direct

100.76.6.12/32, ubest/mbest: 1/0, attached

    *via 100.76.6.12, Eth1/2, [0/0], 1d04h, local

110.0.0.2/32, ubest/mbest: 1/0

    *via 100.63.3.11, [20/0], 1d02h, bgp-3, external, tag 1

110.0.0.3/32, ubest/mbest: 1/0

    *via 100.63.3.11, [20/0], 1d02h, bgp-3, external, tag 1

110.0.0.4/32, ubest/mbest: 1/0

    *via 100.63.3.11, [20/0], 00:10:28, bgp-3, external, tag 1

110.0.0.6/32, ubest/mbest: 2/0, attached

    *via 110.0.0.6, Lo0, [0/0], 1d04h, local

    *via 110.0.0.6, Lo0, [0/0], 1d04h, direct

110.0.0.7/32, ubest/mbest: 1/0

    *via 100.76.7.12, Eth1/2, [110/41], 00:44:12, ospf-3, intra

s6# show ip bgp

BGP routing table information for VRF default, address family IPv4 Unicast

BGP table version is 15, Local Router ID is 110.0.0.6

Status: s-suppressed, x-deleted, S-stale, d-dampened, h-history, *-valid, >-best

Path type: i-internal, e-external, c-confed, l-local, a-aggregate, r-redist, I-i

njected

Origin codes: i - IGP, e - EGP, ? - incomplete, | - multipath, & - backup, 2 - b

est2

   Network            Next Hop            Metric     LocPrf     Weight Path

*>e110.0.0.2/32       100.63.3.11                                    0 1 i

*>e110.0.0.3/32       100.63.3.11                                    0 1 i

*>e110.0.0.4/32       100.63.3.11                                    0 1 2 i

*>l110.0.0.6/32       0.0.0.0                           100      32768 i

By these informations, I may send traffic each other. However, I can not. Please look at the below, I send the traffic from s4 to s6.

s4# ping 110.0.0.6 source-interface loopback 0

PING 110.0.0.6 (110.0.0.6): 56 data bytes

Request 0 timed out

 

--- 110.0.0.6 ping statistics ---

2 packets transmitted, 0 packets received, 100.00% packet loss

I have to check the routing table s2 and s3 also. They have also information.

s2# show ip route
110.0.0.4/32, ubest/mbest: 1/0
    *via 100.42.4.11, [20/0], 1d03h, bgp-1, external, tag 2
110.0.0.6/32, ubest/mbest: 1/0
    *via 110.0.0.3, [200/0], 00:09:44, bgp-1, internal, tag 3

s3# show ip route
110.0.0.4/32, ubest/mbest: 1/0
    *via 110.0.0.2, [200/0], 00:14:14, bgp-1, internal, tag 2
110.0.0.6/32, ubest/mbest: 1/0
    *via 100.63.6.11, [20/0], 1d02h, bgp-1, external, tag 3

Now, only s1 switch has been left. In s1 switch, I did not configure for BGP. Because of this, s1 can not get any information for s4 and s6. Now I will add static route simply on s1 switch.

s1(config)# ip route 110.0.0.4/32 110.0.0.2

s1(config)# ip route 110.0.0.5/32 110.0.0.2

s1(config)# ip route 110.0.0.6/32 110.0.0.3

s1(config)# ip route 110.0.0.7/32 110.0.0.3

After this configuration add, I can send the traffic

s4# ping 110.0.0.6 source-interface loopback 0

PING 110.0.0.6 (110.0.0.6): 56 data bytes

64 bytes from 110.0.0.6: icmp_seq=0 ttl=251 time=20.858 ms

64 bytes from 110.0.0.6: icmp_seq=1 ttl=251 time=12.801 ms

64 bytes from 110.0.0.6: icmp_seq=2 ttl=251 time=25.59 ms

64 bytes from 110.0.0.6: icmp_seq=3 ttl=251 time=13.339 ms

64 bytes from 110.0.0.6: icmp_seq=4 ttl=251 time=12.694 ms

--- 110.0.0.6 ping statistics ---

5 packets transmitted, 5 packets received, 0.00% packet loss

round-trip min/avg/max = 12.694/17.056/25.59 ms

 

Reference

 

[ 1 ] https://blog.naver.com/happy_jhyo/70151060540

[ 2 ] https://blog.naver.com/happy_jhyo/221284566856

[ 3 ] http://www.nnk.com.au/index.php?option=com_content&view=article&id=22:bgp-synchronization&catid=3:articles&Itemid=5

[ 4 ] https://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus9000/sw/6-x/unicast/configuration/guide/l3_cli_nxos/l3_bgp.html

 

What is basic BGP community concept?

 

This instruction is good reference. In fact, I will analysis this instruction. BGP community is used for filtering and tagging information over routing information. Therefore, routing table information will be controlled by these condistions. Thus I can select the routing information to advertise or update in the table.

 

1. Pre-requiste (Basic BGP configuration)

This is my environment for this post. 

S1 S2 S3 S4

interface Ethernet1/1 

  no switchport 

  ip address 100.12.1.11/16 

  no shutdown 

interface loopback0 

  ip address 1.1.1.1/32 

interface loopback1 

  ip address 11.11.11.11/32 

!  

router bgp 1 

  router-id 1.1.1.1 

  log-neighbor-changes 

  address-family ipv4 unicast 

    network 1.1.1.1/32 

    network 11.11.11.11/32 

  neighbor 100.12.2.11 

    remote-as 2 

    update-source Ethernet1/1 

    address-family ipv4 unicast

interface Ethernet1/1

  no switchport

  ip address 100.12.2.11/16

  no shutdown

interface Ethernet1/2

  no switchport

  ip address 100.23.2.12/16

  no shutdown

!

interface loopback0

  ip address 2.2.2.2/32

!

interface loopback1

  ip address 22.22.22.22/32

!  

router bgp 2

  router-id 2.2.2.2

  log-neighbor-changes

  address-family ipv4 unicast

    network 2.2.2.2/32

    network 22.22.22.22/32

  neighbor 100.12.1.11

    remote-as 1

    update-source Ethernet1/1

    address-family ipv4 unicast

  neighbor 100.23.3.12

    remote-as 3

    update-source Ethernet1/2

    address-family ipv4 unicast

interface Ethernet1/2

  no switchport

  ip address 100.23.3.12/16

  no shutdown

interface Ethernet1/3

  no switchport

  ip address 100.34.3.13/16

  no shutdown

!

interface loopback0

  ip address 3.3.3.3/32

!

interface loopback1

  ip address 33.33.33.33/32

!

router bgp 3

  router-id 3.3.3.3

  log-neighbor-changes

  address-family ipv4 unicast

    network 3.3.3.3/32

    network 33.33.33.33/32

  neighbor 100.23.2.12

    remote-as 2

    update-source Ethernet1/2

    address-family ipv4 unicast

  neighbor 100.34.4.13

    remote-as 4

    update-source Ethernet1/3

    address-family ipv4 unicast

interface Ethernet1/3

  no switchport

  ip address 100.34.4.13/16

  no shutdown

!

interface loopback0

  ip address 4.4.4.4/32

!

interface loopback1

  ip address 44.44.44.44/32

!

router bgp 4

  router-id 4.4.4.4

  log-neighbor-changes

  address-family ipv4 unicast

    network 4.4.4.4/32

    network 44.44.44.44/32

  neighbor 100.34.3.13

    remote-as 3

    update-source Ethernet1/3

    address-family ipv4 unicast

For nexus, "address-family ipv4 unicast" in neighbor parameter and "address-familiy ipv4 unicast" in global parameter are necessary to advertise to the peer. After configure these, I can verify the routing table and BGP information. From S2

From S3,

From S4

I can confirm that the information from S1 such as "1.1.1.1" and "11.11.11.11" are advertised to S2, S3 and S4.

 

2. Configure send community

 

To use the BGP community, I have to configure "send community". There are 2 types, standard and extended. In this struction, the extended community has more information such as VPN services.

I will added the configuration like below.

S1 S2 S3 S4

router bgp 1

  neighbor 100.12.2.11

    address-family ipv4 unicast

      send-community both

router bgp 2

  neighbor 100.12.1.11

    address-family ipv4 unicast

send-community both

  neighbor 100.23.3.12

    address-family ipv4 unicast

send-community both

router bgp 3

  neighbor 100.23.2.12

    address-family ipv4 unicast

send-community both

  neighbor 100.34.4.13

    address-family ipv4 unicast

send-community both

router bgp 4

  neighbor 100.34.3.13

    address-family ipv4 unicast

send-community both 

Please note that there are any differences of routing table after these configuration above.

 

3. Configure Route-map in and out

 

To use the BGP community, the route-map is necessary. This route-map affect the routing table. In S3, I will add "route-map" configuration.

!

router bgp 1

neighbor 100.12.2.11

address-family ipv4 unicast

route-map to-remote-as2 out

end

!

"route-map to-remote-as2 out" mean that routing information to transfer out will be controlled with this route-map. Therefore, after this configuration, the routing table will be changed. "1.1.1.1" and  "11.11.11.11" are removed

Now, I will add the policy to set community.

ip prefix-list ip-prefix-1 seq 10 permit 1.1.1.1/32
ip prefix-list ip-prefix-2 seq 10 permit 11.11.11.11/32
route-map to-remote-as2 permit 10
  match ip address prefix-list ip-prefix-1
  set community 12:130
route-map to-remote-as2 permit 20
  match ip address prefix-list ip-prefix-2
  set community 12:150

I check the routing table from S4. "1.1.1.1" and "11.11.11.11" will be updated. 

And I can see more detail. I can see the community values are changed on each.

So far, I learn how to set the community with BGP. From now, I will handle how to get the community and use this. This is so similar with above. I will add configure into the S2.

!

router bgp 2

neighbor 100.12.1.11

address-family ipv4 unicast

route-map from-remote-as1 in

end

!

After configure this, the routing table will be changed. "1.1.1.1" and "11.11.11.11" are removed again.

Now, I will add some configuration to get community and use it in S2

ip community-list expanded community-1 seq 1 permit "12:130"

ip community-list expanded community-2 seq 1 permit "12:150"

route-map from-remote-as1 permit 10

  match community community-1

  set local-preference 130

route-map from-remote-as1 permit 20

  match community community-2

  set local-preference 150

These configuration effect S2 routing table like below.

However, it does not effect S3 and S4, even if the community value is left.

 

Reference

 

[ 1 ] https://www.cisco.com/c/en/us/support/docs/ip/border-gateway-protocol-bgp/28784-bgp-community.html

[ 2 ] http://www.ciscopress.com/articles/article.asp?p=2756480&seqNum=12

[ 3 ] https://blog.naver.com/happy_jhyo/221291791846

How does the multicast (PIM sparse mode) work with MSDP? 

 

In this post, I will generate the multicast environment with Nx9000v on GNS3. I will handle the multicast with PIM sparse mode.

 

1. Pre-requiste for Test environments

 

I will produce this environment to generate the multicast.

Before I make Multicast environment, I need to prepare NAT for outbound traffic and Multicast test scripts. This is the sample configuration for NAT outbound traffic.

conf t

feature dhcp

feature nat

!

ip nat translation max-entries 1023

!

no ip dhcp relay

no ipv6 dhcp relay

!

inter eth 1/9

no sw

ip add dhcp

ip nat out

no shut

exit

inter et 1/7

no sw

ip add 100.15.5.17/16

ip nat ins

no shut

exit

inter et 1/8

no sw

ip add 100.25.5.18/16

ip nat ins

no shut

exit

!

ip acc 1

10 per ip any any

exit

!

ip nat inside source list 1 interface et1/9 overload

ip route 10.0.0.0/24 100.15.1.17

ip route 10.0.0.0/24 100.25.2.18

ip route 20.0.0.0/24 100.15.1.17

ip route 20.0.0.0/24 100.25.2.18

ip route 100.0.0.0/8 100.15.1.17

ip route 100.0.0.0/8 100.25.2.18

ip route 1.1.1.1/32 100.15.1.17

ip route 1.1.1.1/32 100.25.2.18

ip route 2.2.2.2/32 100.15.1.17

ip route 2.2.2.2/32 100.25.2.18

ip route 3.3.3.3/32 100.15.1.17

ip route 3.3.3.3/32 100.25.2.18

ip route 4.4.4.4/32 100.15.1.17

ip route 4.4.4.4/32 100.25.2.18

end

!

Also I attach the multicast example below

mcast-receiver.py
0.00MB
mcast-sender.py
0.00MB

 

 

2. Configuration for default environment.

 

2-1. Configure Core swtich/router  

 

I will make full-mesh connectivity. There are four switch/router. I will name as s1, s2, s3 and s4. On those switch/router, I will run OSPF routing to announce loopback addresses for Router ID and RP point. 

s1

s2

s3

s4

conf t
!
switchname s1
!
feature ospf
router ospf 1
router-id 1.1.1.1
exit
!
inter lo 0
ip add 1.1.1.1/32
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/7
no sw
ip add 100.15.1.17/16
no shut
exit
!
inter et 1/1
no sw
ip add 100.12.1.11/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/2
no sw
ip add 100.13.1.12/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/3
no sw
ip add 100.14.1.13/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
ip route 0.0.0.0/0 100.15.5.17
ip route 0.0.0.0/0 100.12.2.11 100
end
!

conf t
!
switchname s2
!
feature ospf
router ospf 1
router-id 2.2.2.2
exit
!
inter lo 0
ip add 2.2.2.2/32
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/8
no sw
ip add 100.25.2.18/16
no shut
exit
!
inter et 1/1
no sw
ip add 100.12.2.11/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/2
no sw
ip add 100.24.2.12/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/3
no sw
ip add 100.23.2.13/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
ip route 0.0.0.0/0 100.25.5.18
ip route 0.0.0.0/0 100.12.1.11 100
end
!

conf t
!
switchname s3
!
feature ospf
router ospf 1
router-id 3.3.3.3
exit
!
inter lo 0
ip add 3.3.3.3/32
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/1
no sw
ip add 100.34.3.11/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/2
no sw
ip add 100.13.3.12/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/3
no sw
ip add 100.23.3.13/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
ip route 0.0.0.0/0 1.1.1.1
ip route 0.0.0.0/0 2.2.2.2
!
vlan 10
name vlan10
exit
!
feature interface-vlan
inter vlan10
no shut
ip add 10.0.0.1/24
exit
!
inter et 1/7, et 1/8
sw mode ac
sw ac vlan 10
no shut
exit
!

----------------------------------
!
conf t
!
inter vlan 10
ip router ospf 1 area 0.0.0.0
exit
!
---------------------------------- 
conf t
!
feature pim
!
ip pim rp-address 99.99.99.99
!
inter eth 1/1, eth 1/2, eth 1/3
ip pim sparse-mode
exit
!
inter vlan 10
ip pim sparse-mode
exit
!

conf t
!
switchname s4
!
feature ospf
router ospf 1
router-id 4.4.4.4
exit
!
inter lo 0
ip add 4.4.4.4/32
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/1
no sw
ip add 100.34.4.11/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/2
no sw
ip add 100.24.4.12/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
inter et 1/3
no sw
ip add 100.14.4.13/16
ip router ospf 1 area 0.0.0.0
no shut
exit
!
ip route 0.0.0.0/0 1.1.1.1
ip route 0.0.0.0/0 2.2.2.2
!
vlan 20
name vlan20
exit
!
feature interface-vlan
inter vlan20
no shut
ip add 20.0.0.1/24
exit
!
inter et 1/7
sw mode ac
sw ac vlan 20
no shut
exit
!

----------------------------------
!
conf t
!
inter vlan 20
ip router ospf 1 area 0.0.0.0
exit
!
---------------------------------- 
conf t
!
feature pim
!
ip pim rp-address 99.99.99.99
!
inter eth 1/1, eth 1/2, eth 1/3
ip pim sparse-mode
exit
!
inter vlan 20
ip pim sparse-mode
exit
!

In s1 and s2, there are 2 kinds of loopback addresses. One is for the switch/router ID, the other is for the RP address. For loopback address for RP, I will utilize "ghost loopback address" method. Please look at the loopback interface 1 in s1 and s2.

s1 s2

conf t
!
feature pim
!
inter lo 1
ip address 99.99.99.99/32
ip router ospf 1 area 0.0.0.0
ip ospf network point
ip pim sparse-mode
no shutdown
exit
!
ip pim rp-address 99.99.99.99
!
inter eth 1/1, eth 1/2, eth 1/3
ip pim sparse-mode
exit
!

conf t
!
feature pim
!
inter lo 1
ip address 99.99.99.99/24
ip router ospf 1 area 0.0.0.0
ip ospf network point
ip pim sparse-mode
no shutdown
exit
!
ip pim rp-address 99.99.99.99
!
inter eth 1/1, eth 1/2, eth 1/3
ip pim sparse-mode
exit
!

S1 is the main RP server in normal status. However, it will be changed to s2 when S1 is failed without IP address change. Because of this, I need MSDP (Multicast Source Discovery Protocol). I will handle in later. To announce the network with subnet of loopback interface into OSPF, "Point to Point" is necesary. Now I can see the routing table on S3 and S4 switch/router.

s3# show ip route ospf-1 s4# show ip route ospf-1

1.1.1.1/32, ubest/mbest: 1/0
    *via 100.13.1.12, Eth1/2, [110/41], 3d00h, ospf-1, intra
2.2.2.2/32, ubest/mbest: 1/0
    *via 100.23.2.13, Eth1/3, [110/41], 3d00h, ospf-1, intra
4.4.4.4/32, ubest/mbest: 1/0
    *via 100.34.4.11, Eth1/1, [110/41], 3d00h, ospf-1, intra
20.0.0.0/24, ubest/mbest: 1/0
    *via 100.34.4.11, Eth1/1, [110/80], 03:33:46, ospf-1, intra
99.99.99.0/24, ubest/mbest: 1/0
    *via 100.23.2.13, Eth1/3, [110/41], 00:44:41, ospf-1, intra
99.99.99.99/32, ubest/mbest: 1/0
    *via 100.13.1.12, Eth1/2, [110/41], 00:44:41, ospf-1, intra
100.12.0.0/16, ubest/mbest: 2/0
    *via 100.13.1.12, Eth1/2, [110/80], 3d00h, ospf-1, intra
    *via 100.23.2.13, Eth1/3, [110/80], 3d00h, ospf-1, intra
100.14.0.0/16, ubest/mbest: 2/0
    *via 100.13.1.12, Eth1/2, [110/80], 3d00h, ospf-1, intra
    *via 100.34.4.11, Eth1/1, [110/80], 3d00h, ospf-1, intra
100.24.0.0/16, ubest/mbest: 2/0
    *via 100.23.2.13, Eth1/3, [110/80], 3d00h, ospf-1, intra
    *via 100.34.4.11, Eth1/1, [110/80], 3d00h, ospf-1, intra

1.1.1.1/32, ubest/mbest: 1/0
    *via 100.14.1.13, Eth1/3, [110/41], 3d00h, ospf-1, intra
2.2.2.2/32, ubest/mbest: 1/0
    *via 100.24.2.12, Eth1/2, [110/41], 3d00h, ospf-1, intra
3.3.3.3/32, ubest/mbest: 1/0
    *via 100.34.3.11, Eth1/1, [110/41], 3d00h, ospf-1, intra
10.0.0.0/24, ubest/mbest: 1/0
    *via 100.34.3.11, Eth1/1, [110/80], 03:34:26, ospf-1, intra
99.99.99.0/24, ubest/mbest: 1/0
    *via 100.24.2.12, Eth1/2, [110/41], 00:45:13, ospf-1, intra
99.99.99.99/32, ubest/mbest: 1/0
    *via 100.14.1.13, Eth1/3, [110/41], 00:45:13, ospf-1, intra
100.12.0.0/16, ubest/mbest: 2/0
    *via 100.14.1.13, Eth1/3, [110/80], 3d00h, ospf-1, intra
    *via 100.24.2.12, Eth1/2, [110/80], 3d00h, ospf-1, intra
100.13.0.0/16, ubest/mbest: 2/0
    *via 100.14.1.13, Eth1/3, [110/80], 3d00h, ospf-1, intra
    *via 100.34.3.11, Eth1/1, [110/80], 3d00h, ospf-1, intra
100.23.0.0/16, ubest/mbest: 2/0
    *via 100.24.2.12, Eth1/2, [110/80], 3d00h, ospf-1, intra
    *via 100.34.3.11, Eth1/1, [110/80], 3d00h, ospf-1, intra

In red text above, "100.100.100.100" is the RP address for multicast. At this time, the destination should be s1. It will be changed to s2 by "100.100.100.0/24", when s1 is failed.


2-2. Configure the Host (PC, Labtop) network.

 

s3 and s4 is the gateway for each host network. In my scenario, I will use "10.0.0.0/24" for PC1 and "20.0.0.0/24" for PC2.

I have already done for the gateway above.

S3

S4

!

conf t

!

inter vlan 10

ip router ospf 1 area 0.0.0.0

exit

!

inter eth 1/1, eth 1/2, eth 1/3

ip pim sparse-mode

exit

!

inter vlan 10

ip pim sparse-mode

exit

!

!

conf t

!

inter vlan 20

ip router ospf 1 area 0.0.0.0

exit

!

inter eth 1/1, eth 1/2, eth 1/3

ip pim sparse-mode

exit

!

inter vlan 20

ip pim sparse-mode

exit

!

Now I will configure the PC network interface. In my case I will use "Ubuntu Desktop". In this instruction, I can see how to install "ubuntu" in GNS3. After installation, I can open the console like below.

After login, I can set the network interface like below. I need to update file in "/etc/network/interfaces".

After set both of hosts, I can send ICMP packet each other.

 

However, there is one more thing necessary. To Join and receive the multicast packet. I need to define the IGMP version on Linux host sometimes. This instruction will be helpful.

echo "2" >> /proc/sys/net/ipv4/conf/<interface>/force_igmp_version

In my case, Host 2 and Host 3 will be receiver, therefore it will be like below

 

3. Configuraton for Multicast environment.

 

3-1. Configure for default multicast 

 

In fact, I have already done for multicast routing, if you follow sample configuration. This instruction will be helpful to understand how to configure.

S1 S2 S3 S4

conf t

!

feature pim

!

inter lo 1

ip address 99.99.99.99/32

ip router ospf 1 area 0.0.0.0

ip ospf network point

ip pim sparse-mode

no shutdown

exit

!

ip pim rp-address 99.99.99.99

!

inter eth 1/1, eth 1/2, eth 1/3

ip pim sparse-mode

exit

!

conf t

!

feature pim

!

inter lo 1

ip address 99.99.99.99/24

ip router ospf 1 area 0.0.0.0

ip ospf network point

ip pim sparse-mode

no shutdown

exit

!

ip pim rp-address 99.99.99.99

!

inter eth 1/1, eth 1/2, eth 1/3

ip pim sparse-mode

exit

!

conf t

!

feature pim

!

ip pim rp-address 99.99.99.99

!

inter eth 1/1, eth 1/2, eth 1/3

ip pim sparse-mode

exit

!

inter vlan 10

ip pim sparse-mode

exit

!

conf t

!

feature pim

!

ip pim rp-address 99.99.99.99

!

inter eth 1/1, eth 1/2, eth 1/3

ip pim sparse-mode

exit

!

inter vlan 20

ip pim sparse-mode

exit

!

Now, I can test multicast routing with sample script. I can get the result like below.

I success to send multicast traffic. However, I still leave MSDP. "99.99.99.99" is the RP which is S1. I worry the S1 fail situation. MSDP is one of good solution. Please read next step.

 

3-2. Configure for MSDP.

 

Before, I configure for MSDP. Any information was not shared each other. (S1 and S2 are peer connection for MSDP). I run command "show ip msdp route" and "show ip msdp sa-cache".

Because of this, the routing information should be registered again on S2, when S1 is failed. Now, I will follow this instruction. At first, I will MSDP configuration to share source information between s1 and s2.

In above, there is "ip msdp cache-sa-state" command for caching. However, there is no command in Nx9000v in my case. Therefore, my configuration should be below.

s1 s2

feature msdp

ip msdp originator-id loopback0

ip msdp peer 1.1.1.2 connect-source loopback0

feature msdp

ip msdp originator-id loopback0

ip msdp peer 1.1.1.1 connect-source loopback0

I can check the status with "show ip msdp summary

I can also verify the status with again "show ip msdp route" and "show ip msdp sa-cache".

In fact, I can not understand this effect.

 

3-3. Verify the MSDP effect.

 

Before MSDP configuration, I will shutodown loopback 1 (RP) of S1 switch/router. In S2 switch/router, there is no multicast source information.

After sender request, the source information is updated. This is normal case

Now, I will configure MSDP. I will shutdown loopback 1 of switch/router S1 again. In S2,

Multicast routing information is updated directly.

 

Sample Configurations

S1
0.00MB
S2
0.00MB
S3
0.00MB
S4
0.00MB
S5
0.00MB

 

Reference

 

[ 1 ] https://www.osboxes.org/ubuntu/#ubuntu-14_04-vmware

[ 2 ] https://docs.gns3.com/1RpM21DdgL2pCNtIrw6e9Yf52tRjYZIe46LMeESl-jy4/

[ 3 ] https://www.cisco.com/c/en/us/td/docs/ios/12_2/ip/configuration/guide/fipr_c/1cfmsdp.html#wp1000963

[ 4 ] https://createnetech.tistory.com/40?category=672584

[ 5 ] https://pymotw.com/2/socket/multicast.html

[ 6 ] https://sites.google.com/site/miclinuxcorner/technology/multicast-routing

[ 7 ] https://www.cisco.com/c/en/us/support/docs/ip/ip-multicast/9356-48.html#msdp

How SSL/TLS handshake can be done?


In this post, I will analysis the SSL/TLS packet. In fact, I have some chance to see RDP packets. Look at the below. This is RDP packet captures. 



I wrote "How to calculate the sequence number" in this post. In this post, I will only handle how SSL/TLS handshake can be done. Before SSL/TLS handshake, TCP handshake should be established.


1. Client Hello


At first, Client send the "Client Hello" packet. In this packet, there are three important information. Random number, Session ID and Cipher suites


Random number is used to generate "pre-master key" with another random number from server. This "pre-master key" will be used to generate "master key" which encrypt and decrypt the packets.

Cipher suites is the list which the client can support. Thus, the server will select one of this lists.



2. Server Hello.


After receive the client hello, server send the "Server Hello" packet to client. In this packet, there are three important information. Random number, Cipher suite and Certificate with Public key.


Random number is used to generate "pre-master key" with another random number from client.

Cipher suite is the selected item which is one of list from client.

Certificates is the very important parameters. In this values, "Public Key" is included. This "Public Key" is used to encrypt the "pre-master key" before transfer to server.



3. Client Key Exchange


In this step, Client know both random values of client and server. Therefore, client generate the "Pre-master key". Also, client can know public key because of the received certificates. So, client sent the packet which "Pre-master key" is included in. It is encrypted by public key.



4. Server Response.


Finally, the server knows "pre-master key", after decrypting received packet. The server and client will be generate "master key" each by some algorithm. This "master key" is used for encrypt and decrypt the data packet.



5. Data Packet with Encryption.


So, the Data packets are encrypted by this master key. I can see the SSL layer in the packets like below. Data will be encrypted.



Reference


[ 1 ] https://opentutorials.org/course/228/4894

[ 2 ] http://createnetech.tistory.com/25

How to calculate sequence number of the TCP/IP packets?


I am the network engineer. Recently, I have some change to remember the sequence number of the TCP/IP packets. Someone include me think that this is not easy. 


1. General Packet Structure.


IP header and TCP header have generally 20 Byte size of the packets. Data payloads can be maximum 1460 Byte size of the packets. 



MSS is the data size, which determine how much can be send at one timeMTU is sum of TCP, IP and MSS (Data)


MSS = Maximum TCP Segment Size in one Packet – usually it is 1460 + 20 (TCP Header) + 20 (IP Header) = MTU =1500 + 18 (DLC Header) and you have a full frame of 1518 bytes.


2. IP header Structure


I have told "IP header is 20 Byte". However, IP header is not fixable. It can be increased by optional values up to 60 Byte.  In this header, there are three point which I need to focus on.



Length field shows how much size of IP header. Identification field is one of mark. This is the unique value which is not changed from source to destinationIn this link, I can see more detail of the Protocol field.



3. TCP header structure.


TCP header is also not fixable. It can be max 60 Byte. In TCP header, there are sequence number, acknowledge number and window size value.



Windows size value is determined by server environment, such as allocated memory of operating system. It can be increased or decreased. If I suffer from "Zero Window" issue, I have to check the buffer size of host.


4. DLC header structure.


This header shows MAC address generally. In Ethernet field, 0x0800 means IPv4 and 0x08dd means IPv6.



5. Packet sequence analysis for SYN and FIN


For SYN-ACK / FIN-ACK handshake, it is important to add +1 value, even if length of data is zero. Client sent packet with sequence number 0. Therefore, the expect ACK number should 1. Server will send the packet with sequence number 0 and ACK number is 1. For this packet, the expect ACK number should also is 1. Finally, client send last ACK packet with sequence number 1 and ACK number 1.





6. Packet sequence analysis for Data 


For Data, It is little bit different with above. It add only length of data. Look at the below. Fist, sequence number 380 + data length 213 is Expect ACK with number 593.



Second, sequence number 1306 + data length 373 is 1679 with ACK 593 which come from above.



Final, sequence number 593 which equals with ACK number will transfer with ACK 1679.



7. Optional ,SACK (Selective ACK) 


For effective transmission, the selective ACK mechanism is existed. Look at the below. 172.18.0.74 is sender. This sender send the packet with sequence number, 5943, 7403, 8863, 10323, 11784, 13243, and 14703. The data length is 1460. Thus, there is no loss to transfer.



However, Loot at the below. At this time, ACK number is important value. "ACK=10323, SLE=13243, SRE=14703" message means 11783 packet does not exist in the receiver



In the last, re-transmission for sequence 11783 is happen. The ACK number with 11783 is shown.


Reference


[ 1 ] https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

[ 3 ] https://www.networkcomputing.com/network-security/network-troubleshooting-tcp-sack-analysis/2073731643

+ Recent posts