drsound / fault_tolerant_router

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.
GNU General Public License v2.0
185 stars 20 forks source link

bind: Cannot assign requested address #23

Open MicroDroid opened 7 years ago

MicroDroid commented 7 years ago

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: router@domain.com
  recipients:
  - user1@domain.com
  - user2@domain.com
  - user3@domain.com
  #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: user@gmail.com
    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