iproute2 로드 밸런싱 질문입니다

howdoudo의 이미지

안녕하세요 ?
제가 기존에 사용하던 network은 다음과 같습니다.
br0 : eth0+ra0, 유무선 공유를 위하여 bridge로 묶은 인터페이스, 사설 IP 172.30.1.0/24, gw = 172.30.1.254
eth1 : 119.207.x.x/24, gw=119.207.x.254(KT 엔토피아)

이 상태에서는 단순히 iptables에 iptables -t nat -A -s 172.30.1.0/24 -o eth1 -j MASQUERADE 명령만 한줄 추가하여 문제없이 공유를 하며 쓰고 있었습니다.

이번에 FTTH 회선을 하나 증설하여 eth2라는 interface를 추가하였습니다.
eth2 : 175.234.y.y/24, gw=175.234.y.254

그래서 로드를 분산하기 위하여 LAN 대역의 절반을 뚝 잘라 172.30.1.1 ~ 127 까지는 eth1을 통하여 기존 엔토피아를 쓰게하고,
172.30.1.128 ~ 253 까지는 새로운 eth2를 통하여 FTTH를 쓰게 하고 싶습니다.

이곳에서 몇 가지 글들을 읽어 보니 iproute2를 이용하여 대역을 분리해 주면 된다고 하여, 시도해 보는 중인데

우선 iptables의 MASQUERADE rule을 절반으로 잘라서, iptables -t nat -A POSTROUTING -s 172.30.1.0/25 -o eth1 -j MASQUERADE
로 수정하였습니다.

잡다한 룰을 뺀 iptables의 NAT 테이블과 route 명령의 결과는 아래와 같습니다.
~ # iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere limit: avg 1/sec burst 1000

Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 172.30.1.0/25 anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
~ #
~ # route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
175.234.y.0 * 255.255.255.0 U 0 0 0 eth2
10.0.0.0 * 255.255.255.0 U 0 0 0 eth0
172.30.1.0 * 255.255.255.0 U 0 0 0 br0
119.207.x.x * 255.255.255.0 U 0 0 0 eth1
224.0.0.0 * 240.0.0.0 U 0 0 0 eth1
default 119.207.x.254 0.0.0.0 UG 0 0 0 eth1

이 상태에서 iproute2의 script는 다음과 같이 만들었습니다.

# echo 200 ftth >> /etc/iproute2/rt_tables
# ip rule add from 172.30.1.128/25 table ftth
# ip route add 175.234.y.y via 175.234.y.254 dev eth2 table ftth

간단히 위와 같이 실행한 상태에서는 172.30.1.1~127 까지만 eth1을 타고 정상적으로 MASQUERADE가 되서 패킷이 나갑니다만,
128~253은 전혀 NAT도 되지않고 아예 패킷이 외부로 안나갑니다.
그래서 iptables에 MASQUERADE rule을 하나더 추가(iptables -t nat -A POSTROUTING -s 172.30.1.128/25 -o eth2 -j MASQUERADE)해 보았지만
여전히 패킷이 나가지 않았습니다. MASQUERADE rule 대신 SNAT rule을 추가하여도 마찬가지 였습니다.

어떻게 해야 172.30.1.128 ~ 253 까지의 traffic이 eth2를 타고 eth2의 IP로 NAT 되어 외부로 나가게 할 수 있을까요 ?

고수분들의 도움을 기대해 봅니다.

감사합니다.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.