Skip to content

Commit

Permalink
2024-03-04
Browse files Browse the repository at this point in the history
  • Loading branch information
Lim committed Mar 4, 2024
1 parent 38e6103 commit d7c022c
Showing 1 changed file with 134 additions and 0 deletions.
134 changes: 134 additions & 0 deletions docs/sk-lim19f/2024-03-04.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# 다시

최근 과제 테스트를 하느라 책을 제대로 읽지 못했다.
오늘부터 다시 꾸준히 시작해야겠다.

### 11.3.3 리눅스 본드 설정 및 확인

#### 11.3.3.1 CentOS에서 본드 설정 및 확인

- 네트워크 설정 파일이 있는 디렉토리에 bond 인터페이스 파일을 생성하고 bond로 묶일 인터페이스에 추가 속성을 설정하는 방식

```
$ cd /etc/sysconfig/network-scripts
```

- bond 인터페이스 파일 ifcfg-bond0을 생성해 다음과 같이 설정

```
ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
onBOOT=yes
BOOTPROTO=static
IPADDR=10.10.10.11
NETMASK=255.255.255.0
GATEWAY=10.10.10.1
```

- bond 인터페이스 파일을 설정했으면 물리 인터페이스 파일, ifcfg-eth0, ifcfg-eth1에도 bond 인터페이스 사용을 위한 추가 속성을 설정

```
ifcfg-eth0, ifcfg-eth1
DEVICE=bond0
BOOTPROTO=none
onBOOT=yes
MASTER=bond0
SLAVE=yes
```

- 본드 인터페이스 설정을 마친 후에는 bonding 설정 파일 위치로 이동해 속성을 변경

```
$ cd /etc/modprobe.d/
```

- bonding 설정 파일

```
bonding.conf
alias bond0 bonding
options bond0 mode=4 miimon=100
```

- mode는 본드 구성에 대한 모드 번호
- miimon은 해당 밀리초마다 bond로 묶인 링크를 확인하는 옵션
- bond 모드의 기본값이 0(라운드 로빈)이며 miimon 값은 0(또는 1[0.01초])
- miimon이 0이면 인터페이스 상태를 체크하지 않아 페일오버가 동작하지 않으므로 반드시 확인해 0이 아닌 값으로 변경
- 모드 1을 사용해 액티브-스탠바이 구성으로 본드를 구성할 때는 위의 옵션 값 외에 어떤 인터페이스를 액티브(Primary 속성)로 사용할지에 대한 옵션을 추가로 설정해야 함
- 리눅스 커널에 본드 모듈 적재

```
$ modprobe bonding
```

- 본드 인터페이스를 게이트웨이로 설정하고 싶다면 다음 설정을 추가

```
/etc/sysconfig/network
GATEDEV=bond0
```

- bond 인터페이스를 설정하거나 수정한 후에는 네트워크를 다시 시작

```
$ service network restart //CentOs 6
$ systemctl restart network //CentOs 7
```

- 본드 설정 및 네트워크 재시작 후에는 본드가 정상적으로 잘 구성되었는지 확인

```
$ cat /proc/net/bonding/bond0
```

> 본드 설정 후 인터페이스가 정상적으로 활성화 되지 않을 때
- 본드 설정 후 네트워크를 다시 시작하는 과정에서 본드 인터페이스가 정상적으로 활성화 되지 못하는 경우가 있음
- 이때는 NetworkManager를 중지하고 실행

```
$ service networkmanger stop
$ chkconfig networkmanger off
```

#### 11.3.3.2 우분투에서 본드 설정 및 확인

- 우분투에서 본드를 설정하려면 먼저 ifenslave 패키지를 설치

```
$ apt-get install ifenslave
```

- 커널 모듈에 bonding 값이 있어야 함
- 만약 없다면 /etc/modules 파일에 bonding이라는 값을 추가하고 재부팅해야 함

```
/etc/modules
bonding
```

- 본딩 설정을 위해 인터페이스 파일인 /etc/network/interfaces에 인터페이스 eth0과 eth1을 bond0 인터페이스로 만들기 위한 설정을 다음과 같이 함

```
/etc/network/interfaces
auto eth0
iface eth0 inet manual
bond-master bond0
auto eth1
iface eth1 inet manual
bond-master bond0
auto eth0
iface eth0 inet static
address 192.168.1.10
gateway 192.168.1.1
netmask 255.255.255.0
```

0 comments on commit d7c022c

Please sign in to comment.