As more and more large enterprise customers are migrating to Google Cloud, their GCP infrastructure becomes increasingly complex. Each projects will have tens and hundreds of routes configure. Troubleshooting a routing issue becomes time consuming, difficult and error prone.
The route-trace tool will enable user to find out exactly how traffic to a specific destination will be routed
This tools is implemented in python and it runs on Linux, Mac OS X and Windows, and requires the following packages and libraries:
Python 2.7.x or Python 3.3+
Google Cloud SDK
Google Cloud Python Client API library
If Python 2.7 is used, Python py2-ipaddress 2.0 package needs to be installed. This is a backport of standard IP address handling package from Python version 3.3+
Please refer to Appendix “Setting Up Python Environment” for step by step instructions on how to set up the environment
gcp-tracer DESTINATION_IP --project=PROJECT_ID --network=NETWORK --tag=TAG --verbose=true
DESTINATION_IP
[Required] Destination IP of the traffic, e.g. 192.168.0.1
--project
[Required] Name of the project where routing rules are configured
--network
[Required] Name of the network where routing rules are configured
--tag
[Optional] Used to simulate traffic initiated from a instance with this specific tag.
--verbose
[Optional] when set to “true” Print out detailed route tracing information. If not used, only route trace results will be printed
python route-trace.py 6.6.6.254 --project=mzuo-nyt-vpn --network=lb-test --tag=qa --verbose=true This command traces traffic sent from an instance tagged with “qa” and destined to 6.6.6.254, printing out trace information in detail.
python route-trace.py 10.0.0.1 --project=mzuo-nyt-vpn --network=lb-test This command traces traffic destined to 10.0.0.1, printing out trace result only.
- This tool is designed for troubleshooting routing rules configuration and is not part of GCP feature set.
- Currently there is no extensive checking of parameter formats and validity. Please see specification and examples above for how to run the tool
- For questions and comments, please contact [email protected]
- Install Python if not already installed
Check to see if Python is installed and which version is installed
Python installation packages are available at https://www.python.org/downloads/
If using Version 2.7 (default version for many platforms), py2-ipaddress 2.0 package need to be installed as well Download ipy2-ipaddress 2.0 Python 2.7 backport package from https://pypi.python.org/pypi/py2-ipaddress/2.0 Unzip package and run setup Python script setup.py in the package. (e.g. on a linux platform: “sudo python setup.py install”) - Install GCP Cloud SDK from https://cloud.google.com/sdk/
- Provide Google Cloud credentials by using GCP Cloud SDK command “gcloud auth application-default login”
- Install Python Client API library from https://developers.google.com/api-client-library/python/start/installation