This commit is contained in:
abearxiong committed 2026-03-05 23:30:12 +08:00
1 parent e6cbbd27d4
commit c33559fcf8
3 files changed
+39 -2

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
# 1. 清理重复规则
iptables -t nat -F PREROUTING
iptables -t nat -F POSTROUTING
# 2. 重新添加正确规则
# DNAT - 目的地址转换
iptables -t nat -A PREROUTING -i eth1 -p udp --dport 5060 -j DNAT --to-destination 192.168.9.4:5060
# SNAT - 源地址转换
iptables -t nat -A POSTROUTING -o eth0 -p udp --dport 5060 -j SNAT --to-source 192.168.9.57
# 3. 开启 IP 转发
echo 1 > /proc/sys/net/ipv4/ip_forward
# 4. 添加 FORWARD 规则(重要!)
iptables -A FORWARD -i eth1 -o eth0 -p udp --dport 5060 -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -p udp --sport 5060 -j ACCEPT