[Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 312
  • Last Modified:

One box with two modems and three network cards

I have two modems assigned one on eth0 81.125.25.a and one on eth1 81.125.25.b , the 1st and 2nd modem have gateway 81.125.25.x. the internal network on eth2, and the clients from The problem is at 'route' when i do:

route -n add default gw 81.125.25.x
route -n add default gw 81.125.25.x dev eth1 (because first is on eth0)


route -n add default gw 81.125.25.x
route -n add -host 81.125.25.b gw 81.125.25.x dev eth1

this doesn't work too. In the first case I have net only on eth1 and not on eth0 and in the second on nothing. If I put only the 1st modem or the 2nd and add the default route it works, but I want both to work. I don't want load balancing because on the first modem I will put 5-6 persons and on second 20+ because the second line is more powerfull. (this will be via iptables SNAT : iptables -t nat -A POSTRUTING etc..)
Can somebody tell me what can i do to make the both modems work in the same time ? If you could give me the script it will be wonderful :)
1 Solution
make two sub networks in your lan.
connect 6 systems to one sub-net
connect 20 systems to second sbu-net
both subnet has ur linux system with modems as gateway
in gateway system add 1st subnet gw as  81.125.25.a
add 2nd subnet gw as  81.125.25.b

Gabriel OrozcoSolution ArchitectCommented:
you need routing.

iproute2 can handle this problem creating two different routing tables: one for eth0 and other for eth1.

check in


in the howto comes several examples about how to do what you want.
keepwalkingAuthor Commented:
Can u post the script for doing this ? I don't understand what is there I mean what is $P2_NET and in my case is only 1 provider but 2 modems and the same gateway as I  said upper in the question, I want the clients from be on modem 1 and that from on the other. I'm newbie in routings and this is why I asked here because all the answers of this question are read..read...and read howto's. Thanks
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Try the command:
ip route add default nexthop via 81.125.25.x dev eth0 weight 1  nexthop via 81.125.25.x dev eth1 weight 1
instead of two route add commands.
keepwalkingAuthor Commented:
I got the following error  :

RTNETLINK answers: Invalid argument
keepwalkingAuthor Commented:
Works now..thank lhboi

Featured Post


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now