Git Product home page Git Product logo

drsound / fault_tolerant_router Goto Github PK

View Code? Open in Web Editor NEW
185.0 27.0 20.0 93 KB

A daemon, running in background on a Linux router or firewall, monitoring the state of multiple internet uplinks/providers and changing the routing accordingly. LAN/DMZ internet traffic is load balanced between the uplinks.

License: GNU General Public License v2.0

Ruby 100.00%
multiple-internet-uplinks iptables netwokring load-balancing fault-tolerance routing

fault_tolerant_router's People

Contributors

drsound avatar gunterja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fault_tolerant_router's Issues

Examples of port forwarding in iptables template

Before I added multiple uplinks, I had port forwarding working through rules like:

*nat
-A PREROUTING -p tcp -m tcp -i ppp0 --dport 8080 -j DNAT --to-destination 192.168.1.212:80

*filter
-A FORWARD -p tcp -d 192.168.1.212 --dport 8080 -j ACCEPT

Now it no longer works. What's the right way to do this once fault_tolerant_router is running things?

Implement routing using realms

Implement routing using realms: this way we could connect all of the uplinks to a single Linux physical interface through a switch, without using VLANs.

Test using VLAN interfaces

Test using VLAN interfaces: Fault Tolerant Router has always been used with physical interfaces, each uplink on it's own physical interface.

i18n

i18n of email notifications, for non English speakers.

Web service status interface

A web service interface to query the status of the uplinks. A customer asked me to create a web control panel, where you can see the status of all of the uplinks: headquarters and subsidiaries.

Uplink priority groups

Useful to only use pay-per-traffic uplinks if no regular uplink is working.
Each uplink is a member of a priority group. The highest priority group with at least one working uplink is choosen and its members are load balanced. Lower priority group members are not used, unless all higher priority group members are down.

Configuration file check

To avoid misspelled parameters that would otherwise be ignored:

  • Check the configuration file structure
  • Check there are no unknown parameters

Event triggers

Triggers launching external scripts when an uplink goes up or down, for example to change some parameters in a mail server.

receive error when running

error received when running. Attempting to route traffic from wlan0 (AP) to 2 etc{1,3} addresses:

$ fault_tolerant_router monitor
/var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/lib/fault_tolerant_router/uplink.rb:65:in detect_ppp_ips!': undefined methodip_address' for nil:NilClass (NoMethodError)
from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/lib/fault_tolerant_router/uplink.rb:45:in initialize' from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/lib/fault_tolerant_router/uplinks.rb:5:innew'
from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/lib/fault_tolerant_router/uplinks.rb:5:in block in initialize' from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/lib/fault_tolerant_router/uplinks.rb:5:ineach'
from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/lib/fault_tolerant_router/uplinks.rb:5:in each_with_index' from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/lib/fault_tolerant_router/uplinks.rb:5:ineach'
from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/lib/fault_tolerant_router/uplinks.rb:5:in map' from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/lib/fault_tolerant_router/uplinks.rb:5:ininitialize'
from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/bin/fault_tolerant_router:150:in new' from /var/lib/gems/2.1.0/gems/fault_tolerant_router-1.2.0/bin/fault_tolerant_router:150:in<top (required)>'
from /usr/local/bin/fault_tolerant_router:23:in load' from /usr/local/bin/fault_tolerant_router:23:in

'

Config file:

uplinks:

  • interface: eth1
    type: ppp
    description: Example Provider 1
    priority_group: 1
    #optional parameter
    weight: 1
  • interface: eth3
    type: ppp
    description: Example Provider 2
    priority_group: 1
    #optional parameter
    weight: 2

downlinks:
lan: wlan0
#leave blank if you have no DMZ
dmz:

tests:
#an array of IP addresses to ping to verify the uplinks state. You can add as
#many as you wish. Predefined ones are Google DNS, OpenDNS DNS, other public
#DNS. Every time an uplink is tested the IP addresses are shuffled, so listing
#order is not important.
ips:

  • 8.8.8.8
  • 8.8.4.4
  • 208.67.222.222
  • 208.67.220.220
  • 4.2.2.2
  • 4.2.2.3
    #number of successfully pinged IP addresses to consider an uplink to be
    #functional
    required_successful: 4
    #number of ping retries before giving up on an IP
    ping_retries: 1
    #seconds between a check of the uplinks and the next one
    interval: 30

