I’m having a lot of trouble with routing on Azure. I’m trying to follow the “best practice” architecture for an internal corporate network using distinct VNETs for separate workloads, with a central “hub” VNET through which all traffic is routed. Each spoke network is peered to the central hub.
Azure has some services for this: a BGP route server, a firewall service, etc. These services are fairly expensive, however, and I would like to see if this can be achieved with VyOS. The trouble is that Azure requires use of DHCP for interfaces and inserts its own services between each peered network.
So in my setup, I’m using the following VNETs:
vnet-hub
: 10.0.0.0/24
-
subnet-wan
: 10.0.0.64/26-
nic-vyos-wan
(eth0): public IP and private dhcp IP: static 10.0.0.70
-
-
subnet-lan
: 10.0.0.0/26-
nic-vyos-lan
(eth1): private dhcp IP: static 10.0.0.10
-
vnet-test
: 10.0.1.0/24
-
subnet-test
: 10.0.1.0/24-
nic-pc
: private dhcp IP: static 10.0.1.10
-
Both nic-vyos-*
are connected to vm-vyos
and nic-pc
is connected to vm-pc
.
I plan to assign future VNETs unused blocks from 10.0.0.0/16.
I have 2 subnets in the hub so I can simulate a “WAN” and “LAN” NIC on the VyOS router and prevent direct connectivity between the “WAN” NIC and other IPs in the corporate network. VyOS is configured to use DHCP for both NICs, (e.g. VyOS sees the LAN network as 10.0.0.0/64). In Azure I have set User Defined Routes for vnet-test
:
0.0.0.0/0 -> 10.0.0.10
10.0.0.0/24 -> 10.0.0.10
10.0.1.0/24 -> 10.0.0.10
VyOS is configured with static routes:
protocols {
static {
route 0.0.0.0/0 {
dhcp-interface eth0
}
route 10.0.1.0/24 {
next-hop 10.0.0.1 {
interface eth1
}
}
}
}
As you can see, for VNET peering from vnet-hub I have to use 10.0.0.1 as next hop from subnet-lan
and 10.0.0.65 for subnet-wan
(which is provided by Azure DHCP… I am not using DHCP for route 10.0.1.0/24 because Azure DHCP doesn’t advertise that route without the Azure Route Server BGP service which is nearly $300/mo).
So far I can reach nic-pc
from vm-vyos
but I am having issues with SNAT from source block 10.0.1.0/24. I want to be able to masquerade all VNET internet traffic to nic-vyos-wan
and intranet traffic to nic-vyos-lan
. vm-pc
does not currently have internet connectivity:
nat {
source {
rule 100 {
log
outbound-interface any
source {
address 10.0.1.0/24
}
translation {
address masquerade
}
}
}
}
I have seen some kernel logs saying that 10.0.1.10 is a “martian” address. Is this happening because VyOS doesn’t know it should be able to route traffic for 10.0.1.0/24? My initial thought is that this setup maybe requires use of Dummy interfaces, so I tried one for 10.0.1.0/24 but that installs a “C” (connected) route that overrides my static route.
I understand this is a very detailed question and Azure networking is ridiculous, but I am posting after struggling for many days with this.