SSF.OS.BGP4 Example: Maintaining a Peering Session

Disclaimer
This implementation of BGP-4 is constantly improving and evolving, and examples are not always immediately updated to reflect the most current version. It is usually (though not always) safe to assume that an example still runs properly, but the DML files and the output files may look different than the way there are described in some of the accompanying documentation.

Compatibility
This example is up-to-date with SSF.OS.BGP4 version 1.1.0.

Conventions
For an explanation of the debugging output used in this example, refer to BGP Debugging Output Conventions.

Overview
Exhibits the behavior of the mechanisms used to keep an existing peering session intact.

Files
primary source:  keep-peer.dml
library source:  dictionary.dml
schema source:   net.dml
raw output:      keep-peer.out

Running
To run this example, SSFNet must be installed and the three source files, as listed in the previous subsection, must be accessible. As an example, if the three source files were together in the same directory, the following command could be used to run the simulation:

    java SSF.Net.Net 300 keep-peer.dml dictionary.dml net.dml

Network Graph

Discussion
The proper behavior of the KeepAlive Timer and the Hold Timer are important to making sure that a session between two peers remains intact over time. This simple example shows how two neighboring BGP speakers maintain their session.

keep-peer.dml is the primary DML source file used for this example. It's about the same as the one from the Terminating a Peering Session example, except that the BGP timer intervals are now the same for each BGP speaker--a key difference. (It may be useful at this point to open that file in a separate window.)

Here's the formatted, abridged version of the output, with a discussion following it:

001> 0.0       bgp@0:0     ID=0.0.0.17   AS#=2  NHI-AS=0     ASprefix=0.0.0.8/29
002> 0.0       bgp@1:0     ID=0.0.0.18   AS#=1  NHI-AS=1     ASprefix=0.0.0.0/29 
003> 4.21E-4   bgp@0:0     snd keepalive to bgp@1:0
004> 4.21E-4   bgp@0:0     rst keepalive timer for bgp@1:0
005> 4.21E-4   bgp@0:0     rst hold timer for bgp@1:0
006> 4.21E-4   bgp@1:0     snd keepalive to bgp@0:0
007> 4.21E-4   bgp@1:0     rst keepalive timer for bgp@0:0
008> 4.21E-4   bgp@1:0     rst hold timer for bgp@0:0
009> 5.52E-4   bgp@0:0     rcv keepalive from bgp@1:0
010> 5.52E-4   bgp@0:0     rst hold timer for bgp@1:0
011> 5.52E-4   bgp@0:0     snd update advertising my AS to bgp@1:0 nlri=0.0.0.8/29
012> 5.52E-4   bgp@0:0     rst keepalive timer for bgp@1:0
013> 5.52E-4   bgp@1:0     rcv keepalive from bgp@0:0
014> 5.52E-4   bgp@1:0     rst hold timer for bgp@0:0
015> 5.52E-4   bgp@1:0     snd update advertising my AS to bgp@0:0 nlri=0.0.0.0/29
016> 5.52E-4   bgp@1:0     rst keepalive timer for bgp@0:0
017> 6.83E-4   bgp@0:0     rcv update frm bgp@1:0  nlri=0.0.0.0/29
018> 6.83E-4   bgp@0:0     rst hold timer for bgp@1:0
019> 6.83E-4   bgp@1:0     rcv update frm bgp@0:0  nlri=0.0.0.8/29
020> 6.83E-4   bgp@1:0     rst hold timer for bgp@0:0
021> 30.000552 bgp@0:0     exp keepalive timer for bgp@1:0
022> 30.000552 bgp@0:0     rst keepalive timer for bgp@1:0
023> 30.000552 bgp@0:0     snd keepalive to bgp@1:0
024> 30.000552 bgp@1:0     exp keepalive timer for bgp@0:0
025> 30.000552 bgp@1:0     rst keepalive timer for bgp@0:0
026> 30.000552 bgp@1:0     snd keepalive to bgp@0:0
027> 30.000683 bgp@0:0     rcv keepalive from bgp@1:0
028> 30.000683 bgp@0:0     rst hold timer for bgp@1:0
029> 30.000683 bgp@1:0     rcv keepalive from bgp@0:0
030> 30.000683 bgp@1:0     rst hold timer for bgp@0:0
031> 60.000552 bgp@0:0     exp keepalive timer for bgp@1:0
032> 60.000552 bgp@0:0     rst keepalive timer for bgp@1:0
033> 60.000552 bgp@0:0     snd keepalive to bgp@1:0
034> 60.000552 bgp@1:0     exp keepalive timer for bgp@0:0
035> 60.000552 bgp@1:0     rst keepalive timer for bgp@0:0
036> 60.000552 bgp@1:0     snd keepalive to bgp@0:0
037> 60.000683 bgp@0:0     rcv keepalive from bgp@1:0
038> 60.000683 bgp@0:0     rst hold timer for bgp@1:0
039> 60.000683 bgp@1:0     rcv keepalive from bgp@0:0
040> 60.000683 bgp@1:0     rst hold timer for bgp@0:0
041> 90.000552 bgp@0:0     exp keepalive timer for bgp@1:0
042> 90.000552 bgp@0:0     rst keepalive timer for bgp@1:0
043> 90.000552 bgp@0:0     snd keepalive to bgp@1:0
044> 90.000552 bgp@1:0     exp keepalive timer for bgp@0:0
045> 90.000552 bgp@1:0     rst keepalive timer for bgp@0:0
046> 90.000552 bgp@1:0     snd keepalive to bgp@0:0
047> 90.000683 bgp@0:0     rcv keepalive from bgp@1:0
048> 90.000683 bgp@0:0     rst hold timer for bgp@1:0
049> 90.000683 bgp@1:0     rcv keepalive from bgp@0:0
050> 90.000683 bgp@1:0     rst hold timer for bgp@0:0

In the first 20 lines, the two BGP speakers exchange routing information for their respective ASes. Notice that the Hold Timer is reset when an Update message is received. This is because an Update serves just as well as a KeepAlive in indicating that the peering session is still intact. From here on out we see the same sequence repeating every 30 seconds: the KeepAlive Timer at each BGP speaker expires and is reset, KeepAlive messages are sent and then received at the other ends, and finally, Hold Timers are reset. This process would continue indefinitely, and because the KeepAlive Timer is set for a significantly shorter time than the Hold Timer, the Hold Timer will never get a chance to expire and cause the session to be terminated. (If traffic were introduced, or a flaky link, the Hold Timer might have a chance at expiring. This could happen if somehow the traffic congestion or flaky link resulted in KeepAlive messages getting dropped, and thus not reaching their destinations.)