Chapter 2. Customizing networks for Red Hat OpenStack Services on OpenShift


You can add routes to the Red Hat OpenShift Container Platform (RHOCP) network configuration you prepared for your Red Hat OpenStack Services on OpenShift (RHOSO) environment on your RHOCP cluster.

2.1. Adding routes to the RHOCP networks

To add routes to the Red Hat OpenShift Container Platform (RHOCP) networks, you add the routes field to the NodeNetworkConfigurationPolicy (nncp), NetworkAttachmentDefinition (net-attach-def), and NetConfig custom resources.

Prerequisites

Procedure

  1. Open the NodeNetworkConfigurationPolicy (nncp) CR file on your workstation, for example, openstack-nncp.yaml.
  2. Add the routes field to the nncp CR, and add configuration for each route. The following example adds routes to the nncp CR that configures the enp6s0 interface for worker node 1, osp-enp6s0-worker-1:

    apiVersion: nmstate.io/v1
    kind: NodeNetworkConfigurationPolicy
    metadata:
      name: osp-enp6s0-worker-1
    spec:
      desiredState:
        interfaces:
          ...
        routes:
          config:
          - destination: 192.168.123.0/24
            metric: 150
            next-hop-address: 192.168.122.1
            next-hop-interface: ospbr
          - destination: 192.168.124.0/24
            metric: 150
            next-hop-address: 192.168.122.1
            next-hop-interface: ospbr
          - destination: 172.17.1.0/24
            metric: 150
            next-hop-address: 172.17.0.1
            next-hop-interface: internalapi
          - destination: 172.17.2.0/24
            metric: 150
            next-hop-address: 172.17.0.1
            next-hop-interface: internalapi
          - destination: 172.18.1.0/24
  3. Update the nncp CR in the cluster:

    $ oc apply -f openstack-nncp.yaml
  4. Open the NetworkAttachmentDefinition (net-attach-def) CR file on your workstation, for example, o`penstack-net-attach-def.yaml`.
  5. Add the routes field to the config field for each isolated network, and add configuration for each route. The following example adds routes to the net-attach-def CR for the tenant network:

    apiVersion: k8s.cni.cncf.io/v1
    kind: NetworkAttachmentDefinition
    metadata:
      name: tenant
      namespace: openstack
    spec:
      config: |
        {
          "cniVersion": "0.3.1",
          "name": "tenant",
          "type": "macvlan",
          "master": "tenant",
          "ipam": {
            "type": "whereabouts",
            "range": "172.19.0.0/24",
            "range_start": "172.19.0.30",
            "range_end": "172.19.0.70",
            "routes": [
              {
                "dst": "172.19.1.0/24",
                "gw": "172.19.0.1"
              },
              {
                "dst": "172.19.2.0/24",
                "gw": "172.19.0.1"
              }
            ]
          }
        }
  6. Update the NetworkAttachmentDefinition CR in the cluster:

    $ oc apply -f openstack-net-attach-def.yaml
  7. Open the NetConfig CR file on your workstation, for example, openstack_netconfig.yaml.
  8. Add the routes field to the networks field for each isolated network. The following example adds routes to the three subnets of the ctlplane network:

    apiVersion: network.openstack.org/v1beta1
    kind: NetConfig
    metadata:
      name: openstacknetconfig
      namespace: openstack
    spec:
      networks:
      - name: ctlplane
        dnsDomain: ctlplane.openstack.lab
        subnets:
        - name: subnet1
          allocationRanges:
          - end: 192.168.122.120
            start: 192.168.122.100
          - end: 192.168.122.200
            start: 192.168.122.150
          cidr: 192.168.122.0/24
          gateway: 192.168.122.1
          routes:
          - destination: 192.168.123.0/24
            nexthop: 192.168.122.1
          - destination: 192.168.124.0/24
            nexthop: 192.168.122.1
        - name: subnet2
          allocationRanges:
          - end: 192.168.123.120
            start: 192.168.123.100
          - end: 192.168.123.200
            start: 192.168.123.150
          cidr: 192.168.123.0/24
          gateway: 192.168.123.1
          routes:
          - destination: 192.168.122.0/24
            nexthop: 192.168.123.1
          - destination: 192.168.124.0/24
            nexthop: 192.168.123.1
        - name: subnet3
          allocationRanges:
          - end: 192.168.124.120
            start: 192.168.124.100
          - end: 192.168.124.200
            start: 192.168.124.150
          cidr: 192.168.124.0/24
          gateway: 192.168.124.1
          routes:
          - destination: 192.168.122.0/24
            nexthop: 192.168.124.1
          - destination: 192.168.123.0/24
            nexthop: 192.168.124.1
  9. Update the data plane network:

    $ oc apply -f openstack_netconfig.yaml -n openstack
Red Hat logoGithubredditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust. Explore our recent updates.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

Theme

© 2026 Red Hat
Back to top