Добрый день! Есть два канал в инет с балансировкой трафика. Появилась задачка выпустить SIP-сервер IP 192.168.0.252 наружу через определенный IP XXX.XXX.XXX.190 до провайдера IP ZZZ.ZZZ.ZZZ.36 В таблице IP SIP-сервера прописан, однако он ходит в инет через произвольный шлюз. Соответственно при входящем звонке от прова, обратный пакет выбрасывается через другой шлюз :( Посоветуйте чего покурить и куда покопать пжлста....
ip ro list table provY
192.168.0.238 dev eth2 scope link
XXX.XXX.XXX.184/29 dev eth1 scope link
YYY.YYY.YYY.192/29 dev eth2 scope link src YYY.YYY.YYY.195
192.168.0.0/23 dev eth3 scope link
127.0.0.0/8 dev lo scope link
default via YYY.YYY.YYY.193 dev eth2
ip route list table provX
192.168.0.252 dev eth1 scope link
XXX.XXX.XXX.184/29 dev eth1 scope link src XXX.XXX.XXX.190
YYY.YYY.YYY.192/29 dev eth2 scope link
192.168.0.0/23 dev eth3 scope link
127.0.0.0/8 dev lo scope link
default via XXX.XXX.XXX.185 dev eth1
ip route show
10.100.100.2 dev tun0 proto kernel scope link src 10.100.100.1
XXX.XXX.XXX.184/29 dev eth1 proto kernel scope link src XXX.XXX.XXX.190
YYY.YYY.YYY.192/29 dev eth2 proto kernel scope link src YYY.YYY.YYY.195
5.5.3.0/24 dev as0t3 proto kernel scope link src 5.5.3.1
192.168.7.0/24 via 10.100.100.2 dev tun0
5.5.2.0/24 dev as0t2 proto kernel scope link src 5.5.2.1
192.168.6.0/24 via 10.100.100.2 dev tun0
5.5.1.0/24 dev as0t1 proto kernel scope link src 5.5.1.1
192.168.5.0/24 via 10.100.100.2 dev tun0
5.5.0.0/24 dev as0t0 proto kernel scope link src 5.5.0.1
192.168.4.0/24 via 10.100.100.2 dev tun0
5.5.7.0/24 dev as0t7 proto kernel scope link src 5.5.7.1
192.168.3.0/24 via 10.100.100.2 dev tun0
5.5.6.0/24 dev as0t6 proto kernel scope link src 5.5.6.1
192.168.2.0/24 via 10.100.100.2 dev tun0
5.5.5.0/24 dev as0t5 proto kernel scope link src 5.5.5.1
5.5.4.0/24 dev as0t4 proto kernel scope link src 5.5.4.1
5.5.11.0/24 dev as0t11 proto kernel scope link src 5.5.11.1
5.5.10.0/24 dev as0t10 proto kernel scope link src 5.5.10.1
5.5.9.0/24 dev as0t9 proto kernel scope link src 5.5.9.1
10.100.100.0/24 via 10.100.100.2 dev tun0
5.5.8.0/24 dev as0t8 proto kernel scope link src 5.5.8.1
5.5.15.0/24 dev as0t15 proto kernel scope link src 5.5.15.1
5.5.14.0/24 dev as0t14 proto kernel scope link src 5.5.14.1
5.5.13.0/24 dev as0t13 proto kernel scope link src 5.5.13.1
192.168.9.0/24 via 10.100.100.2 dev tun0
5.5.12.0/24 dev as0t12 proto kernel scope link src 5.5.12.1
192.168.8.0/24 via 10.100.100.2 dev tun0
192.168.0.0/23 dev eth3 proto kernel scope link src 192.168.0.254
169.254.0.0/16 dev eth3 scope link
default
nexthop via YYY.YYY.YYY.193 dev eth2 weight 3
nexthop via XXX.XXX.XXX.185 dev eth1 weight 7
cat /etc/sysconfig/iptables
# Generated by iptables-save v1.3.5 on Fri Dec 9 09:21:41 2011
*nat
:PREROUTING ACCEPT [21358:2690656]
:POSTROUTING ACCEPT [2701:176563]
:OUTPUT ACCEPT [2701:176563]
-A PREROUTING -s ZZZ.ZZZ.ZZZ.36/32 -d XXX.XXX.XXX.190/32 -i eth1 -p udp -m udp --dport 5061 -j DNAT --to-destination 192.168.0.252:5060
-A POSTROUTING -s 192.168.0.252/32 -o eth1 -j SNAT --to-source XXX.XXX.XXX.190
-A PREROUTING -p tcp -d YYY.YYY.YYY.195 --dport 25 -j DNAT --to-destination 192.168.0.238:25
-A PREROUTING -p tcp -d YYY.YYY.YYY.195 --dport 80 -j DNAT --to-destination 192.168.0.238:80
-A PREROUTING -p tcp -d YYY.YYY.YYY.195 --dport 993 -j DNAT --to-destination 192.168.0.238:993
-A PREROUTING -p tcp -d YYY.YYY.YYY.195 --dport 7025 -j DNAT --to-destination 192.168.0.238:7025
-A PREROUTING -p tcp -d YYY.YYY.YYY.195 --dport 7071 -j DNAT --to-destination 192.168.0.238:7071
-A POSTROUTING -p tcp --dst 192.168.0.238 --dport 25 -j SNAT --to-source YYY.YYY.YYY.195
-A POSTROUTING -p tcp --dst 192.168.0.238 --dport 80 -j SNAT --to-source YYY.YYY.YYY.195
-A POSTROUTING -p tcp --dst 192.168.0.238 --dport 993 -j SNAT --to-source YYY.YYY.YYY.195
-A POSTROUTING -p tcp --dst 192.168.0.238 --dport 7025 -j SNAT --to-source YYY.YYY.YYY.195
-A POSTROUTING -p tcp --dst 192.168.0.238 --dport 7071 -j SNAT --to-source YYY.YYY.YYY.195
-A POSTROUTING -s 192.168.0.0/255.255.254.0 -d ! 192.168.0.0/255.255.0.0 -j MASQUERADE
COMMIT
# Completed on Fri Dec 9 09:21:41 2011
# Generated by iptables-save v1.3.5 on Fri Dec 9 09:21:41 2011
*mangle
:PREROUTING ACCEPT [134272:116793294]
:INPUT ACCEPT [133652:116774886]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [73442:5446029]
:POSTROUTING ACCEPT [73442:5446029]
COMMIT
# Completed on Fri Dec 9 09:21:41 2011
# Generated by iptables-save v1.3.5 on Fri Dec 9 09:21:41 2011
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [73442:5446029]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -i tun0 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth1 -p udp --dport 5060 -s ZZZ.ZZZ.ZZZ.36 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -p tcp --dport 25 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p udp --dport 53 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 53 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 110 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -p tcp --dport 993 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -p tcp --dport 7025 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth2 -p tcp --dport 7071 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 143 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 995 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 993 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 943 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 3128 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -p tcp --dport 5190 -j ACCEPT
-A RH-Firewall-1-INPUT -s 192.168.0.0/26 -j ACCEPT
-A RH-Firewall-1-INPUT -i eth3 -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 1194 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 1194 -j ACCEPT
-A RH-Firewall-1-INPUT -d 224.0.0.251 -p udp -m udp --dport 5353 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT