OVN Reference
The OVN objects Spinifex creates for internet gateways, public IPs and security groups, and the OVN, OVS, interface and capture commands to inspect each layer.
Overview
For operators debugging or verifying the OVN topology. The first part shows the OVN objects that Spinifex creates for each VPC resource. The Debugging Toolkit gives the commands for each layer.
Instructions
IGW Attach Creates
# One shared external switch with one localnet port, created once for all VPCs
ovn-nbctl ls-add ext-shared
ovn-nbctl lsp-add ext-shared ext-port-shared
ovn-nbctl lsp-set-type ext-port-shared localnet
ovn-nbctl lsp-set-addresses ext-port-shared unknown
ovn-nbctl lsp-set-options ext-port-shared network_name=external
# Gateway router port: link-local in pool mode,
# a transit IP from the nat-transit pool in nat mode
ovn-nbctl lrp-add vpc-{vpcId} gw-{vpcId} {mac} 169.254.0.1/30
# Connect the shared external switch to the router
ovn-nbctl lsp-add ext-shared gw-port-{vpcId}
ovn-nbctl lsp-set-type gw-port-{vpcId} router
ovn-nbctl lsp-set-addresses gw-port-{vpcId} router
ovn-nbctl lsp-set-options gw-port-{vpcId} router-port=gw-{vpcId} nat-addresses=router
# Gateway chassis HA
ovn-nbctl lrp-set-gateway-chassis gw-{vpcId} chassis-1 20
ovn-nbctl lrp-set-gateway-chassis gw-{vpcId} chassis-2 15
# Default route to WAN
ovn-nbctl lr-route-add vpc-{vpcId} 0.0.0.0/0 192.168.1.1
# nat mode only: SNAT for all VPC traffic to the gateway transit IP
ovn-nbctl lr-nat-add vpc-{vpcId} snat 100.127.0.16 10.0.0.0/16
Per-Instance Public IP
# 1:1 NAT — distributed (DNAT processed on the VM's own chassis)
ovn-nbctl lr-nat-add vpc-{vpcId} dnat_and_snat {public_ip} {private_ip} \
port-{eniId} {vm_mac}
With the WAN NIC on a Linux bridge wired to OVS via veth, OVS sees every frame on the wire regardless of MAC, so OVN can use distributed NAT. The DNAT is processed on the chassis hosting the VM rather than hairpinning through a single gateway chassis.
Security Group
# Create port group (the SG ID with "-" changed to "_")
ovn-nbctl pg-add sg_{groupId}
# Add VM ports
ovn-nbctl pg-set-ports sg_{groupId} port-{eniId1} port-{eniId2}
# Allow SSH inbound (stateful)
ovn-nbctl acl-add sg_{groupId} to-lport 1000 \
'outport == @sg_{groupId} && ip4 && tcp.dst == 22' allow-related
# Allow all egress
ovn-nbctl acl-add sg_{groupId} from-lport 1000 \
'inport == @sg_{groupId} && ip4' allow-related
# Default deny inbound
ovn-nbctl acl-add sg_{groupId} to-lport 900 \
'outport == @sg_{groupId}' drop
# Default deny outbound
ovn-nbctl acl-add sg_{groupId} from-lport 800 \
'inport == @sg_{groupId}' drop
Useful Debug Commands
# List all logical routers (VPCs)
sudo ovn-nbctl lr-list
# List all logical switches (subnets + external)
sudo ovn-nbctl ls-list
# Show NAT rules for a VPC
sudo ovn-nbctl lr-nat-list vpc-{vpcId}
# Show routes for a VPC
sudo ovn-nbctl lr-route-list vpc-{vpcId}
# Show chassis (nodes) in the cluster
sudo ovn-sbctl show
# Show port bindings (which VM is on which host)
sudo ovn-sbctl find Port_Binding type="" | grep -E "logical_port|chassis"
# Check ACLs on a security group
sudo ovn-nbctl acl-list sg_{groupId}
# Check port group membership
sudo ovn-nbctl pg-get-ports sg_{groupId}
Debugging Toolkit
These commands are used throughout VPC Network Troubleshooting. Learn them — they cover 90% of VPC networking issues.
OVN Northbound (Logical Topology)
# Full topology overview (routers, switches, ports)
sudo ovn-nbctl show
# List all VPC routers
sudo ovn-nbctl lr-list
# List all switches (subnets + external)
sudo ovn-nbctl ls-list
# NAT rules for a VPC
sudo ovn-nbctl lr-nat-list vpc-{vpcId}
# Routes for a VPC
sudo ovn-nbctl lr-route-list vpc-{vpcId}
# Port details (check "up" field for DHCP status)
sudo ovn-nbctl list Logical_Switch_Port port-{eniId}
# Gateway chassis assignment
sudo ovn-nbctl list Logical_Router_Port gw-{vpcId}
# Localnet port options (network_name should be "external")
sudo ovn-nbctl get Logical_Switch_Port ext-port-shared options
OVN Southbound (runtime state)
# Chassis list + port bindings (which VM is on which host)
sudo ovn-sbctl show
# Detailed chassis info (check name matches expectations)
sudo ovn-sbctl list Chassis
# MAC binding table (shows ARP resolution for external traffic)
sudo ovn-sbctl list MAC_Binding
# Trace a packet through the OVN pipeline (invaluable for debugging)
sudo ovn-trace ext-shared \
'inport=="ext-port-shared" && eth.dst==ff:ff:ff:ff:ff:ff && \
arp.op==1 && arp.spa==192.168.1.13 && arp.tpa==192.168.1.201'
OVN DB RAFT cluster (NB/SB replication)
The NB and SB databases run clustered across the first three nodes via native OVSDB RAFT. A 3-node quorum tolerates the loss of one DB node; check status when the control plane stalls.
# NB cluster status: expect 3 servers and exactly one "Role: leader"
sudo ovn-appctl -t /var/run/ovn/ovnnb_db.ctl cluster/status OVN_Northbound
# SB cluster status
sudo ovn-appctl -t /var/run/ovn/ovnsb_db.ctl cluster/status OVN_Southbound
# Drive a CLI at the whole quorum (fails over past a dead node)
sudo ovn-nbctl --db=tcp:10.1.3.181:6641,tcp:10.1.3.182:6641,tcp:10.1.3.183:6641 show
A node showing only itself under Servers: never joined the cluster — confirm it was bootstrapped with --db-cluster-remote-addr pointing at the creator and that RAFT ports 6643/6644 are reachable between DB nodes.
OVS (datapath / physical wiring)
# Full bridge + port topology
sudo ovs-vsctl show
# Kernel datapath ports and stats
sudo ovs-dpctl show
# Kernel datapath flow cache (actual forwarding rules)
sudo ovs-dpctl dump-flows
# OpenFlow rules installed by ovn-controller
sudo ovs-ofctl dump-flows br-int | grep {pattern}
# Conntrack entries (shows active NAT sessions)
sudo ovs-appctl dpctl/dump-conntrack | grep {ip}
# FDB (MAC address table) for a bridge
sudo ovs-appctl fdb/show br-wan
# OVS external_ids (system-id, bridge-mappings, encap-ip)
sudo ovs-vsctl get Open_vSwitch . external_ids
Network Interfaces
# Physical NIC should be enslaved to br-wan ("master br-wan")
ip -d link show {nic}
# Linux WAN bridge — owns the host IP and default route
ip -br addr show br-wan
ip route show default
# OVS bridges and the veth linking br-ext to br-wan
sudo ovs-vsctl list-ports br-ext
bridge link show | grep br-wan
# Interface traffic stats (RX/TX counts, drops)
ip -s link show {nic}
ip -s link show br-wan
Packet Capture
# Capture on the OVS uplink bridge (frames between OVN and br-wan)
sudo tcpdump -i br-ext -n -e arp
# Capture on the Linux WAN bridge (frames between br-ext veth and the NIC)
sudo tcpdump -i br-wan -n -e "host {public_ip}"
# Capture on the physical NIC (sees everything on the wire)
sudo tcpdump -i {nic} -n "host {public_ip}"
Service Logs
# vpcd log (reconcile, NAT, topology operations)
journalctl -u spinifex-vpcd -f
# ovn-controller log (port binding, commit failures)
sudo cat /var/log/ovn/ovn-controller.log | tail -50
# Daemon log (instance launch, network setup)
journalctl -u spinifex-daemon -f
Troubleshooting
For symptoms, causes and fixes, see VPC Network Troubleshooting.