Created
June 5, 2018 12:25
-
-
Save TomCan/5af6e3623572bc88d245f4c9eebe51c6 to your computer and use it in GitHub Desktop.
Routing traffic out over the interface the connection was received on in a setup where multiple NICs are present.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # If you're using multiple NICs/IPs on AWS, traffic might be sent out over one of the 2 NICs only. | |
| # And the other IP will not be usable. | |
| # | |
| # /etc/network/interfaces | |
| iface eth0 inet dhcp | |
| post-up ip route add default via <ip-of-default-gateway-of-eth0> dev eth0 tab 1 | |
| post-up ip rule add from <ip-of-eth0> tab 1 | |
| pre-down ip rule del from <ip-of-eth0> tab 1 | |
| pre-down ip route del default via <ip-of-default-gateway-of-eth0> dev eth0 tab 1 | |
| iface eth1 inet dhcp | |
| post-up ip route add default via <ip-of-default-gateway-of-eth1> dev eth1 tab 2 | |
| post-up ip rule add from <ip-of-eth1> tab 2 | |
| pre-down ip rule del from <ip-of-eth1> tab 2 | |
| pre-down ip route del default via <ip-of-default-gateway-of-eth1> dev eth1 tab 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment