On my linux server I have multiple ip addresses I can use

ip route change default via  $gateway dev eth1 src $ipaddress 

to change my default outgoing ip. Can I do this for only one port All outgoing packets on port 80 will use IP2 All other outgoing packets will use IP1

  • 2
  • You can use an iptables NAT rule as per above comment but it's cleaner imho to bind your web server (if that's what you are using) to the particular ip address IP2 (ie approach the issue as service-centric instead of adding firewall/routing rules on top). Jun 10 '14 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.