IPTable이 요청한 작업을 수행하지 않습니다.

IPTable이 요청한 작업을 수행하지 않습니다.

여기 커뮤니티는 정말 대단해요!

저는 ASUS 3100 무선 라우터와 약 4개의 IP 카메라를 가지고 있습니다. 내 이전 라우터에서는 카메라가 "집에 전화"를 걸지 않도록 하기 위해 나가는 트래픽을 쉽게 차단할 수 있었습니다. 나는 이 라우터로 같은 일을 하고 싶어서 먼저 포트 포워딩 도구를 사용하기로 결정한 다음 IPTABLES를 찾기 시작했습니다. asuswrt-merlin이 라우터 관리 도구 및 iptables에서 포트 전달을 사용하는 데 이것이 문제인지 모르겠습니다. 나는 그렇지 않을 것이라고 생각합니다 ... 그렇죠?

내 목표:

  1. 기본적으로 192.168.1.0/29에 대한 발신 및 수신 트래픽을 차단합니다.
  2. 예외: 신뢰할 수 있는 소수의 IP(직장 또는 친구 집)에 대해서만 120:130을 열고 싶습니다. 해당 IP가 150.150.150.150 및 250.250.250.0/24라고 가정해 보겠습니다(저는 브라우저를 사용하여 이 포트에 액세스합니다. 어쨌든 중요하지는 않습니다). 따라서 CAMERA #2에 액세스하려면 DDNS.dns.com:121이 됩니다.
  3. 예외: 카메라는 SMTPS(포트 465)를 통해 이메일을 보내므로 이메일을 보낼 수 있도록 포트를 열어보겠습니다.

다른 곳에서 통신하는 일부 IoT 항목이 있기 때문에 입력/출력을 차단하고 싶지 않으므로 이를 차단하기 위해 기본 정책을 변경하고 싶지 않습니다. 내가 그것이 어떻게 작동하는지 오해하지 않는 한.

최신 Asuswrt-Merlin으로 라우터를 플래시하고 JFFS 사용자 정의 스크립트를 켰습니다. /jffs/scripts/라는 이름 으로 파일을 만들었습니다 firewall-start. 나는 shebang으로 시작하는 파일을 편집하고 몇 가지 규칙을 추가했습니다(이에 대해서는 나중에 다시 설명하겠습니다). 나는 service restart_firewall. 내가 겪고 있는 문제는 적절한 결과를 얻지 못하고 규칙을 잘못 작성하거나 순서를 잘못 작성했을 가능성이 매우 높다는 것입니다.

나는 iptables를 앞으로 시도했고, iptables INPUT & OUTPUT을 시도했고, "INSERT" / "APPEND"의 조합을 시도했는데 이상한 이유로 모든 것을 차단하거나 완전히 OPEN 상태로 남겨둘 것입니다. 그것은 결코 내 궁극적인 목표를 따르지 않습니다. FORWARD, INPUT 또는 OUTPUT에 대한 일부 순서 또는 기본 규칙과 관련이 있다고 확신하지만 이해할 수 없습니다.

규칙도 한 번에 하나씩 삽입했습니다. 시작하는 것은 간단합니다.

iptables -I FORWARD -d 192.168.1.0/29 -p tcp --dport 17111 -j DROP

이것은 그것을 떨어뜨린다. canyouseeme.org를 시도했는데 코드를 입력하면 성공이라고 표시되어도 여전히 성공이라고 표시되기 때문에 까다로울 때도 있습니다. 때로는 실패했다고(즉, 떨어졌다는 의미) 때로는 그런 일이 발생하기도 하지만 관련 없는 문제인 것처럼 들립니다. 그런 다음 나는 나 자신에게 괜찮다고 말합니다. 이제 이 뒤에 INSERT 규칙을 추가할 수 있습니다. INSERT가 맨 위로 이동하므로 위 코드 뒤에 다음을 추가했습니다.

iptables -I FORWARD -s myworkip -d 192.168.1.0/29 -p tcp --dport 121 -j ACCEPT

그래서 파일에 그 두 개가 있습니다. iptables를 플러시한 다음 방화벽 시작 서비스를 다시 시작하여 새 규칙을 획득하도록 합니다. 나는 iptables -L그것이 올바른 순서로되어 있음을 봅니다. 웹페이지 ddns.dns.com:121 및 nada를 다시 로드하여 테스트해 보세요. 로드되지 않습니다. 캐싱인가요? 시간이 필요한가요? 때로는 5분을 기다려도 아무 반응이 없을 때도 있습니다. canyouseeme.org를 다시 사용했는데 여전히 마지막 DROP 코드에서 실패했다고 표시됩니다.

나를 도와줄 전문가가 필요해요. 현재 내 기존 iptable은 다음과 같습니다.

Chain INPUT (policy ACCEPT)
target     prot opt source               destination
DROP       icmp --  anywhere             anywhere             icmp echo-request
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
DROP       all  --  anywhere             anywhere             state INVALID
PTCSRVWAN  all  --  anywhere             anywhere
PTCSRVLAN  all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere             state NEW
ACCEPT     all  --  anywhere             anywhere             state NEW
OVPN       all  --  anywhere             anywhere             state NEW
ACCEPT     udp  --  anywhere             anywhere             udp spt:bootps dpt:bootpc
INPUT_ICMP  icmp --  anywhere             anywhere
DROP       all  --  anywhere             anywhere

Chain FORWARD (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED
other2wan  all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere             state INVALID
ACCEPT     all  --  anywhere             anywhere
NSFW       all  --  anywhere             anywhere
ACCEPT     all  --  anywhere             anywhere             ctstate DNAT
OVPN       all  --  anywhere             anywhere             state NEW
ACCEPT     all  --  anywhere             anywhere

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

Chain ACCESS_RESTRICTION (0 references)
target     prot opt source               destination

Chain FUPNP (0 references)
target     prot opt source               destination

Chain INPUT_ICMP (1 references)
target     prot opt source               destination
RETURN     icmp --  anywhere             anywhere             icmp echo-request
RETURN     icmp --  anywhere             anywhere             icmp timestamp-request
ACCEPT     icmp --  anywhere             anywhere

Chain NSFW (1 references)
target     prot opt source               destination

Chain OVPN (2 references)
target     prot opt source               destination

Chain PControls (0 references)
target     prot opt source               destination
ACCEPT     all  --  anywhere             anywhere

Chain PTCSRVLAN (1 references)
target     prot opt source               destination

Chain PTCSRVWAN (1 references)
target     prot opt source               destination

Chain SECURITY (0 references)
target     prot opt source               destination
RETURN     tcp  --  anywhere             anywhere             tcpflags: FIN,SYN,RST,ACK/SYN limit: avg 1/sec burst 5
DROP       tcp  --  anywhere             anywhere             tcpflags: FIN,SYN,RST,ACK/SYN
RETURN     tcp  --  anywhere             anywhere             tcpflags: FIN,SYN,RST,ACK/RST limit: avg 1/sec burst 5
DROP       tcp  --  anywhere             anywhere             tcpflags: FIN,SYN,RST,ACK/RST
RETURN     icmp --  anywhere             anywhere             icmp echo-request limit: avg 1/sec burst 5
DROP       icmp --  anywhere             anywhere             icmp echo-request
RETURN     all  --  anywhere             anywhere

Chain default_block (0 references)
target     prot opt source               destination

Chain logaccept (0 references)
target     prot opt source               destination
LOG        all  --  anywhere             anywhere             state NEW LOG level warning tcp-sequence tcp-options ip-options prefix "ACCEPT "
ACCEPT     all  --  anywhere             anywhere

Chain logdrop (0 references)
target     prot opt source               destination
LOG        all  --  anywhere             anywhere             state NEW LOG level warning tcp-sequence tcp-options ip-options prefix "DROP "
DROP       all  --  anywhere             anywhere

Chain other2wan (1 references)
target     prot opt source               destination
RETURN     all  --  anywhere             anywhere
DROP       all  --  anywhere             anywhere

미리 감사드립니다!

관련 정보