Hi Friends,

Here is my Scenario,

I have two ISP Connections from different Providers BSNL and Sify. Both are 1MBps. In my Office Now we are using Sify for Only one Machine and BSNL is configured in wifi router. But Often BSNL network is in problem. So we have planned to use both Sify and BSNL simultaneously. what we have to do is to Make some arrangements either in cabling or in configuring we have to use both the connections simultaneously. without hassle so that the employees will always be on line. and they may not know in which ISP they are browsing. But the internet should be available always.

We have two servers which has running Redhat 5.5 with two Onboard Ethernet card so totally Four Ethernet cards. And we are using Only linux such as fedora, ubuntu and CentOS in our Office and not windows. And all are connecting to internet by wireless. So please give some ideas to use any linux machine as router or something else that would balance the two ISPs equally, that is if one ISP is down then the other should take up automatically without doing any manual configuration and without buying additional hardware or proprietary software.

Dani AI

Generated

Short, practical plan for (building on the pointer from to the LARTC material): make one Linux server the office gateway, connect both ISP modems to two NICs, connect the LAN/Wi‑Fi to the other NIC(s) (or set the existing wireless router to AP/bridge mode and disable its DHCP). Two safe, incremental options follow — start with the simple failover approach, then move to connection-aware load balancing when stable.

Enable forwarding + simple failover (fast to deploy)

# enable IP forwarding
sysctl -w net.ipv4.ip_forward=1

# NAT for both WANs
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE   # ISP1
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE   # ISP2

Basic failover script (run from cron every 30s)

#!/bin/sh
GW1=GW1_IP; GW2=GW2_IP
if ! ping -c2 -W2 $GW1 >/dev/null; then
  ip route replace default via $GW2 dev eth1
else
  ip route replace default via $GW1 dev eth0
fi

This gives automatic switchover of all traffic with minimal complexity.

Connection-aware load‑balancing (keeps sessions on same ISP)

# add tables in /etc/iproute2/rt_tables:
100 isp1
200 isp2

ip route add default via GW1 dev eth0 table isp1
ip route add default via GW2 dev eth1 table isp2
ip rule add fwmark 1 table isp1
ip rule add fwmark 2 table isp2

# mark connections ~50/50, preserve marks
iptables -t mangle -A PREROUTING -j CONNMARK --restore-mark
iptables -t mangle -A PREROUTING -m conntrack --ctstate NEW -m statistic --mode random --probability 0.5 -j MARK --set-mark 1
iptables -t mangle -A PREROUTING -m conntrack --ctstate NEW -j MARK --set-mark 2
iptables -t mangle -A PREROUTING -j CONNMARK --save-mark

Notes and cautions

  • Disable reverse‑path filtering (rp_filter=0) on WAN interfaces to avoid asymmetric-routing drops.
  • Per‑packet multipath breaks many protocols; prefer the conntrack+fwmark method for real use.
  • Outbound NAT/masquerade works fine for client browsing; inbound services require sticky public IPs or DNS tricks (BGP/paid services otherwise).
  • Persist rules across reboots (rc.local or distro firewall scripts) and test thoroughly before switching off the old router.

If interest grows, follow the deeper examples in the multi‑wan routing HOWTO pointed to — it explains edge cases and persistence mechanisms in detail.

Prob be easier to see if you could set this up on your firewall or border router....
If you only have the option for using a Linux box this may help ...

http://lartc.org/howto/lartc.rpdb.multiple-links.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.