log:
#file: "/var/log/fault_tolerant_router.log"
file: "/tmp/fault_tolerant_router.log"
#maximum log file size (in bytes). Once reached this size, the log file will
#be rotated.
max_size: 1024000
#number of old rotated files to keep
old_files: 10

email:
send: false
sender: [email protected]
recipients:

base IP route table number, just need to change if you are already using

multiple routing tables

base_table: 1

just need to change if you are already using ip policy routing, to avoid

overlapping, must be higher than 32767 (the default routing table priority,

see output of "ip rule" command)

base_priority: 40000

just need to change if you are already using packet marking, to avoid

overlapping

base_fwmark: 1

RasPi setup issue "odd number list for Hash (SyntaxError)"

When I try to run the latest fault_tolerant_router package on a raspi 3 I am seeing the following issue:

$ fault_tolerant_router generate_config
/usr/local/bin/fault_tolerant_router:23:in `load': /var/lib/gems/1.8/gems/fault_tolerant_router-1.2.0/bin/fault_tolerant_router:75: odd number list for Hash (SyntaxError)
configuration_file: '/etc/fault_tolerant_router.conf',
^
/var/lib/gems/1.8/gems/fault_tolerant_router-1.2.0/bin/fault_tolerant_router:75: syntax error, unexpected ':', expecting '}'
configuration_file: '/etc/fault_tolerant_router.conf',
^
/var/lib/gems/1.8/gems/fault_tolerant_router-1.2.0/bin/fault_tolerant_router:75: syntax error, unexpected ',', expecting $end
from /usr/local/bin/fault_tolerant_router:23

Any suggestions?

with static its, gives RTNETLINK error

RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such file or directory
RTNETLINK answers: No such process
RTNETLINK answers: No such process
RTNETLINK answers: No such process
RTNETLINK answers: No such process
RTNETLINK answers: No such process
RTNETLINK answers: No such process

with cons file:

uplinks:

  • interface: eth1
    type: static
    ip: 192.168.1.17
    gateway: 192.168.1.1
    description: Example Provider 1
    priority_group: 1
    #optional parameter
    weight: 1
  • interface: eth3
    type: static
    ip: 192.168.1.22
    gateway: 192.168.1.1
    description: Example Provider 2
    priority_group: 1
    #optional parameter
    weight: 2

downlinks:
lan: wlan0
#leave blank if you have no DMZ
dmz:

tests:
#an array of IP addresses to ping to verify the uplinks state. You can add as
#many as you wish. Predefined ones are Google DNS, OpenDNS DNS, other public
#DNS. Every time an uplink is tested the IP addresses are shuffled, so listing
#order is not important.
ips:

  • 8.8.8.8
  • 8.8.4.4
  • 208.67.222.222
  • 208.67.220.220
  • 4.2.2.2
  • 4.2.2.3
    #number of successfully pinged IP addresses to consider an uplink to be
    #functional
    required_successful: 4
    #number of ping retries before giving up on an IP
    ping_retries: 1
    #seconds between a check of the uplinks and the next one
    interval: 30

log:
#file: "/var/log/fault_tolerant_router.log"
file: "/tmp/fault_tolerant_router.log"
#maximum log file size (in bytes). Once reached this size, the log file will
#be rotated.
max_size: 1024000
#number of old rotated files to keep
old_files: 10

email:
send: false
sender: [email protected]
recipients:

base IP route table number, just need to change if you are already using

multiple routing tables

base_table: 1

just need to change if you are already using ip policy routing, to avoid

overlapping, must be higher than 32767 (the default routing table priority,

see output of "ip rule" command)

base_priority: 40000

just need to change if you are already using packet marking, to avoid

overlapping

base_fwmark: 1

bind: Cannot assign requested address

I've configured my adapters in the config while, and whenever I monitor, I get something like this:

# fault_tolerant_router monitor
RTNETLINK answers: Invalid argument
RTNETLINK answers: Invalid argument
bind: Cannot assign requested address
bind: Cannot assign requested address
bind: Cannot assign requested address
bind: Cannot assign requested address
bind: Cannot assign requested address
...

And here's the output with --debug:

Uplink LAN: ping 208.67.222.222... bind: Cannot assign requested address
error
Uplink LAN: ping 4.2.2.3... bind: Cannot assign requested address
error
Uplink LAN: ping 8.8.8.8... bind: Cannot assign requested address
error
Uplink LAN: ping 8.8.4.4... bind: Cannot assign requested address
error
Uplink LAN: ping 208.67.220.220... bind: Cannot assign requested address
error
Uplink LAN: avoiding more tests because too many have been failed
Uplink LAN: 0 successful tests, 5 unsuccessful tests, state down
Uplink Internal Wi-Fi: ping 4.2.2.2... bind: Cannot assign requested address
error
Uplink Internal Wi-Fi: ping 208.67.220.220... bind: Cannot assign requested address
error
Uplink Internal Wi-Fi: ping 208.67.222.222... bind: Cannot assign requested address
error
Uplink Internal Wi-Fi: ping 4.2.2.3... bind: Cannot assign requested address
error
Uplink Internal Wi-Fi: ping 8.8.8.8... bind: Cannot assign requested address
error
Uplink Internal Wi-Fi: avoiding more tests because too many have been failed
Uplink Internal Wi-Fi: 0 successful tests, 5 unsuccessful tests, state down
Choosing default route: available uplinks: 
Choosing default route: highest priority group uplinks: 
Choosing default route: no available uplinks, no need for an update
No waiting, because all of the priority group members are down
...

And there's my config:

#see https://github.com/drsound/fault_tolerant_router for a complete parameter
#description

#add as many uplinks as needed, in this example ppp0 is used as default route only if both eth1 and eth2 are down
uplinks:
- interface: enp2s0
  type: static
  ip: 192.168.1.16
  gateway: 192.168.1.1
  description: LAN
  priority_group: 1
- interface: wlp4s0
  type: static
  ip: 192.168.1.116
  gateway: 192.168.1.1
  description: Internal Wi-Fi

downlinks:
  lan: eth0
  #leave blank if you have no DMZ
  dmz:

tests:
  #an array of IP addresses to ping to verify the uplinks state. You can add as
  #many as you wish. Predefined ones are Google DNS, OpenDNS DNS, other public
  #DNS. Every time an uplink is tested the IP addresses are shuffled, so listing
  #order is not important.
  ips:
  - 8.8.8.8
  - 8.8.4.4
  - 208.67.222.222
  - 208.67.220.220
  - 4.2.2.2
  - 4.2.2.3
  #number of successfully pinged IP addresses to consider an uplink to be
  #functional
  required_successful: 2
  #number of ping retries before giving up on an IP
  ping_retries: 1
  #seconds between a check of the uplinks and the next one
  interval: 60

log:
  #file: "/var/log/fault_tolerant_router.log"
  file: "/tmp/fault_tolerant_router.log"
  #maximum log file size (in bytes). Once reached this size, the log file will
  #be rotated.
  max_size: 1024000
  #number of old rotated files to keep
  old_files: 10

email:
  send: false
  sender: [email protected]
  recipients:
  - [email protected]
  - [email protected]
  - [email protected]
  #see http://ruby-doc.org/stdlib-2.3.1/libdoc/net/smtp/rdoc/Net/SMTP.html
  smtp_parameters:
    address: smtp.gmail.com
    port: 587
    #domain: domain.com
    authentication: :login
    enable_starttls_auto: true
    user_name: [email protected]
    password: secret-password

#base IP route table number, just need to change if you are already using
#multiple routing tables
base_table: 1

#just need to change if you are already using ip policy routing, to avoid
#overlapping, must be higher than 32767 (the default routing table priority,
#see output of "ip rule" command)
base_priority: 40000

#just need to change if you are already using packet marking, to avoid
#overlapping
base_fwmark: 1

iptables' state module is obsolete

While technically it will work (still), considering the fact that this is freshly released project I would suggest you to replace usage of iptables state module with conntrack module.
The state module is considered obsolete and conntrack is its (more powerful) replacement

Description on how to specify dynamic interfaces?

I have 2 uplinks, one is DSL with a static IP address, and the other is a roof top wireless ISP that spits out dynamic addresses. I don't see any instructions in the readme nor in the config file on how to specify that a particular interface is dynamically set. Am I missing where to find these instructions? Thanks!

Command to reset routing tables to the previous state

Once fault_tolerant_router terminates, routing tables are left in their current state. This is a good thing, otherwise you could lose access to the system (suppose you are accessing via SSH). If you want to reset the routing tables to the status they were in before running fault_tolerant_router, you have to do it by hand. I would like to add a new command to avoid this manual task.

Help required for setup the fault tolerant router

Hi Guys,

When we try to run fault_tolerant_router, I am getting some syntax issue with ip route command. I am trying to replicate fault tolerant router in my local setup. I am getting is error.

base machine:  Linux mint = 18
Kernel Version = 4.4.0-21 generic

Please let us know which base machine you guys tested, so that I can try to replicate.

console prints for your reference purpose

mint@mint /tmp $ sudo fault_tolerant_router --debug monitor`
Choosing default route: available uplinks: AirTel, AirCel
Choosing default route: highest priority group uplinks: AirTel, AirCel
Choosing default route: changes detected, update needed
Command: echo 1 > /proc/sys/net/ipv4/ip_forward
Command: ip rule del priority 40000 &> /dev/null
Command: ip rule del priority 40001 &> /dev/null
Command: ip rule del priority 40002 &> /dev/null
Command: ip rule del priority 40003 &> /dev/null
Command: ip rule del priority 40004 &> /dev/null
RTNETLINK answers: No such file or directory
Command: ip rule del priority 40005 &> /dev/null
RTNETLINK answers: No such file or directory
Command: ip rule del priority 40006 &> /dev/null
RTNETLINK answers: No such file or directory
Command: ip rule del priority 40007 &> /dev/null
RTNETLINK answers: No such file or directory
Command: ip rule del priority 40008 &> /dev/null
RTNETLINK answers: No such file or directory
Command: ip rule del priority 40009 &> /dev/null
Usage: ip route { list | flush } SELECTOR
ip route save SELECTOR
ip route restore
ip route showdump
ip route get ADDRESS [ from ADDRESS iif STRING ]
[ oif STRING ] [ tos TOS ]
[ mark NUMBER ]
ip route { add | del | change | append | replace } ROUTE
SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ type TYPE ] [ scope SCOPE ]
ROUTE := NODE_SPEC [ INFO_SPEC ]
NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ scope SCOPE ] [ metric METRIC ]
INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...
NH := [ via [ FAMILY ] ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS
FAMILY := [ inet | inet6 | ipx | dnet | mpls | bridge | link ]
OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] ADDRESS ]
[ rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ]
[ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]
[ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]
[ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]
[ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]
[ pref PREF ]
TYPE := [ unicast | local | broadcast | multicast | throw |
unreachable | prohibit | blackhole | nat ]
TABLE_ID := [ local | main | default | all | NUMBER ]
SCOPE := [ host | link | global | NUMBER ]
NHFLAGS := [ onlink | pervasive ]
RTPROTO := [ kernel | boot | static | NUMBER ]
PREF := [ low | medium | high ]
TIME := NUMBER[s|ms]
BOOL := [1|0]
FEATURES := ecn
Command: ip route del table 1 &> /dev/null
Usage: ip route { list | flush } SELECTOR
ip route save SELECTOR
ip route restore
ip route showdump
ip route get ADDRESS [ from ADDRESS iif STRING ]
[ oif STRING ] [ tos TOS ]
[ mark NUMBER ]
ip route { add | del | change | append | replace } ROUTE
SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ type TYPE ] [ scope SCOPE ]
ROUTE := NODE_SPEC [ INFO_SPEC ]
NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ scope SCOPE ] [ metric METRIC ]
INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...
NH := [ via [ FAMILY ] ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS
FAMILY := [ inet | inet6 | ipx | dnet | mpls | bridge | link ]
OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] ADDRESS ]
[ rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ]
[ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]
[ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]
[ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]
[ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]
[ pref PREF ]
TYPE := [ unicast | local | broadcast | multicast | throw |
unreachable | prohibit | blackhole | nat ]
TABLE_ID := [ local | main | default | all | NUMBER ]
SCOPE := [ host | link | global | NUMBER ]
NHFLAGS := [ onlink | pervasive ]
RTPROTO := [ kernel | boot | static | NUMBER ]
PREF := [ low | medium | high ]
TIME := NUMBER[s|ms]
BOOL := [1|0]
FEATURES := ecn
Command: ip route del table 2 &> /dev/null
Usage: ip route { list | flush } SELECTOR
ip route save SELECTOR
ip route restore
ip route showdump
ip route get ADDRESS [ from ADDRESS iif STRING ]
[ oif STRING ] [ tos TOS ]
[ mark NUMBER ]
ip route { add | del | change | append | replace } ROUTE
SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ type TYPE ] [ scope SCOPE ]
ROUTE := NODE_SPEC [ INFO_SPEC ]
NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ scope SCOPE ] [ metric METRIC ]
INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...
NH := [ via [ FAMILY ] ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS
FAMILY := [ inet | inet6 | ipx | dnet | mpls | bridge | link ]
OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] ADDRESS ]
[ rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ]
[ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]
[ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]
[ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]
[ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]
[ pref PREF ]
TYPE := [ unicast | local | broadcast | multicast | throw |
unreachable | prohibit | blackhole | nat ]
TABLE_ID := [ local | main | default | all | NUMBER ]
SCOPE := [ host | link | global | NUMBER ]
NHFLAGS := [ onlink | pervasive ]
RTPROTO := [ kernel | boot | static | NUMBER ]
PREF := [ low | medium | high ]
TIME := NUMBER[s|ms]
BOOL := [1|0]
FEATURES := ecn
Command: ip route del table 3 &> /dev/null
Usage: ip route { list | flush } SELECTOR
ip route save SELECTOR
ip route restore
ip route showdump
ip route get ADDRESS [ from ADDRESS iif STRING ]
[ oif STRING ] [ tos TOS ]
[ mark NUMBER ]
ip route { add | del | change | append | replace } ROUTE
SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ type TYPE ] [ scope SCOPE ]
ROUTE := NODE_SPEC [ INFO_SPEC ]
NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ scope SCOPE ] [ metric METRIC ]
INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...
NH := [ via [ FAMILY ] ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS
FAMILY := [ inet | inet6 | ipx | dnet | mpls | bridge | link ]
OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] ADDRESS ]
[ rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ]
[ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]
[ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]
[ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]
[ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]
[ pref PREF ]
TYPE := [ unicast | local | broadcast | multicast | throw |
unreachable | prohibit | blackhole | nat ]
TABLE_ID := [ local | main | default | all | NUMBER ]
SCOPE := [ host | link | global | NUMBER ]
NHFLAGS := [ onlink | pervasive ]
RTPROTO := [ kernel | boot | static | NUMBER ]
PREF := [ low | medium | high ]
TIME := NUMBER[s|ms]
BOOL := [1|0]
FEATURES := ecn
Command: ip route del table 4 &> /dev/null
Usage: ip route { list | flush } SELECTOR
ip route save SELECTOR
ip route restore
ip route showdump
ip route get ADDRESS [ from ADDRESS iif STRING ]
[ oif STRING ] [ tos TOS ]
[ mark NUMBER ]
ip route { add | del | change | append | replace } ROUTE
SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ type TYPE ] [ scope SCOPE ]
ROUTE := NODE_SPEC [ INFO_SPEC ]
NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ scope SCOPE ] [ metric METRIC ]
INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...
NH := [ via [ FAMILY ] ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS
FAMILY := [ inet | inet6 | ipx | dnet | mpls | bridge | link ]
OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] ADDRESS ]
[ rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ]
[ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]
[ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]
[ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]
[ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]
[ pref PREF ]
TYPE := [ unicast | local | broadcast | multicast | throw |
unreachable | prohibit | blackhole | nat ]
TABLE_ID := [ local | main | default | all | NUMBER ]
SCOPE := [ host | link | global | NUMBER ]
NHFLAGS := [ onlink | pervasive ]
RTPROTO := [ kernel | boot | static | NUMBER ]
PREF := [ low | medium | high ]
TIME := NUMBER[s|ms]
BOOL := [1|0]
FEATURES := ecn
Command: ip route del table 5 &> /dev/null
Usage: ip route { list | flush } SELECTOR
ip route save SELECTOR
ip route restore
ip route showdump
ip route get ADDRESS [ from ADDRESS iif STRING ]
[ oif STRING ] [ tos TOS ]
[ mark NUMBER ]
ip route { add | del | change | append | replace } ROUTE
SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ type TYPE ] [ scope SCOPE ]
ROUTE := NODE_SPEC [ INFO_SPEC ]
NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]
[ table TABLE_ID ] [ proto RTPROTO ]
[ scope SCOPE ] [ metric METRIC ]
INFO_SPEC := NH OPTIONS FLAGS [ nexthop NH ]...
NH := [ via [ FAMILY ] ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS
FAMILY := [ inet | inet6 | ipx | dnet | mpls | bridge | link ]
OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] ADDRESS ]
[ rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ]
[ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]
[ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]
[ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]
[ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]
[ pref PREF ]
TYPE := [ unicast | local | broadcast | multicast | throw |
unreachable | prohibit | blackhole | nat ]
TABLE_ID := [ local | main | default | all | NUMBER ]
SCOPE := [ host | link | global | NUMBER ]
NHFLAGS := [ onlink | pervasive ]
RTPROTO := [ kernel | boot | static | NUMBER ]
PREF := [ low | medium | high ]
TIME := NUMBER[s|ms]
BOOL := [1|0]
FEATURES := ecn
Command: ip route del table 6 &> /dev/null
Command: echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
Command: echo 2 > /proc/sys/net/ipv4/conf/enp2s2/rp_filter
Command: echo 2 > /proc/sys/net/ipv4/conf/ens32/rp_filter
Command: ip route replace table 1 default via 192.168.200.100 src 192.168.200.89
Command: ip rule add priority 40000 from 192.168.200.89 lookup 1
Command: ip rule add priority 40002 fwmark 1 lookup 1
Command: ip route replace table 2 default via 192.168.70.100 src 192.168.70.89
Command: ip rule add priority 40001 from 192.168.70.89 lookup 2
Command: ip rule add priority 40003 fwmark 2 lookup 2
Command: ip rule add priority 40004 from all lookup 3
Command: ip route replace table 3 default nexthop via 192.168.200.100 weight 1 nexthop via 192.168.70.100 weight 2
Command: ip route flush cache
Uplink AirTel: ping 4.2.2.2... ok
Uplink AirTel: ping 4.2.2.3... ok
Uplink AirTel: ping 8.8.8.8... ok
Uplink AirTel: ping 8.8.4.4... ok
Uplink AirTel: avoiding more tests because there are enough positive ones
Uplink AirTel: 4 successful tests, 0 unsuccessful tests, state up
Uplink AirCel: ping 8.8.8.8... ok
Uplink AirCel: ping 208.67.222.222... ok
Uplink AirCel: ping 4.2.2.2... ok
Uplink AirCel: ping 4.2.2.3... ok
Uplink AirCel: avoiding more tests because there are enough positive ones
Uplink AirCel: 4 successful tests, 0 unsuccessful tests, state up
Choosing default route: available uplinks: AirTel, AirCel
Choosing default route: highest priority group uplinks: AirTel, AirCel
Choosing default route: no changes, no need for an update
Waiting 60 seconds...
Uplink AirTel: ping 8.8.4.4... ok
Uplink AirTel: ping 4.2.2.2... ok
Uplink AirTel: ping 4.2.2.3... ok
Uplink AirTel: ping 8.8.8.8... ok
Uplink AirTel: avoiding more tests because there are enough positive ones
Uplink AirTel: 4 successful tests, 0 unsuccessful tests, state up
Uplink AirCel: ping 208.67.222.222... ok
Uplink AirCel: ping 4.2.2.2... ok
Uplink AirCel: ping 4.2.2.3... ok
Uplink AirCel: ping 208.67.220.220... ok
Uplink AirCel: avoiding more tests because there are enough positive ones
Uplink AirCel: 4 successful tests, 0 unsuccessful tests, state up
Choosing default route: available uplinks: AirTel, AirCel
Choosing default route: highest priority group uplinks: AirTel, AirCel
Choosing default route: no changes, no need for an update
Waiting 60 seconds...

`

PPP interface test needed

Please test and report if PPP interface support works correctly: I only did some local tests because I have no real PPP uplink.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.