Encap.txt: Difference between revisions

From 44Net Wiki
Jump to navigation Jump to search
Vk7sh (talk | contribs)
Updated for new portal
W6JMK (talk | contribs)
Use the API to get all routes. The portal doesn't provide an encap.txt file via HTTP.
Line 1: Line 1:
== The encap.txt file ==
An encap.txt file lists AMPRNet [[gateway| gateways]], in a format like this:


The encap.txt file is a file listing all the AMPRNet [[gateway| gateways]].
<nowiki># This is a comment
route addprivate 44.10.0.100/32 encap 136.115.52.224
route addprivate 44.100.129.0/24 encap 176.140.10.22</nowiki>


Originally formatted for JNOS systems, it is often parsed with a "[[munge script]]" to update Linux system routing tables.
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| portal]] and private HTTP.


== Portal ==
== Portal ==


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:
To get an encap.txt file that lists all current gateways,
request all routes from the [[API]] and convert the response from JSON to text.
For example (using API version 2):


  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)"'
  <nowiki>curl -s -H "Authorization: Bearer $APItoken" -H "Accept: application/json" https://portal.ampr.org/api/v2/encap/routes | jq -r '.encap[] | select(.encapType == "IPIP") | "route addprivate \(.network)/\(.cidr) encap \(.gatewayIP)"'</nowiki>


== HTTP ==
== 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:
Previously, a complete encap.txt file was available from the portal as a web page.
 
This is no longer supported.
[https://mailman.ampr.org/mailman/private/44net/2020-January/010633.html private gateway stats]

Revision as of 01:38, 15 October 2024

An encap.txt file lists AMPRNet gateways, in a format like this:

# This is a comment
route addprivate 44.10.0.100/32 encap 136.115.52.224
route addprivate 44.100.129.0/24 encap 176.140.10.22

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

Portal

To get an encap.txt file that lists all current gateways, request all routes from the API and convert the response from JSON to text. For example (using API version 2):

curl -s -H "Authorization: Bearer $APItoken" -H "Accept: application/json" https://portal.ampr.org/api/v2/encap/routes | jq -r '.encap[] | select(.encapType == "IPIP") | "route addprivate \(.network)/\(.cidr) encap \(.gatewayIP)"'

HTTP

Previously, a complete encap.txt file was available from the portal as a web page. This is no longer supported.