Encap.txt: Difference between revisions

From 44Net Wiki
Jump to navigation Jump to search
Ki4cuw (talk | contribs)
provide details on creating encap.txt from portal's json outside
Vk7sh (talk | contribs)
Updated for new portal
Line 11: Line 11:
You can create an API key on the portal by visiting [https://portal.ampr.org/profile.php your profile page]. Since it needs to be 32 characters I recommend using md5sum of any random data to generate it. The encap endpoint produces json format which you will need to format. You can then use the command line utilities '''curl''' and '''jq''' to turn this data into routes to ingest into about anything. For example for JNOS encap.txt format:
You can create an API key on the portal by visiting [https://portal.ampr.org/profile.php your profile page]. Since it needs to be 32 characters I recommend using md5sum of any random data to generate it. The encap endpoint produces json format which you will need to format. You can then use the command line utilities '''curl''' and '''jq''' to turn this data into routes to ingest into about anything. For example for JNOS encap.txt format:


  curl -s https://user:key@portal.ampr.org/api/v1/encap | jq -r '.[] | "route addprivate \(.network)/\(.maskLength) encap \(.gatewayIP)"'
  curl -s -H "Authorization: Bearer <Portal API Key>" -H "Accept: application/json" https://portal.ampr.org/api/v1/encap/routes | jq -r '.encap[] | "route addprivate \(.network)/\(.maskLength) encap \(.gatewayIP)"'


== HTTP ==
== HTTP ==

Revision as of 12:27, 14 September 2024

The encap.txt file

The encap.txt file is a file listing all the AMPRNet gateways.

Originally formatted for JNOS systems, it is often parsed with a "munge script" to update Linux system routing tables.

The file can be obtained via the portal and private HTTP.

Portal

You can create an API key on the portal by visiting your profile page. Since it needs to be 32 characters I recommend using md5sum of any random data to generate it. The encap endpoint produces json format which you will need to format. You can then use the command line utilities curl and jq to turn this data into routes to ingest into about anything. For example for JNOS encap.txt format:

curl -s -H "Authorization: Bearer <Portal API Key>" -H "Accept: application/json" https://portal.ampr.org/api/v1/encap/routes | jq -r '.encap[] | "route addprivate \(.network)/\(.maskLength) encap \(.gatewayIP)"'

HTTP

This is still available on private HTTP but it is deprecated and also removed from the anonymous FTP. 44net list members can find the details in the mailman Archive in this thread:

private gateway stats