添加 docs/src/pages/posts/dnake-2.md

This commit is contained in:
2026-01-07 21:56:22 +08:00
parent ff17fc2ee3
commit fb3134b4dc

View File

@@ -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的IP192.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