In complex network environments managed by Palo Alto Networks firewalls, particularly those leveraging multiple Virtual Systems (vsys), providing efficient and manageable internet access for each vsys is crucial. Shared Gateways, in conjunction with External Zones, offer a streamlined solution for this, especially in scenarios with limited public IP addresses or when reducing administrative overhead is a priority. This guide delves deep into the architecture, configuration, traffic flow, and best practices for using Shared Gateways within the Palo Alto Networks ecosystem, with a strong focus on PCNSE certification readiness.
A Shared Gateway (SG) on a Palo Alto Networks firewall is a specialized mechanism that allows multiple virtual systems (vsys) to share a common physical interface (or set of interfaces, like an Aggregate Ethernet group) for external communication, typically to the internet. Each participating virtual system requires an External Zone . This External Zone acts as a logical conduit within the vsys, enabling it to direct traffic towards the Shared Gateway. Security policies are configured within each vsys to control traffic flowing from its internal zones to this External Zone.
The primary motivations for using a Shared Gateway include:
A Shared Gateway utilizes a single, dedicated Virtual Router (VR) to manage routing for all the virtual systems it serves. This VR contains the necessary routes (e.g., a default route) to the external network (e.g., the ISP). While interfaces within the individual virtual systems can use private, non-routable IP addresses, the Shared Gateway's external-facing interface will have a globally routable IP address.
Shared Gateways are always visible to all virtual systems on the firewall, simplifying connectivity. In the PAN-OS web interface, a Shared Gateway is identified with an ID like
sg<ID>
(e.g.,
sg1
). It's a recommended practice to incorporate this ID into the descriptive name you assign to the Shared Gateway (e.g., "Internet-Shared-Gateway-sg1"). When you assign objects like interfaces or zones to a Shared Gateway, it appears in the vsys selection dropdowns, similar to a regular vsys, but with its distinct `sgX` identifier.
The diagram below illustrates a common scenario where multiple virtual systems (representing different tenants or departments) share a single internet connection via a Shared Gateway on a Palo Alto Networks firewall.
Architectural overview of multiple virtual systems (vsys1, vsys2) on a Palo Alto Networks firewall using a common Shared Gateway (sg1) for internet access. Each vsys has its internal trust zone and an "External Zone" that logically connects to the Shared Gateway's virtual router (shared-vr). The Shared Gateway manages the physical connection (eth1/1) to the internet and performs NAT.
Key components in this architecture:
Configuring a Shared Gateway involves steps on the firewall globally (for the SG itself) and within each vsys that will use it.
This is a prerequisite. If not already enabled, this is done under
Device > Setup > Management > General Settings
. A reboot is typically required after enabling multi-vsys mode.
Network > Virtual Systems
. Click "Shared Gateway" at the bottom of the vsys list, then click "Add".
0.0.0.0/0
) pointing to the ISP's gateway.
admin@PA-FW(sg1)> configure Entering configuration mode [edit] admin@PA-FW(sg1)# set network virtual-router SG-VR-Internet interface ethernet1/1 admin@PA-FW(sg1)# set network virtual-router SG-VR-Internet routing-table ip static-route default destination 0.0.0.0/0 nexthop ip-address <ISP_GATEWAY_IP> admin@PA-FW(sg1)# commit
For each vsys (e.g., vsys1) that needs to use the Shared Gateway:
Network > Zones
(ensure you are in the context of the specific vsys, e.g., `vsys1`).
0.0.0.0/0
) that directs traffic destined for the internet to the External Zone you just created. No next-hop IP is specified for routes pointing to an External Zone; the zone itself acts as the target.
admin@PA-FW(vsys1)> configure Entering configuration mode [edit] admin@PA-FW(vsys1)# set network virtual-router vsys1-vr routing-table ip static-route internet-out destination 0.0.0.0/0 next-hop next-vr SG-VR-Internet ; This is incorrect for external zone admin@PA-FW(vsys1)# set network virtual-router vsys1-vr routing-table ip static-route internet-out destination 0.0.0.0/0 interface ??? ; This is also tricky. Correct approach for vsys VR to use External Zone: The route in the vsys VR should point to a next-hop *interface* that is part of the External Zone, OR it might be simpler that the External Zone itself is the "gateway". Let's re-verify. PAN-OS Admin Guide for 10.1: "For the vsys, configure a static route in its virtual router that lists the External zone as the destination for traffic that the vsys forwards to the shared gateway." This means you do not specify a next-hop IP or a physical interface in the typical sense for this route. The "External Zone" acts as the logical next hop. When configuring the static route in the vsys VR: Destination: 0.0.0.0/0 Interface: (Leave Blank if 'External Zone' is the target) - this is where it gets tricky. You typically pick an interface. Next Hop: Select "None", and the External Zone itself implicitly handles the forwarding to the SG. Actually, it's more like: you create a virtual interface (like a tunnel interface, but not quite) or the zone becomes a routing target. Let's use the official doc style: "Select the External zone as the path monitoring destination for the static route that forwards traffic from the vsys to the shared gateway." In PAN-OS, when you create a static route, you specify a destination, and then either an interface and next-hop IP, or just an interface (for directly connected networks), or a next-hop virtual router. For External Zones, you essentially define a route in the vsys's VR that says "traffic for 0.0.0.0/0 goes towards 'vsys1-External-to-SG1'". PAN-OS handles the internal plumbing. Upon reviewing TechDocs again: When you configure a static route in a vsys to send traffic to a Shared Gateway, you typically don't specify a next-hop IP within the vsys's VR for that route. Instead, the External Zone effectively becomes the target. The firewall knows traffic sent to this External Zone is destined for the linked Shared Gateway. If `vsys1-External-to-SG1` is the name of the External Zone, you would typically have an interface within `vsys1` that's associated with this zone for routing purposes, even if it's a logical construct. Or, the routing decision directs traffic *to* the zone. A common way is to create a Layer 3 subinterface or a dummy/loopback interface in the vsys, assign it to the External Zone, and then route to that interface. However, the "External" zone type simplifies this. The route points "towards" the SG via this External Zone. The key is that the vsys's forwarding plane knows that traffic matching this route needs to be passed to the SG specified in the External Zone's definition. Let's assume the vsys has a logical interface (e.g. loopback or nullif, though not strictly needed as the External Zone itself is the gateway) that is notionally part of the external zone for routing purposes. More accurately, the route in vsys1 would simply be: `set network virtual-router vsys1-vr routing-table ip static-route default-to-sg destination 0.0.0.0/0 interface` - This is not quite right. The External Zone itself acts as the gateway. So the route in vsys1's VR: Destination: 0.0.0.0/0 Next Hop: (Type) -> select the External Zone, or it's implicit by policy. The most common way is that policy (from vsys-trust to vsys-External-to-SG1) allows it, and the default route in vsys1-vr points to an IP address within the Shared Gateway's network *IF* there was a direct L3 link. But here it's an External Zone. The Palo Alto Networks documentation often shows the external zone configured, and then security policy allows traffic to it. The routing decision is: if destination is external zone, send to linked SG. The default route in the vsys should simply point to the Shared Gateway as the next hop. The "External Zone" facilitates this. Official PAN-OS Admin Guide ("Configure a Static Route from the Virtual System to the Shared Gateway"): 1. Select Network > Virtual Routers > vsys-internet-vr. 2. Select Static Routes > IPv4 > Add. 3. Name: default-route-to-SG 4. Destination: 0.0.0.0/0 5. Interface: (select an interface in the vsys that is part of the external zone if you created one; otherwise, this can be tricky. If the external zone is purely logical, the forwarding relies on the zone link). 6. Next Hop: IP Address. **This is where it clarifies.** You use an IP address that is on the Shared Gateway's internal-facing network, if the SG had such an interface accessible by the vsys. But with an "External Zone" type, the mechanism is more abstract. Let's use the "less overhead" model: The external zone is the target. A vsys routes traffic to an External Zone. The External Zone is linked to an SG. The SG handles it from there. The vsys VR: `set network virtual-router routing-table ip static-route destination 0.0.0.0/0 path-monitor-destination-type external-zone ` (this is more for path monitoring). The key is the *forwarding lookup* in the vsys. If a route exists that matches the destination, and the next-hop for that route implies egress through the External Zone, the traffic goes there. So, a simple default route in the vsys VR: `set network virtual-router vsys1-vr routing-table ip static-route default-to-internet destination 0.0.0.0/0 nexthop ?` It will effectively be the Shared Gateway. The selection of the External Zone in Security Policy is key. Let's simplify the vsys routing part: The vsys needs a route that directs internet-bound traffic towards the logical construct representing the connection to the Shared Gateway. This is achieved by having a default route in the vsys's VR where the next-hop effectively becomes the Shared Gateway. The 'External Zone' is the mechanism. Often, you will configure the default route in the vsys VR to point to an IP address that resides on an interface within the Shared Gateway, IF the Shared Gateway were to expose such an interface directly to the vsys (e.g. using inter-vsys routing interfaces). However, for the "External Zone" type, it's simpler: traffic is routed to the External Zone, which then forwards to the SG. The VR needs a default route that will eventually match and forward to that external zone. A more practical way: 1. Vsys VR default route: `set network virtual-router vsys1-vr routing-table ip static-route default-to-sg destination 0.0.0.0/0 nexthop next-vr shared-vr` This command assumes `shared-vr` is directly routable or known. This is more for direct inter-VR routing. For External Zones, the link is more implicit. The most straightforward explanation: Configure a default static route in the vsys's virtual router. The 'next hop' part of this route should logically resolve to the Shared Gateway. For an External Zone, you don't specify a next-hop IP in the typical sense. The firewall resolves this through the External Zone configuration. Security policy then allows traffic from internal zone to this External Zone. The external zone itself is not an interface you pick in the static route. What you do is: In the vsys VR: `set network virtual-router vsys1-vr routing-table ip static-route default-to-internet destination 0.0.0.0/0` And then you must specify a next hop. If the SG is `sg1`, you would typically provide a next-hop IP *on the sg1 network* or specify `next-vr sg1_vr_name`. The External Zone is a policy construct. Let's re-check the base HTML: "The default route for the virtual systems should point to the shared gateway." This implies the SG has some addressable point or the vsys VR can target the SG's VR. Yes, when you link an External Zone to an SG, the vsys's VR can then have a static route whose next-hop is the VR of the Shared Gateway. Example from Palo Alto Networks documentation (slightly adapted for clarity): `set network virtual-router [vsys_router_name] routing-table ip static-route [route_name] destination 0.0.0.0/0 nexthop next-vr [shared_gateway_router_name]` This makes the most sense. The External Zone establishes the *permission* and *path*, and the route uses it.
admin@PA-FW(vsys1)> configure [edit] admin@PA-FW(vsys1)# set network virtual-router vsys1-vr routing-table ip static-route default-to-sg destination 0.0.0.0/0 nexthop next-vr SG-VR-Internet admin@PA-FW(vsys1)# commit
admin@PA-FW(vsys1)> configure [edit] admin@PA-FW(vsys1)# set rulebase security rules Allow-To-Internet from VsysA-Trust to vsys1-External-to-SG1 source any destination any application any service any action allow profile-setting groupadmin@PA-FW(vsys1)# commit
admin@PA-FW(sg1)> configure [edit] admin@PA-FW(sg1)# set rulebase nat rules VsysA-Outbound-NAT from VsysA-Trust source 10.1.0.0/24 to SG-UNTRUST destination any service any admin@PA-FW(sg1)# set rulebase nat rules VsysA-Outbound-NAT source-translation dynamic-ip-and-port interface-address interface ethernet1/1 admin@PA-FW(sg1)# commit(Note: In the NAT rule `from` clause, you'd select the zone from which the SG *receives* traffic from the vsys. This is implicitly handled by the external zone linking. The key is the source IP matching the vsys's internal network.) A more robust NAT rule on the SG: Original Packet: Source Zone (any, as traffic arrives from vsys), Dest Zone (SG-UNTRUST), Source IP (vsys internal IPs).
admin@PA-FW(sg1)> configure [edit] admin@PA-FW(sg1)# set rulebase nat rules SG-Source-NAT description "NAT for vsys traffic to Internet" from any to SG-UNTRUST source [10.1.0.0/24, 10.2.0.0/24] destination any service any source-translation dynamic-ip-and-port interface-address interface ethernet1/1 admin@PA-FW(sg1)# commit
Understanding the packet lifecycle is crucial for troubleshooting and design.
Outbound Traffic (e.g., Host in VsysA to Internet):
Sequence diagram illustrating outbound packet flow from a client in VsysA, through VsysA's security processing, to the Shared Gateway (SG1) for NAT and routing to the Internet. Note that security inspection happens in VsysA.
The base HTML provided several important considerations, which are expanded here:
Advantages of Centralizing Configuration on Shared Gateway:
Choosing between a Shared Gateway and other multi-vsys internet access methods (like a dedicated transit vsys) depends on specific requirements.
Decision tree to help determine if a Shared Gateway is the appropriate Palo Alto Networks solution for providing internet access to multiple virtual systems.
Consider a Shared Gateway when:
Consider a dedicated transit vsys (a full vsys acting as an internet gateway for other vsys) when:
It's crucial to remember the inherent limitations of a Shared Gateway, as these define its appropriate use cases: