OSPF (Open Shortest Path First) - Linux

OS: 
Function: 
Summary
  • A link state routing protocol, in which each router sends information on the cost metric of its network interfaces to all other routers in the network.
Detailed Description
  • OSPF gathers link state information from available routers and constructs a topology map of the network. The topology determines the routing table presented to the Internet Layer which makes routing decisions based solely on the destination IP address found in IP packets. OSPF detects changes in the topology, such as link failures, very quickly and converges on a new loop-free routing structure within seconds. It computes the shortest path tree for each route using a method based on Dijkstra’s algorith, a shortest path first algorithm.
Command Syntax
  • ospfd [ -dhlv ] [ -f config-file ] [ -i pid-file ] [ -P port-number ] [ -A vty-address ] [ -u user ] [ -g group ]
Examples
  • Configuring OSPF on Linux PCs:

PC1% /etc/rc.d/init.d/zebra restart

PC1% /etc/rc.d/init.d/ospfd start

To configure OSPF routing process, connect via Telnet

PC1% telnet localhost 2604

Password: rootroot

Other commands that might be useful with OSPF

PC1% echo 1 > /proc/sys/net/ipv4/ip_forward

PC1% /etc/rc.d/init.d/ospfd stop

PC1% /etc/rc.d/init.d/ospfd status

An example:

ospfd> enable

ospfd# configure terminal

ospfd(config)# router ospf

ospf(config-router)# network 10.0.0.0/8 area 1

ospf(config-router)# router-id 10.0.1.1

ospf(config-router)# no passive-interface eth0

ospf(config-router)# no passive-interface eth1

ospf(config-router)# end

ospfd# exit