[완료]iptables 이용한 NAT 질문 드립니다.
글쓴이: twinwings / 작성시간: 목, 2015/03/19 - 2:32오전
$iptables -t nat -A OUTPUT -p $MY_PROTOCOL -j DNAT --to 127.0.0.2
루프백에서 수신한 패킷의 destination address는 예상대로 127.0.0.2로 되어있었습니다.
$iptables -t nat -A PREROUTING -p $MY_PROTOCOL -j DNAT --to $SPECIFIC_IP
DNAT할 주소를 호스트의 주소로도, 인접한 다른 노드의 주소를 넣어도 전혀 동작하고 있지 않았습니다.
$iptables -t nat -L Chain PREROUTING (policy ACCEPT) target prot opt source destination DNAT $MY -- anywhere anywhere to:$SPECIFIC_IP
조언 부탁드립니다. 원인을 찾지 못하고 있습니다 .ㅠㅠ
Forums:
계속 자문자답만 하네요 요즘;;
https://www.frozentux.net/iptables-tutorial/chunkyhtml/c962.html 문서를 참조해 보면..
PREROUTING : This chain is used for DNAT mainly. Avoid filtering in this chain since it will be bypassed in certain cases.
특히 127.0.0.1 같은 루프백의 경우 bypass 하더군요.. 그것도 모르고 우..
사설아이피 주소로 루프백 인터페이스 추가하고 그걸로 DNAT하면 가능하더군요..
댓글 달기