Nov 24, 2009 10:29 AM
OpenSBC on Centos; iptables problem
I have built a centos server with opensbc on it. Now I need to set up iptables to do the interface routing and protection of the server. I don't need anything but sip/rtp and ssh from inside the lan to the server. I have the following iptables portion but cannot get it to run on centos. Is there someone here who might know iptables well enough to help me complete this into a functional config. Public side is on eth1 while private side is on eth0.
Thanks very much.
iptables --flush
iptables -F FORWARD
iptables -F nat
- EXTIF is my WAN-facing interface of the NAT ( eth1 ).
- INTIF0 is my LAN-facing interface of the NAT ( eth0 ).
export EXTIF=eth1
export INTIF0=eth0
- my sipx proxy server and sipxbridge run here.
export SIPXADDR=192.168.5.75
export PORTRANGE=10000:20000
iptables -A FORWARD -i $EXTIF -o $INTIF0 -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $INTIF0 -o $EXTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -t nat -A PREROUTING -p udp -i $EXTIF --dport $PORTRANGE -j DNAT --to-destination $SIPXADDR
iptables -A FORWARD -i $EXTIF -o $INTIF0 -d $SIPXADDR -p udp --dport $PORTRANGE -j ACCEPT
iptables -t nat -A PREROUTING -i eth3 -p udp --dport 5060 -j DNAT --to-destination $SIPXADDR:5060
iptables -A FORWARD -i $EXTIF -o eth0 -d $SIPXADDR -p udp --dport 5060 -j ACCEPT
iptables --table nat --append POSTROUTING --out-interface $EXTIF -j MASQUERADE