저는 최근 iptables를 실행하는 네트워크에 Raspberry Pi 방화벽/게이트웨이를 구현했습니다.
구현 이후 직장에서 Windows 기반 PPTP 서버에 연결할 수 없었습니다.
나는 "모든 것을 허용한다"는 규칙이 있다고 생각했지만 그렇지 않은 것 같습니다. 전체 iptables 스크립트는 아래에 나열되어 있습니다.
PATH=/usr/sbin:/sbin:/bin:/usr/bin
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i eth1 -j ACCEPT
iptables -A FORWARD -i eth1 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -A FORWARD -i eth1 -o eth1 -j REJECT
echo 1 > /proc/sys/net/ipv4/ip_forward
내 iptables -L -vn의 결과는 다음과 같습니다. iptables -t nat -L -vn:
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0
21 1572 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT all -- eth1 * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
9 656 ACCEPT all -- eth1 eth0 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 ACCEPT tcp -- eth1 eth0 0.0.0.0/0 0.0.0.0/0 tcp dpt:1723 state NEW,ESTABLISHED
0 0 ACCEPT tcp -- eth0 eth1 0.0.0.0/0 0.0.0.0/0 tcp spt:1723 state RELATED,ESTABLISHED
0 0 ACCEPT 47 -- eth1 eth1 0.0.0.0/0 0.0.0.0/0 state NEW,ESTABLISHED
0 0 ACCEPT 47 -- eth0 eth1 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
9 498 ACCEPT all -- eth0 eth1 0.0.0.0/0 0.0.0.0/0
0 0 REJECT all -- eth1 eth1 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
11 1212 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state NEW,ESTABLISHED
Chain PREROUTING (policy ACCEPT 1 packets, 64 bytes)
pkts bytes target prot opt in out source destination
0 0 DNAT tcp -- eth1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:1723 to:192.168.1.51
0 0 DNAT 47 -- eth1 * 0.0.0.0/0 0.0.0.0/0 to:192.168.1.51
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination
1 64 MASQUERADE all -- * eth1 0.0.0.0/0 0.0.0.0/0
답변1
이 시도:
modprobe ip_nat_pptp
모든 규칙이 매우 느슨해도 LAN에서 연결할 수 없습니다.