Introduction
In the previous chapter, you learned how to route east-west traffic through the Network Virtual Appliance (NVA) using subnet-specific route tables with User Defined Routes (UDR). This chapter introduces how to route north-south traffic between the Internet and your Azure Virtual Network through the NVA.
Figure 3-1 depicts our VNet setup, which includes DMZ and Web Tier zones. The NVA, vm-nva-fw, is connected to subnet snet-north (10.0.2.0/24) in the DMZ via a vNIC with Direct IP (DIP) 10.0.2.4. We've also assigned a public IP address, 51.12.90.63, to this vNIC. The second vNIC is connected to subnet snet-west (10.0.0.0/24) in the Web Tier, with DIP 10.0.0.5. We have enabled IP Forwarding in both vNICs and Linux kernel. We are using Network Security Groups (NSGs) for filtering north-south traffic.
Our web server, vm-west, has a vNIC with DIP 10.0.0.4 that is connected to the subnet snet-west in the Web Tier. We have associated the route table to the subnet with the UDR, which forwards traffic to destination IP 141.192.166.81 (remote host) to NVA. To publish the web server to the internet, we've used the public IP of NVA.
On the NVA, we have configured a Destination NAT rule which rewrites the destination IP address to 10.0.0.4 to packets with the source IP address 141.192.166.81 and protocol ICMP. To simulate an http connection, we're using ICMP requests from a remote host.
Packet Walk
- Remote host 141.192.166.81 starts pinging the web server vm-west using the public IP address 51.12.90.63 as a destination. The ICMP Request messages are routed to Azure, and Azure infra routes traffic to NVA’s vNIC on DMZ.
- The first packet arrives at NVA. As an SLB/NAT layer action, the public IP address 51.12.90.63 of NVA is translated to its DIP: 10.0.2.4.
- Next, the packet is matched against the inbound policy rule in NSG associated with the vNIC. Because we have allowed ICMP from the remote host to 10.0.2.4, the packet is forwarded to NVA.
- The source IP address is 141.192.166.81, and the protocol ICMP matches NVA’s NAT rule. The NAT engine rewrites the destination public IP 51.12.90.63 to vm-west’s DIP 10.0.0.4. Then, the Linux routing process finds the next-hop IP address for the destination. The subnet 10.0.0.0/24 is connected to its interface eth2 via vNIC vm-nva-fw-west.
- The destination IP address 10.0.0.4 is within the same VNet as NVA’s egress vNIC, so the default Intra-VNet Outbound policy rule allows traffic. Note that if you are using a third-party FW NVA, there is no need for NVA-based NSGs. In our example, NVA does only routing, not policy filtering. That is why we are using NSGs.
- Next, the VFP routing process checks where the packet should be sent. Based on the Customer Address (CA) to Provider Address (PA) mapping entry (10.0.0.4 > Host B) found on the local host cache, the routing process knows that this is an Intra-VNet flow, meaning there is no need for NAT.
- Before sending the packet toward the destination, the VNet layer encapsulates the packet with tunnel headers, where the destination IP address is the PA of Host B, and the Virtual Network Identifier (VNI) is the VNet Id used with vnet-nwkt. Azure infra routes packets based on the destination IP address on the tunnel header.
- The packet arrives at Host B. Based on the CA and the VNI, the packet is forwarded to vm-west. The VNet layer decapsulates the packet.
- The Inbound policy allows the ICMP packet from the remote host, and the packet is forwarded to vm-west.
- Vm-west replies to the ICMP Request message by sending an ICMP Reply message to remote host 141.192.166.81.
- The Outbound policy allows Internet egress traffic by default.
- We have associated a route table with the subnet snet-west, in which UDR explicitly routes packets to the destination 141.192.166.81 using next-hop 10.0.0.5. Next, the VFP routing process checks the CA-PA mapping cache and finds mapping entry 10.0.0.5 > Host A. If we haven’t associated the route table with the subnet, the packet is routed to the Internet edge router without encapsulation.
- The VNet layer encapsulates the packet with tunnel headers, and then the packet is sent toward NVA.
- The packet arrives at Host A. Based on the CA and the VNI, the packet is forwarded to vm-nva-fw. The VNet layer action decapsulates the packet.
- The source IP address of the packet is within the VNet CIDR (10.0.0.0/16), so it matches the default Inbound Intra-VNet policy rule. The packet is sent to NVA, which routes the packet based on the default route table.
- NSG's OutBound policy rule allows internet traffic by default.
- Finally, the SLB/NAT layer translates the source IP address to a public IP address before sending the packet to the remote host.