I'm running an ubuntu router using quagga. The router has many virtual interfaces each connected to a different upstream partner. One of these virtual interfaces is connected to an IX. The IP assigned from the IX is not routed globally and is only used to communicate with the peering partners of this IX (it's a public IP however, not a private one).
The problem is that prorgrams running on the router seem to get their source IP depending on the destination IP. So for example mtr 50.31.164.145
uses our IX assigned IP as its source and thus doesn't work. I know I can specify the source IP when using mtr with mtr --address X.X.X.X 50.31.164.145
, but there are many programs which don't offer this option.
Is there any way to generally deny the (automatic) usage of an interface/ip, so that the IX assigned IP will never be used automatically?
I would try iptables with SNAT target to change, source IP to another IP when packet is leaving the system with this interface IP address.