diff --git a/docs/src/pages/posts/dnake-2.md b/docs/src/pages/posts/dnake-2.md new file mode 100644 index 0000000..7c9db16 --- /dev/null +++ b/docs/src/pages/posts/dnake-2.md @@ -0,0 +1,11 @@ +# 1. 允许转发从eth1到eth0的SIP数据包(目的192.168.9.4:5060) +iptables -A FORWARD -i eth1 -o eth0 -p udp --dport 5060 -d 192.168.9.4 -j ACCEPT + +# 2. 允许转发从eth0返回eth1的SIP响应包(源192.168.9.4:5060) +iptables -A FORWARD -i eth0 -o eth1 -p udp --sport 5060 -s 192.168.9.4 -j ACCEPT + +# 3. DNAT:将eth1收到的5060端口UDP包转发到192.168.9.4:5060 +iptables -t nat -A PREROUTING -i eth1 -p udp --dport 5060 -j DNAT --to-destination 192.168.9.4:5060 + +# 4. SNAT:修改转发包的源地址为设备eth0的IP(192.168.9.57),确保192.168.9.4的响应能回传给设备 +iptables -t nat -A POSTROUTING -o eth0 -p udp --dport 5060 -d 192.168.9.4 -j SNAT --to-source 192.168.9.57 \ No newline at end of file