공유할 서비스 선택

TECH


TECH

OS RHEL9 에서 bonding 명령어로 설정, nmtui 사용하여 설정, 스크립트로 설정하는 법

페이지 정보

작성자 OSworker 아이디로 검색 전체게시물 댓글 0건 조회 102회 좋아요 1회 작성일 25-01-19 23:56

본문

안녕하세요 오늘은 RHEL9에서 본딩 하는 방법을 알아보려합니다. 

 

이전 글에서도 설명드렸듯이 RHEL9에서는  "/etc/sysconfig/network-scripts/" 을 사용하지 않기때문에

달라진 부분이 있는지 확인해보겠습니다. 


- RHEL8 과 RHEL9과 달라진 부분은 bonding 설정 파일이  "/etc/sysconfig/network-scripts/" 밑에 존재하는것이 아니라, 

 /etc/NetworkManager/system-connections/  에 존재하게 됩니다. 

 

그럼 이제 설정을 하면서  좀 더 자세히 알아보겠습니다. 

 

1. nmcli 명령어로 구성 하기 

 

- 기존 RHEL8에서 사용하던 명령어와 거의 동일합니다. 

 

- Bonding 인터페이스 생성 및 모드 설정

# nmcli connection add type bond ifname bond0 mode active-backup


- 슬레이브 인터페이스 추가

# nmcli connection add type ethernet ifname enp1s0 master bond0

# nmcli connection add type ethernet ifname enp7s0 master bond0


-  IP 및 DNS 설정

# nmcli connection modify bond-bond0 ipv4.addresses 192.168.122.77/24 ipv4.gateway 192.168.122.1 


- Bonding 인터페이스 활성화

# nmcli connection up bond-bond0


 

>Bonding  확인

 

[root@rhel9 ~]# ls -l /etc/NetworkManager/system-connections/

total 24

-rw------- 1 root root 275 Jan 19 21:22 bond-bond0.nmconnection

-rw------- 1 root root 198 Jan 19 21:15 bond-slave-enp1s0.nmconnection

 

-rw------- 1 root root 198 Jan 19 21:15 bond-slave-enp7s0.nmconnection


 

 

[root@rhel9 ~]# ifconfig

bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>  mtu 1500

        inet 192.168.122.77  netmask 255.255.255.0  broadcast 192.168.122.255

        inet6 fe80::f623:6e8b:d75b:3c2c  prefixlen 64  scopeid 0x20<link>

        ether 52:54:00:a6:f4:6a  txqueuelen 1000  (Ethernet)

        RX packets 816  bytes 60639 (59.2 KiB)

        RX errors 0  dropped 388  overruns 0  frame 0

        TX packets 355  bytes 44663 (43.6 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


enp1s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500

        ether 52:54:00:a6:f4:6a  txqueuelen 1000  (Ethernet)

        RX packets 631  bytes 48499 (47.3 KiB)

        RX errors 0  dropped 40  overruns 0  frame 0

        TX packets 354  bytes 44699 (43.6 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


enp7s0: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>  mtu 1500

        ether 52:54:00:a6:f4:6a  txqueuelen 1000  (Ethernet)

        RX packets 299  bytes 20650 (20.1 KiB)

        RX errors 0  dropped 237  overruns 0  frame 0

        TX packets 4  bytes 310 (310.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


 

[root@rhel9 ~]# cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v5.14.0-427.13.1.el9_4.x86_64


Bonding Mode: fault-tolerance (active-backup)

Primary Slave: None

Currently Active Slave: enp1s0

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 0

Down Delay (ms): 0

Peer Notification Delay (ms): 0


Slave Interface: enp1s0

MII Status: up

Speed: Unknown

Duplex: Unknown

Link Failure Count: 0

Permanent HW addr: 52:54:00:a6:f4:6a

Slave queue ID: 0


Slave Interface: enp7s0

MII Status: up

Speed: Unknown

Duplex: Unknown

Link Failure Count: 0

Permanent HW addr: 52:54:00:d1:f9:73

Slave queue ID: 0


> Bonding Test

- NIC 하나인 enp1s0을 다운시킴
[root@rhel9 ]# nmcli connection down bond-slave-enp1s0
Connection 'bond-slave-enp1s0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)

- 로그를 통해 정상적 fail-over 된것을 확인 할수있습니다. 

Jan 19 19:19:34 rhel9systemd[1]: systemd-hostnamed.service: Deactivated successfully.
Jan 19 19:20:11 rhel9systemd[1]: Starting system activity accounting tool...
Jan 19 19:20:11 rhel9systemd[1]: sysstat-collect.service: Deactivated successfully.
Jan 19 19:20:11 rhel9systemd[1]: Finished system activity accounting tool.
Jan 19 19:20:14 rhel9NetworkManager[732]: <info>  [1737282014.4679] device (enp1s0): state change: activated -> deactivating (reason 'user-requested', sys-iface-state: 'managed') <--------------------여기 
Jan 19 19:20:14 rhel9kernel: bond0: (slave enp1s0): Releasing backup interface
Jan 19 19:20:14 rhel9kernel: bond0: (slave enp1s0): the permanent HWaddr of slave - 52:54:00:a6:f4:6a - is still in use by bond - set the HWaddr of slave to a different address to avoid conflicts
Jan 19 19:20:14 rhel9kernel: bond0: (slave enp7s0): making interface the new active one
Jan 19 19:20:14 rhel9NetworkManager[732]: <info>  [1737282014.4766] device (bond0): detached bond port enp1s0
Jan 19 19:20:14 rhel9NetworkManager[732]: <info>  [1737282014.4768] device (enp1s0): released from master device bond0
Jan 19 19:20:14 rhel9NetworkManager[732]: <info>  [1737282014.4771] audit: op="connection-deactivate" uuid="81edf5c0-5718-4f42-8795-a3fa04987568" name="bond-slave-enp1s0" pid=5660 uid=0 result="success"
Jan 19 19:20:14 rhel9systemd[1]: Starting Network Manager Script Dispatcher Service...
Jan 19 19:20:14 rhel9systemd[1]: Started Network Manager Script Dispatcher Service.
Jan 19 19:20:14 rhel9NetworkManager[732]: <info>  [1737282014.4894] device (enp1s0): state change: deactivating -> disconnected (reason 'user-requested', sys-iface-state: 'managed')
Jan 19 19:20:24 rhel9systemd[1]: NetworkManager-dispatcher.service: Deactivated successfully.



2. nmtui 로 본딩 설정 하기 


- nmtui 실행하기


# nmtui


893f3acfd466e34dc8f44c8c13e3557f_1737298035_1685.jpg

1. 추가를 누릅니다.

2. 네트워크 유형 목록에서 Bond 를 선택하고 Enter 를 누릅니다.

3. 선택 사항: 생성할 NetworkManager 프로필의 이름을 입력합니다.


프로필이 여러 개인 호스트에서 의미 있는 이름을 사용하면 프로필의 용도를 쉽게 식별할 수 있습니다.


4. 장치 필드에 생성할 본딩 장치 이름을 입력합니다.

5. 생성할 본딩에 포트를 추가합니다.


- 그리고 아래와같이 입력하면 본딩이 완료됩니다. 

nmtui는 직관적으로 알아보기 쉬운 작업이라고 생각됩니다. 

893f3acfd466e34dc8f44c8c13e3557f_1737298309_1805.jpg


참고링크 :

https://docs.redhat.com/ko/documentation/red_hat_enterprise_linux/9/html/configuring_and_managing_networking/proc_configuring-a-network-by-bond-using-nmtui_configuring-network-bonding#proc_configuring-a-network-by-bond-using-nmtui_configuring-network-bonding



3. bonding 스크립트 


- 제가 개인적으로 작업할때 사용하는 스크립트 공유드립니다. 


[root@rhel9 ~]# cat bond0.sh

------------------------------------------
#!/bin/bash

# 본딩 인터페이스 이름과 모드 설정
BOND_NAME=bond0
BOND_MODE=1  # LACP(802.3ad) 모드 예제, 필요에 따라 변경 가능

# 본딩 인터페이스 생성
nmcli connection add type bond ifname $BOND_NAME mode $BOND_MODE

# 슬레이브 인터페이스 추가
SLAVE_INTERFACES=("enp1s0" "enp7s0")  # 본딩에 포함할 NIC
for IFACE in "${SLAVE_INTERFACES[@]}"; do
    nmcli connection add type ethernet ifname $IFACE master $BOND_NAME
done

# 본딩 IP 설정
IP_ADDRESS=192.168.122.77/24
GATEWAY=192.168.122.1
DNS=8.8.8.8

nmcli connection modify bond-$BOND_NAME ipv4.addresses $IP_ADDRESS ipv4.gateway $GATEWAY ipv4.dns $DNS ipv4.method manual

# 설정 활성화
nmcli connection up bond-$BOND_NAME

------------------------------------------


[root@rhel9 ~]# sh bond0.sh

Connection 'bond-bond0-1' (9753602f-e02d-44ca-9d8a-d7697b6f612d) successfully added.

Connection 'bond-slave-enp1s0-1' (1d7894d4-d5c2-42ac-9b3f-a23fcdcbb7dc) successfully added.

Connection 'bond-slave-enp7s0-1' (6fcfe9e5-f2ce-4aa6-a35c-af805891b293) successfully added.

Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/5)


이렇게 본딩이 완료됩니다. 


RHEL9에서 본딩하는 방법을 3가지 방법으로 안내해드렸습니다. 혹, 궁금하신 부분 있으시다면
언제든 댓글로 남겨주세요~



 

 

댓글목록

등록된 댓글이 없습니다.

TECH 목록
번호 제목 작성자 작성일 조회수
239 OS OSworker 아이디로 검색 전체게시물 01-28 76
2025년 엔터프라이즈 리눅스를 시작해야 하는 10가지 이유

카테고리 : OS

76 0
작성자 : OSworker 25/01/28
열람중 OS OSworker 아이디로 검색 전체게시물 01-19 103
열람중
RHEL9 에서 bonding 명령어로 설정, nmtui 사용하여 설정, 스크립트로 설정하는 법

카테고리 : OS

103 0
작성자 : OSworker 25/01/19
237 OS OSworker 아이디로 검색 전체게시물 01-12 175
RHEL9 에서 달라진 Network 설정을 알아보겠습니다.

카테고리 : OS

175 0
작성자 : OSworker 25/01/12
236 OS OSworker 아이디로 검색 전체게시물 12-29 299
여러분 리눅스 무료 배포판 NAVIX를 들어보셨나요? Naver + linux ??

카테고리 : OS

299 0
작성자 : OSworker 24/12/29
235 OS OSworker 아이디로 검색 전체게시물 12-24 241
RHEL 9에서 RHEL 6 시스템 또는 타사 APP 서비스로 SSH 연결이 되지 않는 이유

카테고리 : OS

241 0
작성자 : OSworker 24/12/24
234 OS OSworker 아이디로 검색 전체게시물 12-14 296
RHEL7.9 RHEL8.8 커널 업데이트 후 성능 이슈가 발생했습니다.

카테고리 : OS

296 0
작성자 : OSworker 24/12/14
233 OS OSworker 아이디로 검색 전체게시물 11-27 430
Red Hat Enterprise Linux 9에서 root 사용자로 SSH 로그인 활성화 하는 방법

카테고리 : OS

430 0
작성자 : OSworker 24/11/27
232 OS OSworker 아이디로 검색 전체게시물 11-17 421
RHEL 9.5 가 11월 12일에 릴리즈 되었습니다. 간략하게 살펴보시죠~

카테고리 : OS

421 0
작성자 : OSworker 24/11/17
231 OS OSworker 아이디로 검색 전체게시물 11-10 415
어떤 프로세스 어떤 이유로 인해 성능에 문제가 생겼을때 perf로 그 문제를 찾아보세요.

카테고리 : OS

415 0
작성자 : OSworker 24/11/10
230 OS OSworker 아이디로 검색 전체게시물 10-31 364
AI에 대한 관심이 많습니다. 혹시 RHEL AI에 대해 들어보셨나요?

카테고리 : OS

364 0
작성자 : OSworker 24/10/31
Total 239건
게시물 검색

주식회사 클럭스| 대표 : 이찬호| 사업자등록번호 : 107-87-27655
주소 : 서울특별시 영등포구 국회대로 800, 여의도파라곤
E-mail : sales@chlux.co.kr
Copyright © 클럭스 chlux.co.kr All rights reserved.
상단으로Top