4.2. Preparing DCN networking


Configure networking for your distributed compute node (DCN) deployment by setting up network interfaces, routes, and IP address pools. Proper network configuration ensures reliable communication between the central control plane and distributed edge locations.

Prerequisites

  • The OpenStack Operator is installed

Procedure

  1. Create a NodeNetworkConfigurationPolicy (nncp) CR definition file on your workstation for each worker node in the RHOCP cluster that hosts OpenStack services.
  2. In each nncp CR file, configure the interfaces for each isolated network. Each service interface must have its own unique address:

    apiVersion: nmstate.io/v1
    kind: NodeNetworkConfigurationPolicy
    metadata:
      labels:
        osp/nncm-config-type: standard
      name: worker-0
      namespace: openstack
    spec:
      desiredState:
        dns-resolver:
          config:
            search: []
            server:
            - 192.168.122.1
        interfaces:
        - description: internalapi vlan interface
          ipv4:
            address:
            - ip: 172.17.0.10
              prefix-length: "24"
            dhcp: false
            enabled: true
          ipv6:
            enabled: false
          mtu: 1496
          name: internalapi
          state: up
          type: vlan
          vlan:
            base-iface: enp7s0
            id: "20"
        - description: storage vlan interface
          ipv4:
            address:
            - ip: 172.18.0.10
              prefix-length: "24"
            dhcp: false
            enabled: true
          ipv6:
            enabled: false
          mtu: 1496
          name: storage
          state: up
          type: vlan
          vlan:
            base-iface: enp7s0
            id: "21"
        - description: tenant vlan interface
          ipv4:
            address:
            - ip: 172.19.0.10
              prefix-length: "24"
            dhcp: false
            enabled: true
          ipv6:
            enabled: false
          mtu: 1496
          name: tenant
          state: up
          type: vlan
          vlan:
            base-iface: enp7s0
            id: "22"
        - description: ctlplane interface
          mtu: 1500
          name: enp7s0
          state: up
          type: ethernet
        - bridge:
            options:
              stp:
                enabled: false
            port:
            - name: enp7s0
              vlan: {}
          description: linux-bridge over ctlplane interface
          ipv4:
            address:
            - ip: 192.168.122.10
              prefix-length: "24"
            dhcp: false
            enabled: true
          ipv6:
            enabled: false
          mtu: 1500
          name: ospbr
          state: up
          type: linux-bridge
  3. Add the route-rules attribute and the route configuration to networks in each remote location to each nncp CR file:

        route-rules:
          config: []
        routes:
          config:
          - destination: 192.168.133.0/24
            next-hop-address: 192.168.122.1
            next-hop-interface: ospbr
            table-id: 254
          - destination: 192.168.144.0/24
            next-hop-address: 192.168.122.1
            next-hop-interface: ospbr
            table-id: 254
          - destination: 172.17.10.0/24
            next-hop-address: 172.17.0.1
            next-hop-interface: internalapi
            table-id: 254
          - destination: 172.18.10.0/24
            next-hop-address: 172.18.0.1
            next-hop-interface: storage
            table-id: 254
          - destination: 172.19.10.0/24
            next-hop-address: 172.19.0.1
            next-hop-interface: tenant
            table-id: 254
          - destination: 172.17.20.0/24
            next-hop-address: 172.17.0.1
            next-hop-interface: internalapi
            table-id: 254
          - destination: 172.18.20.0/24
            next-hop-address: 172.18.0.1
            next-hop-interface: storage
            table-id: 254
          - destination: 172.19.20.0/24
            next-hop-address: 172.19.0.1
            next-hop-interface: tenant
            table-id: 254
      nodeSelector:
        kubernetes.io/hostname: worker-0
        node-role.kubernetes.io/worker: ""
    참고

    Each service network routes to the same network at each remote location. For example, the internalapi network (172.17.0.0/24) has a route to the internalapi network at each remote location (172.17.10.0/24 and 172.17.20.0/24) through a local router at 172.17.0.1.

  4. Create the nncp CRs in the cluster:

    $ oc create -f worker0-nncp.yaml
    $ oc create -f worker1-nncp.yaml
    $ oc create -f worker2-nncp.yaml
  5. Create a NetworkAttachmentDefinition CR definition file for each network. Include routes to each remote location to the networks of the same function. For example, the internalapi NetworkAttachmentDefinition specifies its own subnet range as well as routes to the internalapi networks at remote sites.

    1. Create a NetworkAttachmentDefinition CR definition file for the internalapi network:

      apiVersion: k8s.cni.cncf.io/v1
      kind: NetworkAttachmentDefinition
      metadata:
        labels:
          osp/net: internalapi
          osp/net-attach-def-type: standard
        name: internalapi
        namespace: openstack
      spec:
        config: |
          {
            "cniVersion": "0.3.1",
            "name": "internalapi",
            "type": "macvlan",
            "master": "internalapi",
            "ipam": {
              "type": "whereabouts",
              "range": "172.17.0.0/24",
              "range_start": "172.17.0.30",
              "range_end": "172.17.0.70",
              "routes": [
                  { "dst": "172.17.10.0/24", "gw": "172.17.0.1" },
                  { "dst": "172.17.20.0/24", "gw": "172.17.0.1" }
                ]
            }
          }
    2. Create a NetworkAttachmentDefinition CR definition file for the control network:

      apiVersion: k8s.cni.cncf.io/v1
      kind: NetworkAttachmentDefinition
      metadata:
        labels:
          osp/net: ctlplane
          osp/net-attach-def-type: standard
        name: ctlplane
        namespace: openstack
      spec:
        config: |
          {
            "cniVersion": "0.3.1",
            "name": "ctlplane",
            "type": "macvlan",
            "master": "ospbr",
            "ipam": {
              "type": "whereabouts",
              "range": "192.168.122.0/24",
              "range_start": "192.168.122.30",
              "range_end": "192.168.122.70",
              "routes": [
                  { "dst": "192.168.133.0/24", "gw": "192.168.122.1" },
                  { "dst": "192.168.144.0/24", "gw": "192.168.122.1" }
                ]
            }
          }
    3. Create a NetworkAttachmentDefinition CR definition file for the storage network:

      apiVersion: k8s.cni.cncf.io/v1
      kind: NetworkAttachmentDefinition
      metadata:
        labels:
          osp/net: storage
          osp/net-attach-def-type: standard
        name: storage
        namespace: openstack
      spec:
        config: |
          {
            "cniVersion": "0.3.1",
            "name": "storage",
            "type": "macvlan",
            "master": "storage",
            "ipam": {
              "type": "whereabouts",
              "range": "172.18.0.0/24",
              "range_start": "172.18.0.30",
              "range_end": "172.18.0.70",
              "routes": [
                  { "dst": "172.18.10.0/24", "gw": "172.18.0.1" },
                  { "dst": "172.18.20.0/24", "gw": "172.18.0.1" }
                ]
            }
          }
    4. Create a NetworkAttachmentDefinition CR definition file for the tenant network:

      apiVersion: k8s.cni.cncf.io/v1
      kind: NetworkAttachmentDefinition
      metadata:
        labels:
          osp/net: tenant
          osp/net-attach-def-type: standard
        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.10.0/24", "gw": "172.19.0.1" },
                  { "dst": "172.19.20.0/24", "gw": "172.19.0.1" }
                ]
            }
          }
  6. Create the NetworkAttachmentDefinition CRs:

    $ oc create -f internalapi-net-attach-def.yaml
    $ oc create -f control-net-attach-def.yaml
    $ oc create -f storage-net-attach-def.yaml
    $ oc create -f tenant-net-attach-def.yaml
  7. Create a NetConfig CR definition file to define which IPs can be used as Virtual IPs (VIPs). Each network is defined under the dnsDomain field, with allocationRanges for each geographic region. These ranges cannot overlap with the whereabouts IPAM range.

    1. Create the file with the added allocation ranges for the control plane networking similar to the following:

      apiVersion: network.openstack.org/v1beta1
      kind: NetConfig
      metadata:
        name: netconfig
        namespace: openstack
      spec:
        networks:
        - dnsDomain: ctlplane.example.com
          mtu: 1500
          name: ctlplane
          subnets:
          - allocationRanges:
            - end: 192.168.122.120
              start: 192.168.122.100
            - end: 192.168.122.170
              start: 192.168.122.150
            cidr: 192.168.122.0/24
            gateway: 192.168.122.1
            name: subnet1
            routes:
            - destination: 192.168.133.0/24
              nexthop: 192.168.122.1
            - destination: 192.168.144.0/24
              nexthop: 192.168.122.1
          - allocationRanges:
            - end: 192.168.133.120
              start: 192.168.133.100
            - end: 192.168.133.170
              start: 192.168.133.150
            cidr: 192.168.133.0/24
            gateway: 192.168.133.1
            name: subnet2
            routes:
            - destination: 192.168.122.0/24
              nexthop: 192.168.133.1
            - destination: 192.168.144.0/24
              nexthop: 192.168.133.1
          - allocationRanges:
            - end: 192.168.144.120
              start: 192.168.144.100
            - end: 192.168.144.170
              start: 192.168.144.150
            cidr: 192.168.144.0/24
            gateway: 192.168.144.1
            name: subnet3
            routes:
            - destination: 192.168.122.0/24
              nexthop: 192.168.144.1
            - destination: 192.168.133.0/24
              nexthop: 192.168.144.1
    2. Add an allocation range for the internalapi network:

        - dnsDomain: internalapi.example.com
          mtu: 1496
          name: internalapi
          subnets:
          - allocationRanges:
            - end: 172.17.0.250
              start: 172.17.0.100
            cidr: 172.17.0.0/24
            name: subnet1
            routes:
            - destination: 172.17.10.0/24
              nexthop: 172.17.0.1
            - destination: 172.17.20.0/24
              nexthop: 172.17.0.1
            vlan: 20
          - allocationRanges:
            - end: 172.17.10.250
              start: 172.17.10.100
            cidr: 172.17.0.0/24
            name: subnet2
            routes:
            - destination: 172.17.0.0/24
              nexthop: 172.17.10.1
            - destination: 172.17.20.0/24
              nexthop: 172.17.10.1
            vlan: 30
          - allocationRanges:
            - end: 172.17.20.250
              start: 172.17.20.100
            cidr: 172.17.20.0/24
            name: subnet3
            routes:
            - destination: 172.17.0.0/24
              nexthop: 172.17.20.1
            - destination: 172.17.10.0/24
              nexthop: 172.17.20.1
            vlan: 40
    3. Add an allocation range for the external network:

        - dnsDomain: external.example.com
          mtu: 1500
          name: external
          subnets:
          - allocationRanges:
            - end: 10.0.0.250
              start: 10.0.0.100
            cidr: 10.0.0.0/24
            name: subnet1
            vlan: 22
        - dnsDomain: external.example.com
          mtu: 1500
          name: external
          subnets:
          - allocationRanges:
            - end: 10.0.10.250
              start: 10.0.10.100
            cidr: 10.0.10.0/24
            name: subnet2
            vlan: 22
        - dnsDomain: external.example.com
          mtu: 1500
          name: external
          subnets:
          - allocationRanges:
            - end: 10.0.20.250
              start: 10.0.20.100
            cidr: 10.0.20.0/24
            name: subnet3
            vlan: 22
        - dnsDomain: storage.example.com
          mtu: 1496
          name: storage
          subnets:
          - allocationRanges:
            - end: 172.18.0.250
              start: 172.18.0.100
            cidr: 172.18.0.0/24
            name: subnet1
            routes:
            - destination: 172.18.10.0/24
              nexthop: 172.18.0.1
            - destination: 172.18.20.0/24
              nexthop: 172.18.0.1
            vlan: 21
          - allocationRanges:
            - end: 172.18.10.250
              start: 172.18.10.100
            cidr: 172.18.10.0/24
            name: subnet2
            routes:
            - destination: 172.18.0.0/24
              nexthop: 172.18.10.1
            - destination: 172.18.20.0/24
              nexthop: 172.18.10.1
            vlan: 31
          - allocationRanges:
            - end: 172.18.20.250
              start: 172.18.20.100
            cidr: 172.18.20.0/24
            name: subnet3
            routes:
            - destination: 172.18.0.0/24
              nexthop: 172.18.20.1
            - destination: 172.18.10.0/24
              nexthop: 172.18.20.1
            vlan: 41
    4. Add an allocation range for the tenant network:

        - dnsDomain: tenant.example.com
          mtu: 1496
          name: tenant
          subnets:
          - allocationRanges:
            - end: 172.19.0.250
              start: 172.19.0.100
            cidr: 172.19.0.0/24
            name: subnet1
            routes:
            - destination: 172.19.10.0/24
              nexthop: 172.19.0.1
            - destination: 172.19.20.0/24
              nexthop: 172.19.0.1
            vlan: 22
          - allocationRanges:
            - end: 172.19.10.250
              start: 172.19.10.100
            cidr: 172.19.10.0/24
            name: subnet2
            routes:
            - destination: 172.19.0.0/24
              nexthop: 172.19.10.1
            - destination: 172.19.20.0/24
              nexthop: 172.19.10.1
            vlan: 32
          - allocationRanges:
            - end: 172.19.20.250
              start: 172.19.20.100
            cidr: 172.19.20.0/24
            name: subnet3
            routes:
            - destination: 172.19.0.0/24
              nexthop: 172.19.20.1
            - destination: 172.19.10.0/24
              nexthop: 172.19.20.1
            vlan: 42
    5. Add an allocation range for the storagemgmt network:

        - dnsDomain: storagemgmt.example.com
          mtu: 1500
          name: storagemgmt
          subnets:
          - allocationRanges:
            - end: 172.20.0.250
              start: 172.20.0.100
            cidr: 172.20.0.0/24
            name: subnet1
            routes:
            - destination: 172.20.10.0/24
              nexthop: 172.20.0.1
            - destination: 172.20.20.0/24
              nexthop: 172.20.0.1
            vlan: 23
          - allocationRanges:
            - end: 172.20.10.250
              start: 172.20.10.100
            cidr: 172.20.10.0/24
            name: subnet2
            routes:
            - destination: 172.20.0.0/24
              nexthop: 172.20.10.1
            - destination: 172.20.20.0/24
              nexthop: 172.20.10.1
            vlan: 33
          - allocationRanges:
            - end: 172.20.20.250
              start: 172.20.20.100
            cidr: 172.20.20.0/24
            name: subnet3
            routes:
            - destination: 172.20.0.0/24
              nexthop: 172.20.20.1
            - destination: 172.20.10.0/24
              nexthop: 172.20.20.1
            vlan: 43
  8. Create the NetConfig CR:

    oc create -f netconfig
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동