Static routing¶
General concept¶
Routing is the process of “giving directions” to IP-packages. Routing is (normally, exclusively in the context of Binero clouds implementation) done based on destination. There are who key parameters:
The destination IP
The gateway IP for the next hop
When routing packages, a router will consult a “routing table” that will have various network ranges available, each matched to a “next hop” (or gateway) which is the next path the package should take in order to reach its destination. When routing, an IP-package destination IP will be identified as belonging to a network in the routing table and the router will forward the package to the next-hop (or gateway) of that network.
Should the router be directly connected to the network in question (local to the network), it will instead use Address Resolution Protocol (ARP) to map the destination IP to a hardware (MAC) address and forward the package to its final destination.
Static routing is the process of manually defining what private subnets (network ranges) there are and behind what routers they are connected so that the routers are able to forward the packages. It is only needed if there is more then a single router in the network (as a single router would be expected to be connected to all networks directly and then would manage all the routing based on that). If a routing entry is missing and the routers are not able to match a destination ip to a network in their tables, one of two things will happen:
The routers will use their default route (if present). This would normally point upstream to the internet so effectively the package would get lost in an upstream router that does not route private networks and would drop the package.
If there is no default route, the package would get “black holed” (that is, dropped).
Note
The next-hop of a routing entry will need to be reachable and on a common network (that is a network to which both the sending and receiving router are connected). Routing cannot rely on routing to reach a gateway, all gateways need to be directly accessible. A link-network is commonly use for this (but any subnet will suffice so long as the routers are both connected to it), see our Routing between networks for more information.
Working with static routes¶
Below is shown how to add static routes to a router using the various tools. Since you route based on destination (but also need to account for return traffic, that is the traffic that a requests reply would generate), you would want to add the routes to both (or several) sides with the distinction that the networks defined on each router are the ones not local to that router. The routing entries are therefore not the same on any two (ore more) routers.
Important
If you (mistakenly) add a route to a router that is already local to it (that is connected to it by an interface), the affected subnet would stop working. Only add routing entries to remote networks. Local networks are already routed by being connected.
Static routing is currently only supported using OpenStack Horizon or the OpenStack terminal client.
OpenStack Horizon¶
Under “project”, click “Network” and then “Routers” in the sidebar menu.
Press the name of the router you want to connect the subnet to.
Press the “Static Routes” tab on the top.
Press “Add static route”.
In the “Destination CIDR” field, type the destination ip range (that is, the network behind the neighbour router that you want to reach) in CIDR format.
In the “Next Hop” field, type the gateway address, that is the address that the neighbour router has on the network which it shares with the router you are adding the static route to - and to where you want to forward traffic.
Press “Submit”.
OpenStack terminal client¶
Run:
openstack router list
to get the list of your available routers. Save the name of the router you want to connect the subnet to.Run:
openstack router add route --route destination=[DESTINATION_RANGE],gateway=[GATEWAY IP] [ROUTER NAME]
, replacing the items in brackets to destination ip range (the network behind the neighbour router that you want to reach) in CIDR format, the gateway address (the address that the neighbour router has on the network which it shares with the router you are adding the static route to - and to where you want to forward traffic) and the router name (from previous step).
See also