Tudor is a techie turned manager who fights like mad to keep his tech skills honed and relevant. Everything from web hosting, networking, *nix and the like. Constantly developing and co-ordinating with others to make the web a better (and easier to use) place.
Wednesday, 28th Jul 2010 Posted @ 12:43
Was having a random problem with a customer network that I tried to resolve by playing around with one of our test hosting setups (as I could run debugs faster, etc) and then spotted something odd.
The address reported as the source when sending traffic out from my servers was different from the address I use to contact them from the outside. I eventually tracked this down to IPCOP using MASQUERADE, which meant all outgoing traffic was hidden behind a single address (not what you need when you need RDNS, etc). What I needed was source NAT or SNAT as its known.
Edit /etc/rc.d/rc.firewall
Find the following:
# Outgoing masquerading DISABLED(This section hides all traffic behind the first address on the RED interface)
/sbin/iptables -t nat -A REDNAT -o $IFACE -j MASQUERADE
# Machines on GREENI saved that and then rebooted. All tested and working.
# web server
/sbin/iptables -t nat -A POSTROUTING -s 192.168.1.2 -j SNAT --to-source x.x.x.2
# mail server
/sbin/iptables -t nat -A POSTROUTING -s 192.168.1.3 -j SNAT --to-source x.x.x.3
# All other machines on GREEN
/sbin/iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j SNAT --to-source x.x.x.1
[ no comments : Add ]