Red Hat Training

A Red Hat training course is available for RHEL 8

3.7. nmstatectl을 사용하여 네트워크 본딩 구성

nmstatectl 유틸리티를 사용하여 Nmstate API를 통해 네트워크 본딩을 구성합니다. Nmstate API는 구성을 설정한 후 결과가 구성 파일과 일치하는지 확인합니다. 아무것도 실패하면 nmstatectl 에서 시스템을 잘못된 상태로 두지 않도록 변경 사항을 자동으로 롤백합니다.

환경에 따라 YAML 파일을 적절하게 조정합니다. 예를 들어 본딩의 이더넷 어댑터와 다른 장치를 사용하려면 본딩에서 사용하는 포트의 base-iface 특성 및 유형 속성을 조정합니다.

사전 요구 사항

  • 서버에 두 개 이상의 실제 또는 가상 네트워크 장치가 설치되어 있습니다.
  • 이더넷 장치를 본딩의 포트로 사용하려면 물리적 또는 가상 이더넷 장치를 서버에 설치해야 합니다.
  • 팀, 브리지 또는 VLAN 장치를 본딩에서 포트로 사용하려면 포트 목록에서 인터페이스 이름을 설정하고 해당 인터페이스를 정의합니다.
  • nmstate 패키지가 설치되어 있습니다.

절차

  1. 다음 콘텐츠를 사용하여 YAML 파일(예: ~/create-bond.yml )을 생성합니다.

    ---
    interfaces:
    - name: bond0
      type: bond
      state: up
      ipv4:
        enabled: true
        address:
        - ip: 192.0.2.1
          prefix-length: 24
        dhcp: false
      ipv6:
        enabled: true
        address:
        - ip: 2001:db8:1::1
          prefix-length: 64
        autoconf: false
        dhcp: false
      link-aggregation:
        mode: active-backup
        port:
        - enp1s0
        - enp7s0
    - name: enp1s0
      type: ethernet
      state: up
    - name: enp7s0
      type: ethernet
      state: up
    
    routes:
      config:
      - destination: 0.0.0.0/0
        next-hop-address: 192.0.2.254
        next-hop-interface: bond0
      - destination: ::/0
        next-hop-address: 2001:db8:1::fffe
        next-hop-interface: bond0
    
    dns-resolver:
      config:
        search:
        - example.com
        server:
        - 192.0.2.200
        - 2001:db8:1::ffbb

    이러한 설정은 다음 설정으로 네트워크 본딩을 정의합니다.

    • 본딩의 네트워크 인터페이스 enp1s0enp7s0
    • 모드: active-backup
    • 정적 IPv4 주소: 192.0.2.1/24 서브넷 마스크
    • 정적 IPv6 주소: 2001:db8:1::1/64 서브넷 마스크
    • IPv4 기본 게이트웨이: 192.0.2.254
    • IPv6 기본 게이트웨이: 2001:db8:1::fffe
    • IPv4 DNS 서버: 192.0.2.200
    • IPv6 DNS 서버: 2001:db8:1::ffbb
    • DNS 검색 도메인: example.com
  2. 시스템에 설정을 적용합니다.

    # nmstatectl apply ~/create-bond.yml

검증

  1. 장치 및 연결 상태를 표시합니다.

    # nmcli device status
    DEVICE      TYPE      STATE      CONNECTION
    bond0       bond      connected  bond0
  2. 연결 프로필의 모든 설정을 표시합니다.

    # nmcli connection show bond0
    connection.id:              bond0
    connection.uuid:            79cbc3bd-302e-4b1f-ad89-f12533b818ee
    connection.stable-id:       --
    connection.type:            bond
    connection.interface-name:  bond0
    ...
  3. 연결 설정을 YAML 형식으로 표시합니다.

    # nmstatectl show bond0

추가 리소스

  • nmstatectl(8) man page
  • /usr/share/doc/nmstate/examples/ 디렉터리