Skip to content

Instantly share code, notes, and snippets.

View iDanielLaw's full-sized avatar

Daniel Law iDanielLaw

  • Imagine No Limit Technology
View GitHub Profile

How to build a load balancer with BGP and ECMP using VyOS

According to this cloudflare blog article "Load Balancing without Load Balancers", we can build a rock-solid load balancer only using a router. All the magic comes from BGP and Equal-Cost Multi-Path routing.

In this howto, I will use bird as BGP router on linux instance (ie. servers).

Test environment

I use GNS3 with this architecture :

architecture

@iDanielLaw
iDanielLaw / nginx.conf
Created March 10, 2021 09:20 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@iDanielLaw
iDanielLaw / redux-module-patterns.md
Created March 5, 2021 19:48 — forked from heygrady/redux-module-patterns.md
Redux module patterns: app state, view state and regional state

Redux module patterns

app state, view state and regional state

separating components and containers

and code-splitting reducers


@iDanielLaw
iDanielLaw / connect-remote-mongo-via-ssh-tunnel.md
Created February 18, 2021 03:44 — forked from umidjons/connect-remote-mongo-via-ssh-tunnel.md
Create ssh tunnel and connect to the remote mongo database on command line

Create ssh tunnel and connect to the remote mongo database on command line

Assume followings:

/mykeys/.ssh/prodserver.pem - is a certificate file

umid - is a user name

111.111.111.111 - is a remote host, that mongodb runs

@iDanielLaw
iDanielLaw / letsencrypt_2020.md
Created October 27, 2020 17:30 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files:

@iDanielLaw
iDanielLaw / snat_dnat_advantech.md
Created October 26, 2020 09:44 — forked from tomasinouk/snat_dnat_advantech.md
examples of SNAT, DNAT with iptables for Advantech, Conel routers, with comments (probably will work on other routers where iptables can be manipulated, care needs to be taken on applying these commands after reboot)

Some examples of SNAT, DNAT with iptables with comments

mainly used in start-up script

masquarade all outgoing packets to be WLAN0 IP

iptables -t nat -A PREROUTING -s 192.168.1.2 -i eth0 -j MASQUERADE

All packets leaving eth0 will have src eth0 ip address

@iDanielLaw
iDanielLaw / example.html
Created October 22, 2020 07:24 — forked from biswajitpaul01/example.html
navigator.sendBeacon example
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Send Bacon Example</title>
</head>
<body>
<button type="button" id="button">Send Response</button>
255 local
254 main
253 default
0 unspec
250 myvpn
@iDanielLaw
iDanielLaw / bgp_mikrotik.txt
Created September 18, 2020 08:16 — forked from INZAME/bgp_mikrotik.txt
Basic BGP Set-up on Mikrotik
(1)Настройка маршрутизатора B2:
1. Настройка IP адресов на интерфейсах
/ip address add address=12.12.12.2/30 interface=ether5 network=12.12.12.0
/ip address add address=13.13.13.2/30 interface=ether4 network=13.13.13.0
2. Настройка BGP
2.1. Настройка AS номера (Номера автономной системы) и ID маршрутизатора
/routing bgp instance set default as=63000 router-id=2.2.2.2