How to use the command 'peerindex' (with examples)
The ‘peerindex’ command is a tool that allows users to inspect the MRT TABLE_DUMPV2 Peer Index Table. It has the capability to read files compressed with gzip, bzip2, and xz. More information about the command can be found at https://codeberg.org/1414codeforge/ubgpsuite .
Use case 1: Output all peers
Code:
peerindex master6.mrt
Motivation: The motivation for using this example is to obtain a list of all peers present in the MRT TABLE_DUMPV2 file ‘master6.mrt’.
Explanation: In this use case, the ‘peerindex’ command is invoked with the argument ‘master6.mrt’, which specifies the input MRT file to be inspected.
Example Output:
PEER|ASN|IP|PORT|PREFIXES|PFX_IPS|TYPE
1|65500|192.168.0.1|179|500|1000|0
2|65501|192.168.0.2|179|600|1200|1
3|65502|192.168.0.3|179|700|1400|1
...
Use case 2: Display all peers that have provided routing information
Code:
peerindex -r master6.mrt
Motivation: The motivation for using this example is to fetch a list of peers from the MRT TABLE_DUMPV2 file ‘master6.mrt’ that have provided routing information.
Explanation: In this use case, the ‘peerindex’ command is invoked with the ‘-r’ option and the argument ‘master6.mrt’. The ‘-r’ option filters the output to only include peers that have provided routing information.
Example Output:
PEER|ASN|IP|PORT|PREFIXES|PFX_IPS|TYPE
2|65501|192.168.0.2|179|600|1200|1
3|65502|192.168.0.3|179|700|1400|1
...
Conclusion:
The ‘peerindex’ command is a versatile tool for inspecting the MRT TABLE_DUMPV2 Peer Index Table. It provides a simple and effective way to obtain information about peers in MRT files. By understanding the different use cases provided in this article, users can leverage the command to fulfill their specific requirements.