{"id":19955394,"url":"https://github.com/homebackend/go-internet-failover-service","last_synced_at":"2026-05-04T11:38:12.992Z","repository":{"id":206784250,"uuid":"717694483","full_name":"homebackend/go-internet-failover-service","owner":"homebackend","description":"go-internet-failover service is internet failover service","archived":false,"fork":false,"pushed_at":"2024-09-06T20:30:50.000Z","size":54,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-01-12T06:48:00.173Z","etag":null,"topics":["go","golang","internet","linux","raspberry-pi","service"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/homebackend.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-12T09:27:16.000Z","updated_at":"2024-12-09T19:21:37.000Z","dependencies_parsed_at":"2024-01-09T20:42:06.193Z","dependency_job_id":"fb3e728c-fc86-45b7-8e84-d203c353e4ed","html_url":"https://github.com/homebackend/go-internet-failover-service","commit_stats":null,"previous_names":["homebackend/go-internet-failover-service"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/homebackend%2Fgo-internet-failover-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/homebackend%2Fgo-internet-failover-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/homebackend%2Fgo-internet-failover-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/homebackend%2Fgo-internet-failover-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/homebackend","download_url":"https://codeload.github.com/homebackend/go-internet-failover-service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241383949,"owners_count":19954245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","internet","linux","raspberry-pi","service"],"created_at":"2024-11-13T01:27:15.120Z","updated_at":"2026-05-04T11:38:12.948Z","avatar_url":"https://github.com/homebackend.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![MIT License][license-shield]][license-url]\n[![LinkedIn][linkedin-shield]][linkedin-url]\n\n# go-internet-failover\n\ngo-internet-failover service (referred as `IFS` elsewhere in this document) is internet failover service. It allows automatic switching of internet connections in case of failure of any of the internet connections. The end user ranks the various internet connections based on their preferences, and IFS ensures that the highest ranked working internet connection gets configured, and ready for use. Note it is not a load balancing service as that is not its intent. Further, it works with **IPv4** only.\n\n## Prerequisites\n\n1. **Linux router**: This is the machine where IFS will be running. Note, IFS supports only GNU/Linux. As a prerequisite, the router needs to be configured to forward all packets from your local network (LAN) to internet (WAN). All the different WANs need to be reachable from the Linux router. Additionally following commands should be present: `sudo`, `ip`, `iptables`, `ping`.\n2. **Disable Ipv6**: IPv6 needs to be disabled on your LAN. This is not a prerequisite per say only that your IPv6 traffic will not behave actually make use of failover capabilities offered by `IFS`.\n3. **Linux knowhow**: You should be sufficiently comfortable with using Linux command line and should know networking basics. IFS is not at a stage where it can detect and autoconfigure itself as per your network configuration.\n\n## Typical usage\n\nTypical usage is when you have a primary broadband connection which typically caters to your internet requirements, and you have one secondary internet connection, to which you want to fallback in case your primary internet connection fails. The fallback to secondary connection should be automatic, and once primary internet connection becomes available, it should again switch back to the primary internet connection.\n\n![Architecture Diagram](https://cdn-0.plantuml.com/plantuml/png/NP1FR_8m38Vl_XGMTtZLz8eGhxJB9FP7ko8EfJ4bMfeWDu6XgTzzSL9jAhSyJtwn7M-7q728lONM-gZn6n3tpouGEme7R0OqC084tr4u4vVxTpPzmtTyyPfwh7ACAxafHXMZ_anTJ0qZE1y8Zpu4twC_YKDyS_QEtf68r0OxSoMNV2-F_x6FWNZ0cx4MZvHy74ZZoJEQQL9isfQ60H2RT7RtKW63wMa5v3HALm0mk5x5oseZuygPJNSEWYgZzZSdL0DmXKl1_TbeJUwmp25M3xQ4BqtxsNI4Yzt_rqNPqSwu-8KVUVJyUSj9p_QOKazqDIrDAzJLJAeYrKpMHShIHXZpcEiyqN8Z7LWbp9-Qk4uSBmN0yaJIIk0tgbNXKadgWtvOG4bfDRSbl2MdOsz_0000)\n\n## Building and installing\n\nTo build the code execute command `make build`. This will build executable: `bin/goifs`. Executing command `./bin/goifs` will print the command line usage instructions.\n\nTo build deb installer package (which can be installed on Debian, Ubuntu, Raspbian OS among others) execute the command `make debian`. The package gets built in the directory `build/debian/goifs.deb`.\n\nTo install the above command using **sudo** execute the command `make debian-install`.\n\nAlternatively, you can build, and install in one step simply by executing command: `make debian-install`.\n\n## Configuration\n\nThe default configuration file resides in `/etc/goifs/ifs.yaml`.\n\n### Global configuration parameters\n\n| Attribute | Type | Default Value | Description |\n| --------- | ---- | ------------- | ----------- |\n| maxPacketLoss | integer | 50 | The maximum number of failed pings. |\n| minPacketLoss | integer | 20 | The minimum number of failed pings. |\n| minSuccessivePacketsRecvd | integer | 20 | The minimum number of consecutive received pings. Used to decide whether connection is up. |\n| maxSuccessivePacketsLost | integer | 10 | The maximum number of consecutive lost pings. Used to decide whether connection is down. |\n| useSudo | boolean | false | Use sudo for executing commmands. Useful if you want to run as non-root user. |\n| cleanIfRequired | boolean | true | Clean network configuration if required. Useful if `IFS` did not clean up network configuration during last run. |\n| ping | string | 1.1.1.1 | IP address to be pinged for determining network connection status. |\n| connections | array | | Internet connections configuration. Each item of the array is as defined in the next section. |\n\n### Connection configuration parameters\n\n| Attribute | Type | Description |\n| --------- | ---- | ----------- |\n| name | string | Name of connection. Should be unique and follow all rules of Linux network namespace naming. |\n| rank | integer | Priority/rank of network connection for failover. Lower value means higher priority. |\n| ip | string | IPv4 address of virtual interface created in global namespace. |\n| peerIp | string | IPv4 address of virtual interface create in network namespace. |\n| mask | integer | Network mask used for the network |\n| gwIf | string | Interface where Gateway is available. |\n| gw | string | Gateway IP address. |\n| mark | integer | Unique mark to be used for packets. |\n\n### Decision algorithm\n\nFor each connection, this service maintains a record of\n1. Number of successful pings in last 100 pings (A)\n2. Number of failed pings in the last 100 pings (B)\n3. Number of consecutive successful pings (C) \n4. Number of consecutive failed pings (D)\n\nWhen connection status is up: if `B \u003e maxPacketLoss` or `D \u003e= maxSuccessivePktsLost` the connection status is marked as down.\n\nWhen connection status is down: if `B \u003c= minPacketLoss` or `C \u003e= minSuccessivePktsRcved` the connection status is marked as up.\n\nOnce connection status changes for any connection from up to down or vice-versa, the connection with better priority/rank (lower number has better priority) having status as up is activated.\n\n### Example\n\nConsider the case where there are two internet connections - broadband and 4G. The requirement is to have broadband as primary connection and 4G as failover internet connection. The broadband is on network `192.168.1.0/24` and 4G on network `192.168.3.0/24`. Here we assume that network forwarding with IP Masquerade is enabled on Linux router.\n\nThe following diagrams illustrates the original configuration where broadband connection is being used:\n\n![Broadband Architecture Diagram](https://www.planttext.com/api/plantuml/png/fLFVIyCm47xFNt7u8XGxJJP4HSkGmHHKP8ZlsN9pOMaoqYjpYl-xNTfkcTsR3ot9TtVVZoiT5YGzbRbX1kS4vC3hZmM1qXvdf9rbf_3WlFvobgG1eoqMDv2csHdSfcbuPLNBEthIiwWXrBTFnaYJGNX1MZk_XBMc1KozaseghM9iPbofG5j2Rv60iLoku2H9xjkM93a1MK3k5EOSlXd0ssQ5S9V1hgN29j8kjnYlpe-luNGjUlpogiTxdFtiQ0VZc4ySy0t64P7e4FKRejf8bNldcZLa1rYh-AHj-GaJLrPue-t39MWZBIuwXiMv6BIriIHSoytVHA7AEmxta_pOP3zCZd0kIqEr9qYshkjGhMO7uX4aecsEi5YIMpMnL4ZKsJwlFHqD8lPs8ZVrVYATPpVL1jilTrH6_4TcY5PL_y0l)\n\nThe following diagram illustrates the case where failover internet connection is being used (the 4G connection):\n\n![4G Architecture Diagram](https://www.planttext.com/api/plantuml/png/fLBTIyCm47_FNt7u8XGxJJT4HSkGmHHKP8ZlsN9pOMaoqYjpYl-xMVevkpSVMfBVtVq-hXtd91mLcMOQbmHamQcF5O5K3XUah66dy62T-hA6X0Qj3EOt4CVf6Tp6SNYblkKT7Qb5fo7Kzq_AI956U47QMhU6hQ8LZAQCBRGj92X3w0mIC9Q93Pn4qRspGiw5aL5q0YA7p4hCE7mpWBVT1k4kXQR5OpDXrdkC-_FZQpXT9mD-UJNW0yv-6jhHjCkN7F1vEorHqYCQLaIb4H-uSSqgiWEiLdnIflY4cIqyNccxS0dQIAkBdk7aF1dLjQaWt8hTtqIXodiEsqb-R78O9YUu58McqXD4UzTbW5gpXHgXRbUxpGdcQxARAfOCYNhRvwMdeq6Irax7JRcVZiwpdIkDzPSxAfFyHsQCHlgV_nS0)\n\nThe configuration file to support the above use case is as follows:\n\n```yaml\nmaxPacketLoss: 50\nminPacketLoss: 20\nminSuccessivePacketsRecvd: 20\nmaxSuccessivePacketsLost: 10\nuseSudo: true\ncleanIfRequired: true\nping: 1.1.1.1\nconnections:\n  - name: fiber\n    rank: 1\n    ip: 192.168.2.1\n    peerIp: 192.168.2.2\n    mask: 24\n    gwIf: eth0\n    gw: 192.168.1.1\n    mark: 101\n  - name: fourg\n    rank: 2\n    ip: 192.168.4.1\n    peerIp: 192.168.4.2\n    mask: 24\n    gwIf: eth1\n    gw: 192.168.3.1\n    mark: 102\n```\nWith the above configuration you will end up with the following network configuration:\n\n![Final Configuration](https://www.planttext.com/api/plantuml/png/dLJlQzim4Fskl-Bmbq5PtDeDeojRQ64iAwobjAFVPVkIYCgIaSyDsyZ_Flsm4xl4TPd0icpTlNll_AohchYXffHCueg0D1YntX0Kmc1EGYls0Nve8_veHLo250hhIvZD5X_XospcfuKDUK938ky5-7rtBHW9aWXtI5jjdc4hQ0Fp9MEvr4q1GX4QXSHOoIieTO5b0dyPmCqzV5r0yZcDaqyNSH8df-dSllwkpPQR0avitKFohfUU7aa_dqndAoqBD61qOrzwY5oNbLQe2ABhgf9Mdkj71Bo6l2oOZMXpegNKcTNUIRnxZ3m0W2E5j3bh7zruhIiDnC9OSi8j_nteXMRulLqVBHb5Evz2Itje7Va7grYeDVpYcSHeZtrhYqNVSCKRILwpeLxTQ-kD5uHs7nm6XZfERXkswqDvU4ZEaXRChdfu_m6Kxe7IIQ1a07JevafaQFXeFzFEDc4CpECLl8RJZLcFmyqdu0vVPzSpry5LWQwNxLTjeRTzwYDjt51pxEVi3UK39zsZhUPvXevD4dMD24JTwdr4NIGRzZBsypZD-IXD_oLwDEqltZgwVYPTdVxabRlTwamurriAnT5ZvoJW7x6LyUU69GxX2Iv1LEJCMREkxx1lMTjmrWc5FSjM8sDNg0fx4Fy3)\n\nAs and when required, the active default route will point to Gateway for eth0 or eth1.\n\n## Starting as service or command\n\nTo start `IFS` as a service, execute the command `systemctl start goifs.service`.\n\nTo enable starting of `IFS` on boot execute the command `systemctl enable goifs.service`.\n\nTo see the current status of `IFS` execute the command `goifs status`.\n\nFor example, you will see output like so:\n\n```sh\n# goifs status\n2023/11/09 12:41:23 goifs is running with process id: 1931\n2023/11/09 12:41:23 Connection Details::\n  Name|     Gateway| Is Up| Successes| Failures| Total| Consecutive Successes| Consecutive Failures|Active\n fiber| 192.168.1.1| false|         0|      100|   100|                     0|                  100|false\n fourg| 192.168.3.1|  true|       100|        0|   100|                   100|                    0|true\n```\n\n## Addendum\n\n### Do not use IPv6 in your LAN\n\nIn my humble opinion there is no real reason to use IPv6 on your LAN, unless you have a device that only supports only IPv6 (in which case I would prefer to get an alternative device, rather than start using IPv6). Of course, people will suggest that IPv6 is the future, and I agree except that, the future is not near enough.\n\nIf you agree and want to get rid of IPv6 on your LAN, read on.\n\n#### Getting rid of IPv6\n\nGetting rid of IPv6 from your desktop and laptop devices is easy enough. There is tons of documentation available on the internet for your particular OS/platform.\n\nThe more complicated part is managing to do this for mobile/other devices. Since we have little to no control over how mobile devices configure their network. The only way forward is to block IPv6 access to mobile devices. The whole process involves configuring modems to disable Router Advertisement (RA) for IPv6 and/or to block the RA packets sent by modems from reaching mobile devices.\n\n##### Importance of getting rid of IPv6\n\nYou might be wondering why bother getting rid of IPv6. The truth is even if you keep IPv6 around the failover will work for IPv4. However, the IPv6 traffic of your LAN devices will still go via the corresponding modem directly. As a result you might run into a situation where IPv4 is working due to failover, but IPv6 not working because the modem used as IPv6 Gateway has no internet connectivity. Additionally, if you want to restrict internet access using your Linux router, it will allow LAN devices using IPv6 to bypass that.\n\n##### Disabling RA in your modem configuration\n\nThis should be easy enough. Just find the relevant configuration and disable it. But do make it a point to validate that modem is actually honouring its configuration using `tcpdump`.\n\n##### Validating that RA is disabled\n\nOne can use `tcpdump` to verify that RA is disabled. From your Linux router issue the following command:\n`sudo tcpdump -vvvv -ttt -i wlan0 icmp6 and 'ip6[40] = 134'`\nreplace `wlan0` with the interface for which you want to check.\n\nIf after executing this command (within a few minutes) you see no output, you are all good.\nIf OTOH, you see some output resembling what follows:\n\n```sh\ntcpdump: listening on wlan0, link-type EN10MB (Ethernet), snapshot length 262144 bytes\n 00:00:00.000000 IP6 (hlim 255, next-header ICMPv6 (58) payload length: 64) fe80::xxxx:xxxx:xxxx:xxxx \u003e ip6-allnodes: [icmp6 sum ok] ICMP6, router advertisement, length 64\n        hop limit 64, Flags [other stateful], pref high, router lifetime 30s, reachable time 0ms, retrans timer 0ms\n          prefix info option (3), length 32 (4): 2xxx:xxxx:xxxx:xxxx::/64, Flags [onlink, auto], valid time 300s, pref. time 120s\n            0x0000:  40c0 0000 012c 0000 0078 0000 0000 2401\n            0x0010:  4900 5814 5fd2 0000 0000 0000 0000\n          mtu option (5), length 8 (1):  1500\n            0x0000:  0000 0000 05dc\n          source link-address option (1), length 8 (1): ax:xx:xx:xx:xx:xa\n            0x0000:  a42b b02e c0aa\n```\n\nyour modem is sending RA packets. You can also validate additionally by comparing MAC address mentioned as `source link-address` with the one from your modem.\n\n##### Blocking RA packets from reaching your LAN\n\nTo block RA packets sent out from modem from reaching your LAN, simply make your own Linux router sit in front of the modem and drop all packets coming from modem. This can require purchasing of additional hardware to add additional network interfaces in Linux router.\n\n### How does it work?\n\n#### Network Configuration\n\n`IFS` creates some network devices/configuration as per the input configuration file (`/etc/goifs/ifs.yaml`).\n\n1. Create a network namespace for each of the internet connections that are present in configuration file.\n\n    ```sh\n    # ip netns list\n    fourg (id: 1)\n    fiber (id: 0)\n    ```\n\n2. Create a pair of virtual devices for each of the connections one in global namespace and other in each connection's network namespace created in step 1. Along with this the `lo` network is also brought up.\n\n    ```sh\n    # ip link list\n    1: lo: \u003cLOOPBACK,UP,LOWER_UP\u003e mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000\n        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n    2: eth0: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000\n        link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff\n    3: wlan0: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000\n        link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff\n    9: fibera@if8: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000\n        link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff link-netns fiber\n    11: fourga@if10: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000\n        link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff link-netns fourg\n    # ip netns exec fiber ip link list\n    1: lo: \u003cLOOPBACK\u003e mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n    8: fiberb@if9: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000\n        link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff link-netnsid 0\n    # ip netns exec fourg ip link list\n    1: lo: \u003cLOOPBACK\u003e mtu 65536 qdisc noop state DOWN mode DEFAULT group default qlen 1000\n        link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00\n    10: fourgb@if11: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000\n        link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff link-netnsid 0\n    ```\n\n3. Configure IP addresses of virtual devices in created in global and network namespaces.\n\n    ```sh\n    # ip -4 addr list dev fibera\n    9: fibera@if8: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netns fiber\n        inet 192.168.2.1/24 scope global fibera\n        valid_lft forever preferred_lft forever\n\n    # ip netns exec fiber ip -4 addr list\n    8: fiberb@if9: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netnsid 0\n        inet 192.168.2.2/24 scope global fiberb\n        valid_lft forever preferred_lft forever\n    # ip -4 addr list dev fourga\n    11: fourga@if10: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netns fourg\n        inet 192.168.4.1/24 scope global fourga\n        valid_lft forever preferred_lft forever\n    # ip netns exec fourg ip -4 addr list\n    10: fourgb@if11: \u003cBROADCAST,MULTICAST,UP,LOWER_UP\u003e mtu 1500 qdisc noqueue state UP group default qlen 1000 link-netnsid 0\n        inet 192.168.4.2/24 scope global fourgb\n        valid_lft forever preferred_lft forever\n    ```\n\n4. Create routes for each of the connections in default and corresponding network namespaces.\n\n    ```sh\n    # ip -4 route list\n    # ip route list\n    default via 192.168.1.2 dev eth0 src 192.168.1.66 metric 202 \n    default via 192.168.3.1 dev wlan0 proto dhcp src 192.168.3.100 metric 303 \n    192.168.1.0/24 dev eth0 proto dhcp scope link src 192.168.1.66 metric 202 \n    192.168.2.0/24 dev fibera proto kernel scope link src 192.168.2.1 \n    192.168.3.0/24 dev wlan0 proto dhcp scope link src 192.168.3.100 metric 303 \n    192.168.4.0/24 dev fourga proto kernel scope link src 192.168.4.1 \n    # ip netns exec fiber ip -4 route list\n    default via 192.168.2.1 dev fiberb \n    192.168.2.0/24 dev fiberb proto kernel scope link src 192.168.2.2 \n    # ip netns exec fourg ip -4 route list\n    default via 192.168.4.1 dev fourgb \n    192.168.4.0/24 dev fourgb proto kernel scope link src 192.168.4.2\n    ```\n\n5. Create additional routing table and rule for default route for each of the connections.\n\n    ```sh\n    # ip rule list\n    0: from all lookup local\n    32764: from all fwmark 0x66 lookup 102\n    32765: from all fwmark 0x65 lookup 101\n    32766: from all lookup main\n    32767: from all lookup default\n    # ip route list table 101\n    default via 192.168.1.2 dev eth0 \n    # ip route list table 102\n    default via 192.168.3.1 dev wlan0\n    ```\n\n6. Create iptable rules to forward, nat and mangle packets as required.\n\n    ```sh\n    # iptables -L -v -n\n    Chain INPUT (policy ACCEPT 5309K packets, 5759M bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n\n    Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n    15M 8255M ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           \n        0     0 ACCEPT     all  --  fibera eth0    0.0.0.0/0            0.0.0.0/0           \n        0     0 ACCEPT     all  --  eth0   fibera  0.0.0.0/0            0.0.0.0/0           \n        0     0 ACCEPT     all  --  fourga wlan0   0.0.0.0/0            0.0.0.0/0           \n        0     0 ACCEPT     all  --  wlan0  fourga  0.0.0.0/0            0.0.0.0/0           \n\n    Chain OUTPUT (policy ACCEPT 3190K packets, 5550M bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n    # iptables -L -v -n -t nat\n    Chain PREROUTING (policy ACCEPT 535K packets, 51M bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n\n    Chain INPUT (policy ACCEPT 24221 packets, 2243K bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n\n    Chain OUTPUT (policy ACCEPT 66606 packets, 4545K bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n\n    Chain POSTROUTING (policy ACCEPT 7476 packets, 573K bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n    328K   33M MASQUERADE  all  --  *      *       192.168.1.0/24       0.0.0.0/0           \n    261 21924 MASQUERADE  all  --  *      eth0    192.168.2.0/24       0.0.0.0/0           \n    126 10584 MASQUERADE  all  --  *      wlan0   192.168.4.0/24       0.0.0.0/0           \n    # iptables -L -v -n -t mangle\n    Chain PREROUTING (policy ACCEPT 0 packets, 0 bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n    301 26858 MARK       all  --  fibera *       0.0.0.0/0            0.0.0.0/0            MARK set 0x65\n    154 13857 MARK       all  --  fourga *       0.0.0.0/0            0.0.0.0/0            MARK set 0x66\n\n    Chain INPUT (policy ACCEPT 0 packets, 0 bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n\n    Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n\n    Chain OUTPUT (policy ACCEPT 0 packets, 0 bytes)\n    pkts bytes target     prot opt in     out     source               destination         \n\n    Chain POSTROUTING (policy ACCEPT 0 packets, 0 bytes)\n    pkts bytes target     prot opt in     out     source               destination    \n    ```\n\nWith this we are all set.\n\n#### How does it work\n\nThe `IFS` service keeps pinging configured `Ping` IP using each of the connections periodically to determine if the connection is up. To ping from within the network execute the command: `ip netns exec \u003cnamespace\u003e ping -c 1 \u003cip\u003e`. If the status of a connection changes, the default routes in global namespace are modified to reflect best connection available.\n\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\u003c!-- https://www.markdownguide.org/basic-syntax/#reference-style-links --\u003e\n[contributors-shield]: https://img.shields.io/github/contributors/homebackend/go-internet-failover-service.svg?style=for-the-badge\n[contributors-url]: https://github.com/homebackend/go-internet-failover-service/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/homebackend/go-internet-failover-service.svg?style=for-the-badge\n[forks-url]: https://github.com/homebackend/go-internet-failover-service/network/members\n[stars-shield]: https://img.shields.io/github/stars/homebackend/go-internet-failover-service.svg?style=for-the-badge\n[stars-url]: https://github.com/homebackend/go-internet-failover-service/stargazers\n[issues-shield]: https://img.shields.io/github/issues/homebackend/go-internet-failover-service.svg?style=for-the-badge\n[issues-url]: https://github.com/homebackend/go-internet-failover-service/issues\n[license-shield]: https://img.shields.io/github/license/homebackend/go-internet-failover-service.svg?style=for-the-badge\n[license-url]: https://github.com/homebackend/go-internet-failover-service/blob/master/LICENSE\n[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge\u0026logo=linkedin\u0026colorB=555\n[linkedin-url]: https://linkedin.com/in/neeraj-jakhar-39686212b\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhomebackend%2Fgo-internet-failover-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhomebackend%2Fgo-internet-failover-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhomebackend%2Fgo-internet-failover-service/lists"}