# BGP AS Path Loop Policy Sandbox

Simulate AS_PATH loop detection, policy filtering, attribute changes, and deterministic best-path selection.

> Canonical page: https://elysiatools.com/en/tools/bgp-as-path-loop-policy-sandbox

- **Category:** Networking

- **Keywords:** BGP, AS_PATH, route policy, loop detection, local preference, network sandbox

## Overview

Enter route entries and first-match policy rules as JSON. The simulator rejects routes containing the local AS, then evaluates prefix and AS_PATH matches. Accepted paths are ranked by Local Preference (higher), AS_PATH length (shorter), Origin (IGP before EGP before Incomplete), and MED (lower). This is a teaching model, not a full vendor routing daemon.

## Inputs

- **Local AS** (number)
- **Route Entries (JSON)** (textarea): \[{"prefix":"203.0.113.0/24","asPath":"64501 64496","localPref":100,"med":20,"origin":"igp"}\]
- **Policy Rules (JSON)** (textarea): \[{"name":"prefer customer","action":"permit","prefix":"203.0.113.0/24","setLocalPref":200}\]
- **Default Action** (select)
- **Select Best Path** (checkbox)

## When to use

- Test whether routes containing the local AS are rejected as loops.
- Check how prefix or AS_PATH policy rules permit, deny, or change Local Preference.
- Compare accepted routes using Local Preference, AS_PATH length, Origin, and MED.

## How it works

- Enter the local AS number and route entries as JSON.
- Add ordered policy rules with permit or deny actions and optional attribute changes.
- The simulator rejects paths containing the local AS, then evaluates the first matching policy rule or the default action.
- When enabled, best-path selection ranks accepted routes by higher Local Preference, shorter AS_PATH, Origin preference, and lower MED.

## Use cases

- Study BGP loop prevention and AS_PATH behavior with controlled route examples.
- Validate route-policy ordering, default actions, and Local Preference changes.
- Demonstrate deterministic best-path selection in networking lessons or documentation.

## Frequently asked questions

### What input does the sandbox require?

It requires a local AS number and route entries in JSON. Policy rules and a default action are also provided.

### How are AS_PATH loops detected?

A route is rejected when its AS_PATH contains the configured local AS.

### How are policy rules evaluated?

Rules are evaluated in order, and the first matching prefix or AS_PATH rule determines the action.

### What happens when no policy rule matches?

The simulator applies the selected default action: permit or deny.

### How is the best route selected?

Accepted paths are ranked by higher Local Preference, shorter AS_PATH, preferred Origin, and lower MED.

## Related tools

- [JSON Path Visualizer](https://elysiatools.com/en/tools/json-path-visualizer): Visualize JSON or JSONL as an expandable tree and copy JSONPath expressions for every node
- [Audio Voice Activity Segmentation](https://elysiatools.com/en/tools/audio-voice-activity-segmentation): Detect likely speech-range activity and export speech/non-speech ranges as JSON, CSV, SRT markers, or an FFmpeg cut list.
- [SBOM SPDX CycloneDX License Policy Auditor](https://elysiatools.com/en/tools/sbom-spdx-cyclonedx-license-policy-auditor): Audit SPDX 2.3 or CycloneDX 1.5 component licenses and emit SARIF with failing dependency paths
- [JSON Diff Visualizer](https://elysiatools.com/en/tools/json-diff-visualizer): Compare two JSON payloads and render a visual HTML diff with path-level additions, removals, changes, and statistics
- [Data Range Limiter](https://elysiatools.com/en/tools/data-range-limiter): Limit numerical values to specified ranges by clipping, filtering, or marking out-of-bounds values. Perfect for data quality control, sensor data cleaning, business rule enforcement, and data preprocessing. Features: - Range clipping (clip values to min/max boundaries) - Range filtering (remove out-of-bounds rows) - Range marking (flag modified values) - Per-column range configuration - Automatic numeric column detection - Multiple handling strategies - Detailed modification reports - Statistical analysis of changes - Business rule enforcement Common Use Cases: - Sensor data validation and cleaning - Machine learning input preparation - Data quality control and validation - Business constraint enforcement - Outlier management and control - Data preprocessing pipelines
- [PDF Timesheet Summary](https://elysiatools.com/en/tools/pdf-timesheet-summary): Automatically summarize timesheet/schedule data and export as PDF
- [Text NLP Annotation Workbench](https://elysiatools.com/en/tools/text-nlp-annotation-workbench): Run explainable local tokenization, sentence splitting, stopword, lemma, stem, entity and n-gram annotation with JSONL or CoNLL export.
- [Dataset Imbalance Detector & Resampler](https://elysiatools.com/en/tools/dataset-imbalance-detector-resampler): Detect class imbalance in CSV or JSON datasets, compare resampling strategies, and preview a balanced output dataset

## Samples

- [Distributed Tracing Samples](https://elysiatools.com/en/samples/distributed-tracing-samples): Comprehensive distributed tracing examples using Jaeger, OpenTelemetry, and other modern observability tools for microservices architecture
- [AWS EventBridge Samples](https://elysiatools.com/en/samples/eventbridge-samples): AWS EventBridge examples including event buses, rules, targets, schema registry, custom events, and cross-account event routing for serverless event-driven architecture
- [JWT Samples](https://elysiatools.com/en/samples/jwt-samples): Comprehensive JWT examples from basic token structure to advanced security implementations
- [PDF Samples](https://elysiatools.com/en/samples/pdf-samples): Generated PDF samples from tools dated 2026-02-01 to 2026-02-10
