Answer the question
In order to leave comments, you need to log in
Are there ready-made solutions for multihoming in linux?
First, about the problem we are solving:
There are several links, each with its own address (or several addresses).
For example, we have eth0 with addresses 1.1.1.1 and 1.1.1.2, and eth1 with address
2.2.2.2 request came.
That is, let ip ro show
default via 2.2.2.1 dev eth1 onlink
AND on the external host we run ping 1.1.1.2
Responses to ICMP requests should go from the eth0 interface from the address 1.1.1.2
The task is familiar, it is solved using iptables / nftables and iproute2.
But the solution each time resembles a "sunset by hand."
Question: is there something ready to solve this problem? In order for the nftables rules for marking packets/records in conntrack, ip rule and their associated routing tables to be kept up to date automatically (the addition/removal of network interfaces and addresses on them was tracked).
Answer the question
In order to leave comments, you need to log in
NetworkManager is supported but requires manual configuration.
Something like:
# nmcli c modify 'eth0' ipv4.route-table 1234
# nmcli c modify 'eth0' ipv4.routing-rules "from 1.2.3.4 table 1234 priority 1000"
# ip route add default dev lo
Multihome IPv4 in Linux
Just do not forget to enter connected routes, otherwise local traffic will go through the router, although it should go directly from machine to machine.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question