-1

I have two internet connections from two different ISPs and I need to balance & failover the traffic originating to and from my network between the two ISPs.

My settings:

FIRST ISP (eth0): 152.152.104.226
SECOND ISP (eth1): 172.110.132.115
LOCAL NETWORK IP (eth2): 192.168.110.26

My scipt:

#DELETE DEFAULT GW
ip route del default

#ADD ROUTE FOR PORT 0
ip route add 152.152.104.224/29 dev eth0 src 152.152.104.226 table tetra
ip route add default via 152.152.104.225 table tetra

#ADD ROUTE FOR PORT 1
ip route add 172.110.132.112/28 dev eth1 src 172.110.132.115 table vega
ip route add default via 172.110.132.113 table vega

#ADD RULES FOR WAN(s)
ip rule add from 152.152.104.226 table tetra
ip rule add from 172.110.132.115 table vega

#DIVIDE TRAFFIC GIVE 1 ISP MORE WEIGHT. USE weight 1 FOR BOTH INTERFACES TO DIVIDE EVENLY
ip route add default scope global nexthop via 152.152.104.225 dev eth0 weight 4 nexthop via 172.110.132.113 dev eth1 weight 1

And it work. But when, i restart network (reboot system) or when i make "ifconfig down" to one of my interfaces, my rules are poped.

Where i can save it rules pernament ? I need, that scope of gateways

ip route add default scope global nexthop via 152.152.104.225 dev eth0 weight 4 nexthop via 172.110.132.113 dev eth1 weight 1

working after restart network or reboot system.

1 Answer 1

1

Instead of using commands, I would recommend you editing:

/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-[eth0,enp0s3]

Make sure that ONBOOT="yes" on /etc/sysconfig/network-scripts/ifcfg-[eth0,enp0s3] and you are good to go.

3
  • yes. where put my rules ? and how to do this ? in "/etc/sysconfig/network-scripts/route-eth*" ?
    – Valeriu
    Apr 26, 2016 at 9:04
  • and i need add scope of two isp
    – Valeriu
    Apr 26, 2016 at 9:05
  • If you don't know how networking works, you should google it, I cannot explain it in a comment..
    – sysfiend
    Apr 26, 2016 at 9:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .