One box with two modems and three network cards

Posted on 2005-05-08
Last Modified: 2010-03-18
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 :)
Question by:keepwalking
    LVL 3

    Expert Comment

    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

    LVL 19

    Expert Comment

    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.

    Author Comment

    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 howto's. Thanks
    LVL 2

    Accepted Solution

    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.

    Author Comment

    I got the following error  :

    RTNETLINK answers: Invalid argument

    Author Comment

    Works now..thank lhboi

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
    Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now