- Ubuntu 22.04 LTS
- Vagrant
- VirtualBox
- NGINX
- Keepalived (VRRP)
- BIND9 DNS
- Bash
.
├── Vagrantfile
├── provision/
│ ├── dns.sh
│ └── web.sh
├── config/
│ ├── bind/
│ │ ├── db.test.com
│ │ ├── named.conf.local
│ │ └── named.conf.options
│ └── nginx/
│ ├── master.conf
│ ├── backup.conf
│ ├── web1.conf
│ ├── web2.conf
│ ├── web1-index.html
│ └── web2-index.html
├── screenshots/
│ ├── dig_via_the_dns_server.png
│ ├── resloving_the_master.png
│ ├── ping.png
│ └── after_halting_web1.png
└── README.md
Client → BIND9 DNS → Virtual IP → Web1 (MASTER)
└→ Web2 (BACKUP)
vagrant updig @192.168.56.10 test.comcurl --resolve test.com:80:$(dig +short @192.168.56.10 test.com) http://test.comvagrant halt web1curl --resolve test.com:80:$(dig +short @192.168.56.10 test.com) http://test.comThe same virtual IP now serves the response from web2.
| Machine | Role | IP Address |
|---|---|---|
dns1 |
BIND9 DNS server | 192.168.56.10 |
web1 |
NGINX master | 192.168.56.11 |
web2 |
NGINX backup | 192.168.56.12 |
| Virtual IP | Keepalived service address | 192.168.56.20 |
test.comandwww.test.comresolve to the virtual IP192.168.56.20.- NGINX is served by
web1as the master node. - Traffic automatically fails over to
web2whenweb1is unavailable.



