Caution: Articles written for technical not grammatical accuracy, If poor grammar offends you proceed with caution ;-)

In my previous NSX articles we covered installing and configuring NSX, We discussed deploying/configuring Transport Zones, Logical Switches, Logical Routers, Edge Gateways, and connecting the Logical and Edge Gateways. With all these completed we now have an environment that with the appropriate routes and transport traffic from our physical network to our logical networks that we deployed. The missing price is the routes. We could go and configure a bunch of static routes throughout all the NSX routers and our physical routers, but that wouldn’t be fun. It also wouldn’t be automated. In this post I am going to walk through configuring the NSX routers to use OSPF for route distribution.

Configuring OSPF on a Distributed Logical Router

Navigate to the NSX Edges menu and double click on your logical router. Now select Routing from the top menu, then Global Configuration from the left menu and click the Edit button above Dynamic Routing Configuration. When the dialog opens select the uplink network that is connected to the Edge Router, optionally enable logging, and then click OK. Click Publish Changes and then select OSPF from the left menu.

*Note – If you look at Dynamic Routing Configuration you will see that your router has an ID that is it’s IP address on the network that was chosen Next select the Green + under Area Definition. Enter a value for Area ID. Do not use 0 or 51. I’m going to use 20. Click OK when finished. Next Click the Green + under Area to Interface Mapping.



Next to interface select the interface that connects to the Edge Router, then select the area that we just created and click OK. Click Publish Changes. Once the settings are published click edit next to OSPF Configuration. On the OSPF Configuration dialog check Enable OSPF and then we will need to input two IP addresses. The forwarding address should be the IP address we assigned to the Uplink interface of the logical router. If you remember in the article connecting logical and edge routers the network that we created between the two routers was a /29 not a /30. This is the reason why. We need to assign another IP address on the subnet to the Protocol address. Once Finished click OK.*Note – The protocol addresses in needed because the routing stack is a function of the control vm and the IP address it uses for updates needs to be local, unlike the forwarding address which is distributed across all ESXi hosts. Finally select Route Redistribution from the left menu and make sure in the route redistribution table you have an OSPF entry that is set to redistribute static and connected for any. The OSPF configuration of the Distributed Logical Router is now complete. The Distribute Logical Router is now sharing OSPF routing information over the Uplink interface that connects it to the Edge Gateway. We now need to configure OSPF on the Edge Gateway.

Configuring OSPF on an Edge Gateway

Much like the we did on the logical router we need to configure a router ID on the Edge Gateway. Only on the Edge Gateway you will choose it’s uplink interface, not the interface that connects it to the Logical Router. On Routing menu select Global Configuration from the left menu, then click edit. When the dialog opens select the uplink network, optionally enable logging and click ok. When you are finished don’t forget to publish your changes. Next we need to add the Area Definitions. We will need to add a definition ID the same as the one that we added to the logical router. I used 20 when I configured my logical router. We also need to add Area 0 if it doesn’t already exist. Once they are both created we need to add area to interface mappings. We will need to map area 20 to the interface that connects us to our logical router and area 0 to the interface that connects us to the physical infrastructure. Don’t forget to click publish changes when you are finished. Next click Edit next to OSPF Configuration and enable OSPF then click OK. Don’t forget to publish changes when finished.

*Note – Take note that we don’t need to specify any IP addresses on an Edge Router. That is because the Edge router is an appliance and it handles it’s own routing. It’s not distributed. Finally select Route Redistribution from the left menu and make sure in the route redistribution table you have an OSPF entry that is set to redistribute static and connected for any. OSPF is now configured on the Edge Gateway to share routes with the Logical Router as well as your physical network over the Edge Gateways Physical interface. You will need to have your physical router configured of OSPF and to share OSPF for area 0 on the same network that the Edge Gateway is. In the MoaC lab we have a transit network between the Edge Gateway and the Physical Router much like we did for the logical router to Edge Gateway.We are using a Ubiquiti EdgeMax LIte router. Below if a screenshot of it’s OSPF router and you will see the routes for the networks we created for use in this example.

Now to challenge yourself go ahead and create another logical switch and attach it to your Distributed Logical Router. Your new network should automatically appear in your OSPF routing table for your physical router within seconds.]