public sealed class PolicyBasedRoute : IMessage<PolicyBasedRoute>, IEquatable<PolicyBasedRoute>, IDeepCloneable<PolicyBasedRoute>, IBufferMessage, IMessage
Reference documentation and code samples for the Network Connectivity v1 API class PolicyBasedRoute.
Policy-based routes route L4 network traffic based on not just destination IP
address, but also source IP address, protocol, and more. If a policy-based
route conflicts with other types of routes, the policy-based route always
takes precedence.
Optional. The IP address of a global-access-enabled L4 ILB that is the
next hop for matching packets. For this version, only nextHopIlbIp is
supported.
Optional. The priority of this policy-based route. Priority is used to
break ties in cases where there are more than one matching policy-based
routes found. In cases where multiple policy-based routes are matched, the
one with the lowest-numbered priority value wins. The default value is
The priority value must be from 1 to 65535, inclusive.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis document provides reference documentation for the \u003ccode\u003ePolicyBasedRoute\u003c/code\u003e class within the Google Cloud Network Connectivity v1 API, with the latest version being 2.9.0.\u003c/p\u003e\n"],["\u003cp\u003ePolicy Based Routes (PBR) are advanced routes that allow traffic routing based on source IP, destination IP, and protocol, taking precedence over other route types.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ePolicyBasedRoute\u003c/code\u003e class implements multiple interfaces, including \u003ccode\u003eIMessage\u003c/code\u003e, \u003ccode\u003eIEquatable\u003c/code\u003e, \u003ccode\u003eIDeepCloneable\u003c/code\u003e, and \u003ccode\u003eIBufferMessage\u003c/code\u003e, and has properties for configuration, such as \u003ccode\u003eFilter\u003c/code\u003e, \u003ccode\u003eNextHopIlbIp\u003c/code\u003e, \u003ccode\u003eNetwork\u003c/code\u003e, and \u003ccode\u003ePriority\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eKey properties of the \u003ccode\u003ePolicyBasedRoute\u003c/code\u003e include \u003ccode\u003eCreateTime\u003c/code\u003e and \u003ccode\u003eUpdateTime\u003c/code\u003e, to track when the route was created or modified, \u003ccode\u003eName\u003c/code\u003e, to identify it, and \u003ccode\u003eWarnings\u003c/code\u003e, to highlight potential misconfigurations.\u003c/p\u003e\n"],["\u003cp\u003eThe class allows for specifying the target of the policy based route, such as \u003ccode\u003eInterconnectAttachment\u003c/code\u003e and \u003ccode\u003eVirtualMachine\u003c/code\u003e, in addition to the network it applies to.\u003c/p\u003e\n"]]],[],null,["# Network Connectivity v1 API - Class PolicyBasedRoute (2.11.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.11.0 (latest)](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/latest/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.10.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.10.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.9.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.9.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.8.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.8.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.7.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.6.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.5.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.4.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.3.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.2.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.1.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/2.0.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [1.2.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/1.2.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [1.1.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/1.1.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute)\n- [1.0.0](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/1.0.0/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute) \n\n public sealed class PolicyBasedRoute : IMessage\u003cPolicyBasedRoute\u003e, IEquatable\u003cPolicyBasedRoute\u003e, IDeepCloneable\u003cPolicyBasedRoute\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Network Connectivity v1 API class PolicyBasedRoute.\n\nPolicy-based routes route L4 network traffic based on not just destination IP\naddress, but also source IP address, protocol, and more. If a policy-based\nroute conflicts with other types of routes, the policy-based route always\ntakes precedence. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e PolicyBasedRoute \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[PolicyBasedRoute](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/latest/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[PolicyBasedRoute](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/latest/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[PolicyBasedRoute](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/latest/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.NetworkConnectivity.V1](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/latest/Google.Cloud.NetworkConnectivity.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.NetworkConnectivity.V1.dll\n\nConstructors\n------------\n\n### PolicyBasedRoute()\n\n public PolicyBasedRoute()\n\n### PolicyBasedRoute(PolicyBasedRoute)\n\n public PolicyBasedRoute(PolicyBasedRoute other)\n\nProperties\n----------\n\n### CreateTime\n\n public Timestamp CreateTime { get; set; }\n\nOutput only. Time when the policy-based route was created.\n\n### Description\n\n public string Description { get; set; }\n\nOptional. An optional description of this resource. Provide this field when\nyou create the resource.\n\n### Filter\n\n public PolicyBasedRoute.Types.Filter Filter { get; set; }\n\nRequired. The filter to match L4 traffic.\n\n### HasNextHopIlbIp\n\n public bool HasNextHopIlbIp { get; }\n\nGets whether the \"next_hop_ilb_ip\" field is set\n\n### HasNextHopOtherRoutes\n\n public bool HasNextHopOtherRoutes { get; }\n\nGets whether the \"next_hop_other_routes\" field is set\n\n### InterconnectAttachment\n\n public PolicyBasedRoute.Types.InterconnectAttachment InterconnectAttachment { get; set; }\n\nOptional. The interconnect attachments that this policy-based route\napplies to.\n\n### Kind\n\n public string Kind { get; set; }\n\nOutput only. Type of this resource. Always\nnetworkconnectivity#policyBasedRoute for policy-based Route resources.\n\n### Labels\n\n public MapField\u003cstring, string\u003e Labels { get; }\n\nUser-defined labels.\n\n### Name\n\n public string Name { get; set; }\n\nImmutable. A unique name of the resource in the form of\n`projects/{project_number}/locations/global/PolicyBasedRoutes/{policy_based_route_id}`\n\n### Network\n\n public string Network { get; set; }\n\nRequired. Fully-qualified URL of the network that this route applies to,\nfor example: projects/my-project/global/networks/my-network.\n\n### NetworkAsNetworkName\n\n public NetworkName NetworkAsNetworkName { get; set; }\n\n[NetworkName](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/latest/Google.Cloud.NetworkConnectivity.V1.NetworkName)-typed view over the [Network](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/latest/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute#Google_Cloud_NetworkConnectivity_V1_PolicyBasedRoute_Network) resource name property.\n\n### NextHopCase\n\n public PolicyBasedRoute.NextHopOneofCase NextHopCase { get; }\n\n### NextHopIlbIp\n\n public string NextHopIlbIp { get; set; }\n\nOptional. The IP address of a global-access-enabled L4 ILB that is the\nnext hop for matching packets. For this version, only nextHopIlbIp is\nsupported.\n\n### NextHopOtherRoutes\n\n public PolicyBasedRoute.Types.OtherRoutes NextHopOtherRoutes { get; set; }\n\nOptional. Other routes that will be referenced to determine the next hop\nof the packet.\n\n### PolicyBasedRouteName\n\n public PolicyBasedRouteName PolicyBasedRouteName { get; set; }\n\n[PolicyBasedRouteName](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/latest/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRouteName)-typed view over the [Name](/dotnet/docs/reference/Google.Cloud.NetworkConnectivity.V1/latest/Google.Cloud.NetworkConnectivity.V1.PolicyBasedRoute#Google_Cloud_NetworkConnectivity_V1_PolicyBasedRoute_Name) resource name property.\n\n### Priority\n\n public int Priority { get; set; }\n\nOptional. The priority of this policy-based route. Priority is used to\nbreak ties in cases where there are more than one matching policy-based\nroutes found. In cases where multiple policy-based routes are matched, the\none with the lowest-numbered priority value wins. The default value is\n\n1. The priority value must be from 1 to 65535, inclusive.\n\n### SelfLink\n\n public string SelfLink { get; set; }\n\nOutput only. Server-defined fully-qualified URL for this resource.\n\n### TargetCase\n\n public PolicyBasedRoute.TargetOneofCase TargetCase { get; }\n\n### UpdateTime\n\n public Timestamp UpdateTime { get; set; }\n\nOutput only. Time when the policy-based route was updated.\n\n### VirtualMachine\n\n public PolicyBasedRoute.Types.VirtualMachine VirtualMachine { get; set; }\n\nOptional. VM instances that this policy-based route applies to.\n\n### Warnings\n\n public RepeatedField\u003cPolicyBasedRoute.Types.Warnings\u003e Warnings { get; }\n\nOutput only. If potential misconfigurations are detected for this route,\nthis field will be populated with warning messages."]]