Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I made the first gateway the default-gateway. IP-packets coming from the other gateways should be returned to them.
I tried
"ip rule add from 10.10.10.60 table 60"
"ip route add table 60 default via 10.10.10.60"
and
"ip rule add from 10.10.10.70 table 70"
"ip route add table 70 default via 10.10.10.70"
Unfortunately that does not work. But I have no idea why it does not work.
there are no hidden parameters, so it should work; if it does not, describe everything you did; in general, you have to define new route table, add rule(s) to route to that table and fill it out with necessary routing entries
unfortunately it does not work.
The problem: ip traffic comes from outside via different routers (10.10.10.50, 10.10.10.60, 10.10.10.70). I don't know the source ip addresses of these clients. The incoming traffic to the server should be returned via the router which it came from. So what I did:
1. I added to /etc/iproute2/rt_tables "10 box1" (as an example for router 10.10.10.50)
2. I defined the default gateway for "box1" with: "ip route add default via 10.10.10.50 table box1
3. I defined the condition "if traffic comes via box1 routing table box1 with: "ip rule add from 10.10.10.50 table box1"
4. ip route flush cache
It seems that the condition "from 10.10.10.50" does not become true. But I cannot use the ip address of a real client, because I don't know them....
well, in this case you know ethernet address of router that packet went through; set mark with iptables (mangle table) matching the ethernet source address and add iproute rule using fwmark selector; probably you need to mark connections as well as distinct packets
thank you very much for the explanation. Yes I know the MAC-address of the "source-router" but I had never to do in detail with iptables.
So I will start reading. I appreciate any closer explanation of the steps.
Can you tell me how to mark a packet with the mac-address of the "source-router" it came from?
iptables -A PREROUTING -t mangle -m mac --mac-source XX:XX:XX:XX:XX:XX -j MARK --set-mark 1
ip rule add fwmark 1 table box1
(in table box1 is: "default via 10.10.10.50 dev eth0)
But again it seems that the rule-condition does not come true because it does not work....
then there are should be conflicting settings; among things to check: icmp-redirects, routing cache, routing related parameters in sysctl;
also locally generated traffic does not traverse PREROUTING chain in mangle but OUTPUT
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.