This blog is a joint collaboration between Ravi Balakrishnan (Cisco) and Payal Singh (F5)
Applications environments have different and unique needs on how traffic is to be handled. Some applications, due to the nature of their functionality or maybe due to a business need do require that the application server(s) are able to view the real IP address of the client making the request to the application.
Now, when the request comes to the F5 BIG-IP, it has the option to change the real IP address of the request or to keep it intact. To keep it intact, the setting on the F5 BIG-IP 'Source Address Translation' is set to 'None'.
As simple as it may sound to just toggle a setting on the F5 BIG-IP, a change of this setting causes significant change in traffic flow behavior.
Let us take an example with some actual values. Starting with a simple setup of a standalone F5 BIG-IP with one interface on the F5 BIG-IP for all traffic (one-arm)
From Client: Src: 10.168.56.30 Dest: 10.168.57.11
From BIG-IP to Server: Src: 10.168.57.10 (Self-IP) Dest: 192.168.56.30
In above scenario, the server will respond back to 10.168.57.10 and F5 BIG-IP will take care of forwarding the traffic back to the client. Here, the application server has visibility to the Self-IP 10.168.57.10 and not the client IP.
From Client: Src: 10.168.56.30 Dest: 10.168.57.11
From BIG-IP to Server: Src: 10.168.56.30 Dest: 192.168.56.30
In this scenario, the server will respond back to 10.168.56.30 and here is where comes in the complication, as the return traffic needs to go back to the F5and not the real client. One way to achieve this is to set the default GW of the server to the Self-IP of the BIG-IP and then the server will send the return traffic to the BIG-IP. BUT what if the server default gateway is not to be changed for whatsoever reason. Policy based redirect will help here. The default gateway of the server will point to the ACI fabric, and the ACI fabric will be able to intercept the traffic and send it over to the BIG-IP.
Before we get deeper into the topic of PBR below are a few links to help you refresh on some of the Cisco ACI and F5 BIG-IP concepts
Now let us look at what it takes to configure PBR using a Standalone F5 BIG-IP Virtual Edition in One-Arm mode.
To use the PBR feature on APIC -Service graph is a MUST
Details on L4-L7 service graph on APIC
To get hands on experience on deploying a service graph (without pbr)
1) Bridge domain 'F5-BD'
2) L4-L7 Policy-Based Redirect
3) Logical Device Cluster- Under Tenant->Services->L4-L7, create a logical device
4) Service graph template
5) Click on the service graph created and then go to the Policy tab, make sure the Connections for the connectors C1 and C2 and set as follows:
6) Apply the service graph template
Once the service graph is deployed, it is in applied state and the network path between the consumer, F5 BIG-IP and provider has been successfully setup on the APIC
1) VLAN/Self-IP/Default route
2) Nodes/Pool/VIP
3) iRule (end of the article) that can be helpful for debugging
1) BIG-IP: Set MAC Masquerade
2) APIC: Logical device cluster
3) APIC: L4-L7 Policy-Based Redirect
Configuration is complete, let's look at the traffic flows.
In Step 2 when the traffic is returned from the client, ACI uses the Self-IP and MAC that was defined in the L4-L7 redirect policy to send traffic to the BIG-IP.
Output seen in /var/log/ltm on the BIG-IP, look at the event <SERVER_CONNECTED>
If you are curious of the iRule output if SNAT is enabled on the BIG-IP -Enable AutoMap on the virtual server on the BIG-IP
Use PBR functionality on the Cisco ACI fabric to direct return traffic from the application servers back to the BIG-IP. This will help in having to avoid to re-write your application or to make changes to your BIG-IP configuration and still achieve a symmetry traffic flow with minimal changes.
F5 BIG-IP and Cisco ACI whitepaper
ACI PBR whitepaper
Troubleshooting guide
Layer4-Layer7 services deployment guide
Service graph:
Cisco APIC Layer 4 to Layer 7 Services Deployment Guide, Release 4.0(1)
Cisco APIC Layer 4 to Layer 7 Services Deployment Guide, Release 4.0(1) -PDF