Most organisations that use the cloud still run systems in their own data centres, and a hybrid cloud joins the two so that workloads on either side can call each other privately and be run as one estate. That takes a non-overlapping IP plan, a dedicated interconnect with a VPN as backup and routing that fails over the same way in both directions, DNS that forwards each private zone to the side that owns it, workload identity federation instead of stored keys, and one inventory, policy, and monitoring view across both sides. This lesson follows one request from an on-premises service to a cloud storage account behind a private endpoint, and shows two failures: DNS that resolves the public address, and a failover that sends replies back by a different route.
Difficulty: Advanced · Know this first: Lesson 158, Lesson 152
By the end of this lesson you can work at four levels:
This page teaches it with a plain-language analogy, an animated diagram with normal and failure scenarios, a simulator, a quiz, basic, intermediate, advanced, and master checks, the expert detail ("Go deeper"), a production incident, a hands-on lab with commands and their output, and a production design exercise.
This bar adds up milliseconds for one request from the on-premises service to the cloud storage account and back. It is a worked example, not a measurement. The DNS and routing hops decide whether the request takes the private path, and whether the reply comes back the same way.
Pick the on-premises DNS setup, the link in use, and how the backup is designed.
Three questions. No score is saved anywhere — this is just you against the material.
Hybrid cloud grows in four levels: a working link, private names and paths, resilience you have tested, and one estate.
At the basic level the two sides can reach each other.
Where it breaks: a cloud network created with a range already used on premises, which can never be routed to.
Try it: Basic
A team wants a new cloud network using 10.10.0.0/16, which the data centre already uses. What do you say?
Now do it: Check your cloud networks against your on-premises ranges.
At the intermediate level traffic stays private, by name.
Try it: Intermediate
Why disable public access once a private endpoint exists?
Now do it: List services with private endpoints and public access still on.
At the advanced level the link survives failures, and you have proved it.
Try it: Advanced
In a failover test, what proves the design works?
Now do it: Add a reply-path check to your next failover test.
At the master level both sides are operated as one.
Trade-off: a hybrid estate keeps the data centre's control and the cloud's services at once, and pays for it in two sets of networking, DNS, and identity to keep consistent; each flow should justify staying hybrid rather than moving.
Try it: Master
Users report errors only from the data centre, never from the cloud. Which check would have caught it first?
Now do it: Run one synthetic check from on premises to each private endpoint.
Conditional forwarding on an on-premises Unbound resolver, sending the private endpoint zone to the cloud's inbound resolver and everything else to the usual upstream (a Windows DNS server does the same with a conditional forwarder):
forward-zone:
name: "privatelink.blob.core.windows.net."
forward-addr: 10.20.0.4 # the cloud's inbound resolver endpoint
forward-addr: 10.20.0.5
forward-zone:
name: "."
forward-addr: 10.10.0.53 # the usual upstream
To check it from on premises, resolve the account name: dig +short ordersdata.blob.core.windows.net should end with a private address (10.20.4.10 here), not a public one.
BGP choices on the data centre router decide the backup order outbound (local preference, highest wins); AS-path prepending on the routes you advertise influences which path the other side uses for replies. Each cloud documents its own preference order between circuits and VPNs. Write both down, side by side, for every failure case, before testing them.
This is a composite of a failure pattern that keeps repeating; the details are illustrative. The backup that worked one way.
A written failover table for both directions, using the cloud's documented route preferences; the router configuration made to match it; and a quarterly failover test that checks the reply path and the firewall that saw it.
Everything here runs on any Linux machine: your own laptop, WSL on Windows (run wsl --install in PowerShell once), or a small cloud VM. The Python needs only Python 3 and its standard library; check that you have it with python3 --version.
Before you start: Linux with iproute2 (the ip command), sudo rights for network namespaces, and Python 3. Everything happens inside a throwaway namespace; your own routes are not touched.
Type each one, read what it prints, and compare it with the note above it.
Create a namespace that stands in for the data centre router, with an interface on 10.10.4.0/24.
sudo ip netns add onprem sudo ip -n onprem link add edge0 type dummy sudo ip -n onprem addr add 10.10.4.5/24 dev edge0 sudo ip -n onprem link set edge0 up sudo ip -n onprem addr show edge0 | grep -w inet
Add two routes to the cloud's 10.20.0.0/16: the interconnect (next hop 10.10.4.1) preferred, and the VPN (10.10.4.2) as backup.
sudo ip -n onprem route add 10.20.0.0/16 via 10.10.4.1 metric 100 sudo ip -n onprem route add 10.20.0.0/16 via 10.10.4.2 metric 200 sudo ip -n onprem route show 10.20.0.0/16 sudo ip -n onprem route get 10.20.7.9
Fail the interconnect by removing its route, and see the backup take over.
Changes a real system: On real routers this happens through BGP when a session drops; use BFD so it takes a second, and test it with the reply path in view.
sudo ip -n onprem route del 10.20.0.0/16 via 10.10.4.1 metric 100 sudo ip -n onprem route get 10.20.7.9
Add a more specific route through a third next hop, with a worse metric, and see which one wins.
sudo ip -n onprem route add 10.20.7.0/24 via 10.10.4.3 metric 500 sudo ip -n onprem route get 10.20.7.9 sudo ip -n onprem route get 10.20.9.9
Remove the namespace.
sudo ip netns del onprem ip netns list | grep -c onprem || true
hybrid_check.pyThis program checks an address plan for overlaps between the data centre and the cloud networks, resolves a storage account name with and without a conditional forwarder for its private endpoint zone, and works out the request and reply paths before and after a circuit failure, flagging the asymmetric case and checking the fix. Save it as hybrid_check.py, then run it.
# hybrid_check.py
import ipaddress
ONPREM = ["10.10.0.0/16", "10.11.0.0/16", "192.168.0.0/16"]
CLOUD = {"hub": "10.20.0.0/22", "spoke-orders": "10.20.4.0/22", "spoke-analytics": "10.11.8.0/22", "spoke-ml": "172.16.0.0/20"}
print("address plan:")
for name, cidr in CLOUD.items():
net = ipaddress.ip_network(cidr)
clash = [o for o in ONPREM if net.overlaps(ipaddress.ip_network(o))]
print(f" {name:<16} {cidr:<15} {'OVERLAPS ' + ', '.join(clash) if clash else 'ok'}")
print()
PUBLIC = {"ordersdata.blob.core.windows.net": ("CNAME", "ordersdata.privatelink.blob.core.windows.net"),
"ordersdata.privatelink.blob.core.windows.net": ("A", "203.0.113.10")} # what the internet sees
CLOUD_RESOLVER = {"ordersdata.privatelink.blob.core.windows.net": "10.20.4.10"} # the private zone
def resolve(name, forwarders):
while True:
zone = max((z for z in forwarders if name == z or name.endswith("." + z)), key=len, default=None)
if zone:
return CLOUD_RESOLVER[name], f"forwarded {zone} to the cloud resolver"
kind, value = PUBLIC[name]
if kind == "A":
return value, "public DNS"
name = value # follow the CNAME
for label, fwd in (("with forwarder", ["privatelink.blob.core.windows.net"]), ("without forwarder", [])):
ip, how = resolve("ordersdata.blob.core.windows.net", fwd)
private = any(ipaddress.ip_address(ip) in ipaddress.ip_network(c) for c in CLOUD.values()) # inside our cloud networks
print(f"{label:<18} -> {ip:<12} ({how}); {'private path' if private else 'public address: refused, public access is off'}")
print()
def best(routes, rank):
up = [r for r in routes if r["up"]]
return min(up, key=rank)["via"]
def paths(ic_a_up, onprem_pref_b):
out = [{"via": "interconnect A", "pref": 300, "up": ic_a_up}, # data centre A's routes to the cloud
{"via": "site B, interconnect B", "pref": 250 if onprem_pref_b else 100, "up": True},
{"via": "VPN A", "pref": 200, "up": True}]
back = [{"via": "interconnect A", "kind": 0, "aspath": 1, "up": ic_a_up}, # the cloud's routes to 10.10.0.0/16
{"via": "site B, interconnect B", "kind": 0, "aspath": 3, "up": True},
{"via": "VPN A", "kind": 1, "aspath": 1, "up": True}] # a circuit (0) beats a VPN (1)
return best(out, lambda r: -r["pref"]), best(back, lambda r: (r["kind"], r["aspath"]))
for label, up, pref_b in (("normal", True, False), ("interconnect A down", False, False),
("A down, after the fix", False, True)):
req, rep = paths(up, pref_b)
state = "symmetric" if req == rep else "ASYMMETRIC: replies hit a firewall that never saw the connection"
print(f"{label:<22} request via {req:<23} reply via {rep:<23} {state}")
Run it, and you should see this output:
$ python3 hybrid_check.py address plan: hub 10.20.0.0/22 ok spoke-orders 10.20.4.0/22 ok spoke-analytics 10.11.8.0/22 OVERLAPS 10.11.0.0/16 spoke-ml 172.16.0.0/20 ok with forwarder -> 10.20.4.10 (forwarded privatelink.blob.core.windows.net to the cloud resolver); private path without forwarder -> 203.0.113.10 (public DNS); public address: refused, public access is off normal request via interconnect A reply via interconnect A symmetric interconnect A down request via VPN A reply via site B, interconnect B ASYMMETRIC: replies hit a firewall that never saw the connection A down, after the fix request via site B, interconnect B reply via site B, interconnect B symmetric
The same Linux steps, made into a real script you can keep and run again. It uses the Bash features a production script needs: functions (one per step), an array of step names, arguments to choose steps, a case for options, exit codes recorded for each step, and a trap that prints a summary even when you stop it with Ctrl+C. Make a folder for this lesson (mkdir -p ~/labs/hybrid-cloud-networking-dns-identity-and-operations && cd ~/labs/hybrid-cloud-networking-dns-identity-and-operations) and save this as lab.sh.
#!/usr/bin/env bash
# The Linux steps of "Hybrid Cloud: Connecting On-Premises and Cloud with Shared Networking, DNS, Identity, and Operations", as one script (save it as lab.sh).
#
# ./lab.sh run every step, in order
# ./lab.sh 2 4 run only steps 2 and 4
# ./lab.sh --list list the steps
#
# The steps share one shell, so a later step can use what an earlier one set up (a folder,
# a variable, a container): run them all in order the first time. Your own scripts should
# start with "set -euo pipefail"; this one runs teaching commands, and some of them fail on
# purpose, so it records each step's exit code instead of stopping at the first failure.
STEPS=(
'Create a namespace that stands in for the data centre router, with an interface on 10.10.4.0/24.'
'Add two routes to the cloud'\''s 10.20.0.0/16: the interconnect (next hop 10.10.4.1) preferred, and the VPN (10.10.4.2) as backup.'
'Fail the interconnect by removing its route, and see the backup take over.'
'Add a more specific route through a third next hop, with a worse metric, and see which one wins.'
'Remove the namespace.'
)
step_1() {
sudo ip netns add onprem
sudo ip -n onprem link add edge0 type dummy
sudo ip -n onprem addr add 10.10.4.5/24 dev edge0
sudo ip -n onprem link set edge0 up
sudo ip -n onprem addr show edge0 | grep -w inet
}
step_2() {
sudo ip -n onprem route add 10.20.0.0/16 via 10.10.4.1 metric 100
sudo ip -n onprem route add 10.20.0.0/16 via 10.10.4.2 metric 200
sudo ip -n onprem route show 10.20.0.0/16
sudo ip -n onprem route get 10.20.7.9
}
step_3() {
sudo ip -n onprem route del 10.20.0.0/16 via 10.10.4.1 metric 100
sudo ip -n onprem route get 10.20.7.9
}
step_4() {
sudo ip -n onprem route add 10.20.7.0/24 via 10.10.4.3 metric 500
sudo ip -n onprem route get 10.20.7.9
sudo ip -n onprem route get 10.20.9.9
}
step_5() {
sudo ip netns del onprem
ip netns list | grep -c onprem || true
}
# print a step that has to be run by hand, instead of running it
by_hand() {
echo " (run this one yourself: $1)"
sed 's/^/ /'
}
RESULTS=()
run_step() {
local n=$1 start=$SECONDS code
printf '\n== step %d of %d: %s\n' "$n" "${#STEPS[@]}" "${STEPS[n-1]}"
"step_$n"
code=$?
RESULTS+=("step $n: exit code $code, $((SECONDS - start)) s")
}
summary() {
echo
echo "== summary"
local r
for r in "${RESULTS[@]}"; do echo " $r"; done
}
case "${1:-}" in
-h|--help) sed -n '2,6p' "$0"; exit 0 ;;
--list) for i in "${!STEPS[@]}"; do echo "$((i + 1)). ${STEPS[i]}"; done; exit 0 ;;
esac
[ $# -eq 0 ] && set -- $(seq 1 "${#STEPS[@]}")
for n in "$@"; do
if ! [[ $n =~ ^[0-9]+$ ]] || (( n < 1 || n > ${#STEPS[@]} )); then
echo "there is no step '$n'; try --list" >&2
exit 2
fi
done
trap summary EXIT
trap 'echo; echo "stopped with Ctrl+C"; exit 130' INT
for n in "$@"; do run_step "$n"; done
Then make it executable and run it:
chmod +x lab.sh ./lab.sh --list # the steps ./lab.sh # every step, then a summary of exit codes and times ./lab.sh 2 3 # only steps 2 and 3
New to a feature used above? These W3Schools pages explain each one from zero, with examples you can run in the browser.
grep, Pipes, If...Else.Your company has two data centres and is moving part of its estate to one cloud provider, with on-premises systems calling managed databases and storage, and cloud services calling an on-premises mainframe API. Design the hybrid connectivity and operations.
Which flows cross the link, in which direction, and how much? What is the address plan? Which circuits and backups do you use, and how do they fail over in both directions? How does DNS work each way? How do workloads and people authenticate? How do you operate and monitor both sides?
Say 3 Gbit/s at peak between the sites, a mainframe API that needs under 20 ms, 40 private endpoints, and 600 servers remaining on premises.
Two 10 Gbit/s interconnects from different data centres to different provider locations, plus a VPN backup; BGP with BFD and a written failover table for both directions; a central address plan; conditional forwarders for every private endpoint zone on premises and an outbound rule for corp.example.com in the cloud; private endpoints with public access off; workload identity federation for on-premises workloads; the cloud's hybrid control plane for inventory, policy, and patching of the remaining servers; synthetic checks in both directions; a quarterly failover test.
Two circuits and a backup cost far more than a VPN and give predictable latency and bandwidth; a hybrid control plane brings on-premises servers into cloud tooling and adds an agent and a dependency on the cloud to every one of them.
Each row is one way this system went wrong in the diagram's scenarios. The hop number is where to look first.
| Scenario | Where | Effect | What goes wrong |
|---|---|---|---|
| DNS without a forwarder | Hop 2: DNS | Breaks | The on-premises DNS has no forwarder for privatelink.blob.core.windows.net, so it follows the CNAME through public DNS and gets the storage account's public address. Nothing fails at this point: the name resolves, just to the wrong place. |
| DNS without a forwarder | Hop 3: Routing | Degrades | The public address uses the default route to the internet proxy. |
| DNS without a forwarder | Hop 4: Interconnect | Degrades | Not used: the traffic went to the internet. |
| DNS without a forwarder | Hop 8: Service | Breaks | The request reaches the public endpoint through the internet proxy, and the account, with public network access disabled, refuses it with HTTP 403. The application logs "authorization failure", and the first hour of the investigation is spent on the identity. |
| Failover, asymmetric return | Hop 3: Routing | Breaks | With interconnect A down, the data centre's next choice for 10.20.0.0/16 is its VPN. The cloud still learns 10.10.0.0/16 from two places: the VPN, and interconnect B at the second data centre, which reaches site A over the link between the data centres. |
| Failover, asymmetric return | Hop 4: Interconnect | Degrades | Interconnect A down at 02:10, detected by BFD in a second; the VPN is carrying outbound traffic. |
| Failover, asymmetric return | Hop 5: Firewall | Breaks | Site B's firewall drops replies for connections it never saw open. |
Review the design in this lesson, or your own, against these ten areas. Tick an area when you can answer its question with evidence: a number, a test, a document, or an owner. Your ticks stay in this browser.
The official documentation and standards behind this lesson. Versions and defaults change; when a command or field here differs from them, trust the official page.
Last updated . Next review due by November 2027. Found something out of date? Tell me.