\chapter{Layer 3}

\section{Routed Network}

\section{OSPF}
\section{IS-IS}
\section{EIGRP}
\section{RIP}
\section{Static}

\newpage

\section{BGP}

\wikicommons{BGP_FSM}

The protocol of the internet used since 1994.\cite{wiki:Border_Gateway_Protocol}
Currently based upon \rfc{4271} with updates following in \rfc{6286} \rfc{6608}, \rfc{6793}, \rfc{7606}, \rfc{7607}, \rfc{7705}.

\begin{itemize}
    \item \itemhead{Properties}
    \begin{itemize}
        \item Uses tcp/179 as \gls{dst} port
        \item Sends keep-alive message every 1 minute
        \item Keep-alive message is 19 byte
    \end{itemize}
    \item \itemhead{Route exchange}
    \begin{itemize}
        \item \itemhead{Route-maps mechanism}
        \begin{itemize}
            \item Routes can be aggregated between \glspl{as}.
            \item Properties can be changed on the fly by mathing
            \begin{enumerate}[label={\alph*)}]
                \item \Gls{bgp} communities,
                \item \Gls{ip} prefix,
                \item \Gls{bgp} as-path, 
            \end{enumerate}
        \end{itemize}
    \end{itemize}
    \item \itemhead{States}
    \begin{enumerate}
        \item Idle: \gls{bgp} while initializing refuses all incoming connections. Will initiate \gls{tcp} connection to peer.
        \item Connect: Waits for \gls{tcp} connection. If \gls{tcp} is established goes to state OpenSent. If \gls{tcp} is \textit{un}successful ConnectRetry timer is started and then goes to Active state.
        \item Active: When ConnectRetry counter reaches 0 goes to state Connect.
        \item OpenSent: Sends \gls{msg} to remote node. Waits for reply \gls{msg} before going to OpenConfirm.
        \item OpenConfirm: Nodes exchange keepalive \glspl{msg} and goes to Established state if successful.
        \item Established: Nodes can now exchange KeepAlive, Updates, and Notification \glspl{msg}.
    \end{enumerate}
\end{itemize}

\subsection[iBGP]{Internal Border Gateway Protocol}

\gls{ibgp} is running \gls{bgp} within the same \gls{as} between routers. Much like running a general \gls{igrp} in the network.

Tradition one has to be fearful of creating \textit{routing loops} in the network. \glspl{bgp} mechanism for this is using either \begin{mylist} \item Full Mesh, or \item \glspl{rr} \end{mylist}.

Problems by running \textit{Full Mesh} is the formula of \[ iBGPsessions = n*(n-1)/2 \] \note{where $ n $ is the number \gls{ibgp} speakers} which results in scaling problems as \gls{ibgp} speakers are added to the \gls{as}.

\textit{\glspl{rr}} solves this problem by peering with all \gls{ibgp} speakers in the \gls{as}. All \gls{ibgp} speakers are then clients of the \glspl{rr}. This in turn helps maintainability by also advertising routes learnt from \gls{ibgp} clients to clients. Classic filtering/mathing route-maps/prefix-filters can be used to \textit{not} advertise all routes select group of clients from the \glspl{rr}.

\subsection[eBGP]{External Border Gateway Protocol}

\gls{ebgp} connections is inherently different from \gls{ibgp} connections. Some assumptions are made such as
\begin{enumerate}
    \item a \gls{ttl} of 1 is the default\footnote{Multi-hop \gls{ebgp} can thou be configured},
    \item distance is set to 20 compared to 200 for \gls{ibgp} routes,
    \item Next hop does \textit{not} change for \gls{ebgp} routes advertised to \gls{ibgp} neighbours.
\end{enumerate}