Answer the question
In order to leave comments, you need to log in
Several IPs on one interface, you must specify the main one
gentoo linux system. 4 IPs are assigned to eth0, all 4 are direct (visible from the Internet):
config_eth0="abc10/24 abc20/24 abd10/24 abd20/24"
routes_eth0="default via abd1"
That is, two IPs from one network, two from another. Accordingly, I have an eth0 interface in the system, and 3 pseudo interfaces eth0: 1-3.
At the same time, any traffic that is not created by a service with binding to a specific IP (i.e. where there is no something like bind-ip abc10) has abd10 as the source address. I would like the default outgoing IP to be the one listed first, abc10.
To simplify the above, I want that when building a dynamic ssh tunnel (ssh -D 8080) through my server, which already has 4 IPs, I could set the IP under which 2ip.ru defines me.
As I understand it, this is shamanism with ip route ... now I am experimenting with it, but so far something has not worked out.
And a bonus question: how is it then ideologically correct to save all this into autoload in gentoo.
Answer the question
In order to leave comments, you need to log in
I asked myself, I'll answer myself: the issue was resolved by adding src abc10 to default via ..., that is, in /etc/conf.d/net I have
config_eth0="abc10/24 abc20/24 abd10/24 abd20/24"
routes_eth0= "default via abd1 src abc10"
Documentation and Google rules.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question