I've got a problem on one of my boxes I'm trying to resolve. I need to have named making it's outbound connections from a different source IP address than the primary one assigned to the server. eg. Primary IP is 1.2.3.4 with secondary IP address 2.3.4.5. When a dns request is made by the server now to a remote name server is uses 1.2.3.4 as the default source address for the request but I want the request to appear as if it's coming from 2.3.4.5 instead as that's where all the other requests on the server are going through. I'm pretty sure that this can be done with some iptables routing rules but I'm having trouble getting my head around the correct syntax required. Little help?
iptables -t nat -I POSTROUTING -p udp -s 1.2.3.4 -j SNAT --to-source 2.3.4.5 test the above rule and/or do more research on iptables and snat.