Publishing Squid instance with ExaBGP

  • Goal: Advertise a single Squid proxy instance to a router using ExaBGP with a monitoring script.

  • Status: 0%

  • State: DRAFT

  • Writer: Eliezer Croitoru

  • More:

What's the story?

Most industrial routers support basic BGP options and functions. These by nature allowing the admin to utilize BGP health and status to decide on routing policy. The network admin can run multiple RIF/FIB and apply specific policy on specific clients such as route redirection or marking.

LB

AnyCast

Code

exabgp.conf (v4.1 compatible)

process watch-application {
        run ruby /etc/exabgp/check-squid.sh;
        encoder text;
}

neighbor 10.0.55.254 {
        description "will announce a route to a service";

        router-id 10.0.55.1;

        local-address 10.0.55.1;

        local-as 65511;
        peer-as 65511;
        md5-password test_password;
        hold-time 60;

        family {
                ipv4 unicast;
        }
    
        api services {
                processes [ watch-application ];
        }
    
        static {
                route 10.1.55.1/32 {
                        next-hop self;
                        watchdog squid;
                        local-preference 100;
                        med 100;
                        withdraw;
                }
                route 10.1.55.2/32 {
                        next-hop self;
                        watchdog squid;
                        local-preference 400;
                        med 400;
                        withdraw;
                }
        }
}

   1 #!/usr/bin/env bash
   2 
   3 STATE="down"
   4 
   5 while true; do
   6   ls /etc/exabgp/squid-up  >/dev/null 2>&1
   7   RES=$?
   8   if [[ "${RES}" -eq "0" ]]; then
   9     if [[ "${STATE}" != "up" ]]; then
  10       echo "announce watchdog squid"
  11       STATE="up"
  12     fi
  13   else
  14     if [[ "${STATE}" != "down" ]]; then
  15       echo "withdraw watchdog squid"
  16       STATE="down"
  17     fi
  18   fi
  19   sleep 2
  20 done

EliezerCroitoru/Drafts/PublishSquidWithExaBGP (last edited 2019-06-26 17:26:15 by Eliezer Croitoru)