질문&답변
클라우드/리눅스에 관한 질문과 답변을 주고 받는 곳입니다.
리눅스 분류

teql 를 이용한 네트워크 트래픽 분산

작성자 정보

  • Bonding 작성
  • 작성일

컨텐츠 정보

본문

네트워크 상황은 다음과 같습니다.

KT Ntopia 100Mbps 회선이 4개가 있습니다.

실제속도는 다운로드, 업로드 모두 92~96Mbps가 나오며(KT 홈페이지에서 직접 체크)

각 회선들이 대여폭을 공유하지 않고 독릭적으로 각각 90Mbps 이상 나옵니다.

리눅스 서버가 한대가 있고 클라이언트가 2대가 있습니다.

4회선 중에 서버게 두개를 연결하였고 나머지 2회선은 클라이언트에 하나씩 각각 연결했습니다.

서버에서 ifconfig, metstat -nr, ip route를 실행한 결과입니다.

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

[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:15:17:14:F0:C0
inet addr:61.75.27.200 Bcast:61.75.27.255 Mask:255.255.255.0
inet6 addr: fe80::215:17ff:fe14:f0c0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3082 errors:0 dropped:0 overruns:0 frame:0
TX packets:47 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:604181 (590.0 KiB) TX bytes:7364 (7.1 KiB)
Base address:0x9c00 Memory:fdde0000-fde00000

eth4 Link encap:Ethernet HWaddr 00:15:17:16:6C:4D
inet addr:125.141.91.111 Bcast:125.141.91.255 Mask:255.255.255.0
inet6 addr: fe80::215:17ff:fe16:6c4d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2782 errors:0 dropped:0 overruns:0 frame:0
TX packets:498 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:183285 (178.9 KiB) TX bytes:94664 (92.4 KiB)
Base address:0x7800 Memory:fd9a0000-fd9c0000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:1275 errors:0 dropped:0 overruns:0 frame:0
TX packets:1275 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2047396 (1.9 MiB) TX bytes:2047396 (1.9 MiB)

[root@localhost ~]#

[root@localhost ~]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
61.75.27.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
125.141.91.0 0.0.0.0 255.255.255.0 U 0 0 0 eth4
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth4
0.0.0.0 125.141.91.254 0.0.0.0 UG 0 0 0 eth4

[root@localhost ~]# ip route
61.75.27.0/24 dev eth0 proto kernel scope link src 61.75.27.200
125.141.91.0/24 dev eth4 proto kernel scope link src 125.141.91.111
169.254.0.0/16 dev eth4 scope link
default via 125.141.91.254 dev eth4
[root@localhost ~]#

-----------------------------------------------------------------------------------
#서버
@회선1 : eth0 : IP : 61.75.27.200 Gateway : 61.75.27.254
@회선2 : eth4 : IP : 125.141.91.111 Gateway : 125.141.91.254
#클라이언트#1
@회선3 : IP : 61.75.27.194
#클라이언트#2
@회선4 : IP : 125.141.91.126
-------------------------------------------------------------------------------------

원하는것은 IP별로 회선을 분산하고 싶습니다.
예들들어서 http://localhost/DATA1.zip 파일이 있습니다.

#클라이언트#1에서
http://61.75.27.200/DATA1.zip 로 접속할 경우 @회선1이 사용되게 하고
★☆동시에★☆ #클라이언트#2
http://125.141.91.111/DATA1.zip 로 접속할 경우 @회선2 가 사용되게 하고싶습니다.

그런데 막상하니 @회선1, @회선2 중에 하나만 사용되더군요

우연히 KLDPWiki:DocbookSgml/Traffic_LoadBalancing-KLDP?refresh=1
이글을 보고 따라해봤습니다.

#echo 200 eth0 >> /etc/iproute2/rt_tables
#ip rule add fwmark 1 table eth0
#ip route add via 61.75.27.254 table eth0
#iptables -A OUTPUT -t mangle -s 61.75.27.0/24 -j MARK --set-mark 1

#echo 201 eth1 >> /etc/iproute2/rt_tables
#ip rule add fwmark 2 table eth1
#ip route add via 125.141.91.254 table eth1
#iptables -A OUTPUT -t mangle -s 125.141.91.0/24 -j MARK --set-mark 2

결과는 전에는 eth0, eth4 중에서 하나만 사용되었지만

eth0, eth4 인터페이스를 분산시켜서 두개의 인터페이스를 동시에 사용하는데에는 성공했습니다.

하지만 이렇게 해도 @회선1, @회선2 두개가 동시에 사용되지 못하고 하나만 사용하더군요.

그러던 도중에 etql로 트래픽을 분산할수 있다는 것을 듣게 되었습니다.

http://mailman.ds9a.nl/pipermail/lartc/2002q4/005795.html

위에 글처럼

# tc qdisc add dev eth0 root teql0
# tc qdisc add dev eth1 root teql0
# ip address add 172.0.0.81/24 dev teql0
# ip address add 172.0.0.82/24 dev teql0
# route add -net 172.0.0.0 netmask 255.255.255.0 dev teql0
# route add default gw 172.0.0.1

이렇게 입력하니 리눅스에서 http://172.0.0.81/DATA1.zip 로 접속하니 접속이 잘되었습니다.

그런데 외부에서 http://172.0.0.81/DATA1.zip 로 접속하니 접속이 안되네요...

클라이언트에서 접근을 할려면 어떻게 해야될까요?

관련자료

댓글 0
등록된 댓글이 없습니다.

공지사항


뉴스광장


  • 현재 회원수 :  60,039 명
  • 현재 강좌수 :  35,845 개
  • 현재 접속자 :  110 명