NS2 Routing Protocols


What is routing protocol?

  • NS2  routing protocol uses software and routing algorithms to determine optimal network data transfer and communication paths between network nodes.
  • Routing protocols facilitate router communication and overall network topology understanding.
  • A routing protocol is also known as a routing policy.

 

Types of internet protocol:

  • BGP
  • IGP
  • OSPF etc.

 

What is BGP?

  • Border Gateway Protocol (BGP) is a routing protocol used to transfer data and information between different host gateways, the Internet or autonomous systems.
  • BGP is a Path Vector Protocol (PVP), which maintains paths to different hosts, networks and gateway routers and determines the routing decision based on that.

 

Characteristics of BGP:

  • Variable length subnet masks
  • Routes IP
  • Keepalive times is 60 sec
  • Bidirectional forwarding detection support
  • Path vector
  • Designated router: route reflector
  • Hold down timer is 180 sec
  • Routing advertisement

 

Metrics of BGP:

  • Local originated
  • Weight
  • Local preference
  • Origin type
  • As path
  • MED etc

 

BGP routing table components:

  • As-path
  • Next hop IP address
  • Destination IP address/subnet mask

 

Architecture of BGP routing protocol:

 

Architecture-of-BGP-Routing-Protocol

 

 

Sample code for BGP routing protocol:
This is the sample code of node creation, link used in BGP routing protocol.
set AS100 [$ns node]
set BGP100 [new Application/Route/Bgp]
$BGP100 finish-time  $opt(stop)
$BGP100 config-file $opt(dir)/bgpd100.conf
$BGP100 attach-node $AS100
 
set AS400 [$ns node]
set BGP400 [new Application/Route/Bgp 200 ]
$BGP400 finish-time  $opt(stop)
$BGP400 config-file $opt(dir)/bgpd400.conf
$BGP400 attach-node $AS400
 
set AS300a [$ns node]
set BGP300a [new Application/Route/Bgp]
$BGP300a finish-time  $opt(stop)
$BGP300a config-file $opt(dir)/bgpd300a.conf
$BGP300a attach-node $AS300a
 
set AS300b [$ns node]
set BGP300b [new Application/Route/Bgp]
$BGP300b finish-time  $opt(stop)
$BGP300b config-file $opt(dir)/bgpd300b.conf
$BGP300b attach-node $AS300b
 
$ns duplex-link $AS100  $AS400 1.5Mb 1ms DropTail
$ns duplex-link $AS300a $AS300b 1.5Mb 1ms DropTail
$ns duplex-link $AS100  $AS300a 1.5Mb 1ms DropTail
$ns duplex-link $AS100  $AS300b 1.5Mb 1ms DropTail
 
 
$ns at [expr $opt(stop) - 1] "$BGP100 command  \"show ip bgp\""
$ns at [expr $opt(stop) - 1] "$BGP400 command  \"show ip bgp\""
$ns at [expr $opt(stop) - 1] "$BGP300a command \"show ip bgp\""
$ns at [expr $opt(stop) - 1] "$BGP300b command \"show ip bgp\""
 

Journal Support for NS2 Routing Protocols:

NS2-Projects-Journal-Support