현재 상황
AP1P : bond0 : 10.91.1.71 , bond1: 10.91.11.71 default gateway : 10.91.1.30
AP2P : bond0 : 10.91.1.72 , bond1: 10.91.11.72 default gateway : 10.91.1.30


10.91.11.x 대역에 대한 통신을 위해 10.91.11.30 (gateway IP) 설정 즉 bond1 네트워크에 대한
default gateway를 설정한다.
즉 게이트웨이가 10.91.11.30 와 10.91.1.30 두개로 구성한다.

추가방법

1) AP1P 에서 작업
echo "1 bond1" >> /etc/iproute2/rt_tables
ip route add 10.91.11.0/24 dev bond1 table bond1
ip route add default via 10.91.11.30 dev bond1 table bond1
ip rule add from 10.91.11.71/32 table bond1
ip rule add to 10.91.11.71/32 table bond1


it applies even after booting. 리부팅후에도 적용될수 있도록 /etc/rc.local 파일에 다음을 추가해준다.
#cat /etc/rc.local
ip route add 10.91.11.0/24 dev bond1 table bond1
ip route add default via 10.91.11.30 dev bond1 table bond1
ip rule add from 10.91.11.71/32 table bond1
ip rule add to 10.91.11.71/32 table bond1

리눅스 7.x 버전 이상부터는 아래와 같이 rc.local 서비스가 실행이 되어 있어야 위 명령어가 시작시 실행된다.

[root@Bank security]# systemctl status rc-local.service
rc-local.service - /etc/rc.d/rc.local Compatibility
Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
Active: active (exited) since Mon 2019-08-26 09:41:33 ICT; 21min ago
Process: 1467 ExecStart=/etc/rc.d/rc.local start (code=exited, status=0/SUCCESS)

Aug 26 09:41:33 SBVBank systemd[1]: Starting /etc/rc.d/rc.local Compatibility...
Aug 26 09:41:33 SBVBank systemd[1]: Started /etc/rc.d/rc.local Compatibility.


2) AP2P 에서 작업
echo "1 bond1" >> /etc/iproute2/rt_tables
ip route add 10.91.11.0/24 dev bond1 table bond1
ip route add default via 10.91.11.30 dev bond1 table bond1
ip rule add from 10.91.11.72/32 table bond1
ip rule add to 10.91.11.72/32 table bond1


it applies even after booting. 리부팅후에도 적용될수 있도록 /etc/rc.local 파일에 다음을 추가해준다.
#cat /etc/rc.local
ip route add 10.91.11.0/24 dev bond1 table bond1
ip route add default via 10.91.11.30 dev bond1 table bond1
ip rule add from 10.91.11.72/32 table bond1
ip rule add to 10.91.11.72/32 table bond1

 

 

# ip route show table all 명령서 아래와 같이 default 가 2개가 잡혀 있는것 을 확인 할수 있다. (아래 현재 IP 설정과

디바이스 설정은 다른 서버에서 테스트 해서 위와 다름)

[root@Bank security]# ip route show table all
default via 192.168.58.2 dev enp0s9 table enp0s9
192.168.58.0/24 dev enp0s9 table enp0s9 scope link
default via 192.168.56.2 dev enp0s8  

 

아래의 2개의 route 는 인터페이스가 down 시에는 룰이 지워진다.

인터페이스가 down 후 up 이 되어도 설정이 되도록 하려면

ip route add 10.91.11.0/24 dev bond1 table bond1
ip route add default via 10.91.11.30 dev bond1 table bond1

아래와 같이 route-인터페이스명으로 파일을 만든뒤 다음과 같은 설정이 필요하다.

[root@SBVBank network-scripts]# cat /etc/sysconfig/network-scripts/route-enp0s9
192.168.58.0/24 dev enp0s9 table enp0s9
default via 192.168.58.2 dev enp0s9 table enp0s9

 

사업자 정보 표시
(주)블루원 | 김홍태 | 서울특별시 용산구 원효로 4가 135 금홍 2빌딩 | 사업자 등록번호 : 106-86-76684 | TEL : 02-3272-7200 | Mail : support_ora@blueone.co.kr | 통신판매신고번호 : 호 | 사이버몰의 이용약관 바로가기

+ Recent posts