forcing traffic through certain route(forcing source ip)
I have a box with two nics one has a public ip and the other has a private ip. The public ip is used only for forwarding and has routes setup to the internet. The private ip is used for management and has routes setup to the internet
Basically, I want the routes to work in such a way that any traffic the box generates goes through the private network to reach the internet.
I tried setting up a separate table for the private nic and routing all traffic with the private source ip through that table. However, linux always seems to choose the public ip for the source ip. How can I force linux by default to pick a certain source ip over another?
If I type "ping google.com" into the box, linux chooses the public ip as the source address. I want it to choose the private ip.