### WireGuard Example Configuration Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel An example configuration snippet for WireGuard, a modern VPN protocol. This demonstrates basic setup parameters. ```text Example for WireGuard: ``` -------------------------------- ### Netplan Configuration Example Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel A basic Netplan configuration file example. Ensure the file is placed in /etc/netplan/ and has a .yaml extension. ```yaml network: version: 2 ethernets: eth0: dhcp4: true tunnels: tun0: mode: vxlan id: 4096 local: 192.168.1.100 remote: 192.168.1.200 port: 4789 ttl: 255 addresses: [10.0.0.1/24] mtu: 1450 ``` -------------------------------- ### Netplan Configuration Example Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Example of a Netplan configuration file for setting up network interfaces, specifically for GRE tunnels. Ensure the file is placed in /etc/netplan/ and follows YAML syntax. ```yaml network: version: 2 tunnels: {name}: mode: gre local: ``` -------------------------------- ### WireGuard Configuration File Example Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Example WireGuard configuration file structure for /etc/wireguard/{name}.conf. Ensure you replace placeholders like {your tunnel ip cidr}, {yourside port}, and {your private key} with actual values. ```ini \[Interface] Address = {your tunnel ip cidr} ListenPort = {yourside port} PrivateKey = {your private key} ``` -------------------------------- ### Usage Examples Source: https://hatsnet.io/docs/docs/community/control-communities Practical examples demonstrating the use of community values for traffic engineering. ```APIDOC ## Usage Examples ### Example 1: Local Traffic Only Announce a prefix only within a specific region: ``` # Announce to Asia West only 203314:2:1 # Disable cross-region ``` ### Example 2: Deprioritize Backup Prefix Make a backup prefix less attractive: ``` # Deprioritize via path prepending 203314:220:3 # Prepend 3x AS203314 ``` ### Example 3: Selective Peering Announce only to specific peer types: ``` # Announce to peering and customers only 203314:1:0 # Do not send to upstream ``` ### Example 4: Exclude Location Prevent announcement via specific location: ``` # Exclude PoP-specific announcement 203314:202:301 # Do not send via Seattle ``` ``` -------------------------------- ### Systemd Network Configuration Example Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Example of a systemd network configuration file. This snippet defines tunnel parameters like local and remote IPs, and TTL. ```ini [Tunnel] Local = {yourside ip} Remote = {ourside ip} TTL = 255 ``` -------------------------------- ### Enable WireGuard Service Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Command to enable and start the WireGuard service using systemctl. ```bash systemctl enable --now wg-quick@{name} ``` -------------------------------- ### Systemd Network Device Configuration Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Example of a .netdev file for initializing a WireGuard interface. ```ini [NetDev] Name = {name} Kind = wireguard [WireGuard] ListenPort = {yourside port} ``` -------------------------------- ### Configure .netdev file for systemd Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Example configuration for a .netdev file located at /etc/systemd/network/10-{name}.netdev. ```ini [NetDev] Name = {name} remote: {ourside ip} ttl: 255 addresses: - {your tunnel ip cidr} ``` -------------------------------- ### Configure SIT and ip6gre Tunnels Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Setup for IPv6 tunneling over IPv4 using shell, Netplan, and systemd-networkd. ```bash # SIT: IPv6-in-IPv4 ip tunnel add {name} mode sit local {yourside ipv4} remote {ourside ipv4} ttl 255 ip addr add {your tunnel ipv6 cidr} dev {name} ip link set dev {name} up ``` ```bash # ip6gre: GRE over IPv4 carrying IPv6 ip tunnel add {name} mode ip6gre local {yourside ipv4} remote {ourside ipv4} ttl 255 ip addr add {your tunnel ipv6 cidr} dev {name} ip link set dev {name} up ``` ```yaml network: version: 2 tunnels: { name }: # Use 'sit' for 6in4, or 'ip6gre' for GRE-encapsulated IPv6 mode: sit local: { yourside ipv4 } remote: { ourside ipv4 } ttl: 255 addresses: - { your tunnel ipv6 cidr } ``` ```ini [NetDev] Name = {name} # Kind = sit (for 6in4) # Kind = ip6gre (for GRE over IPv4 carrying IPv6) Kind = sit [Tunnel] Local = {yourside ipv4} Remote = {ourside ipv4} TTL = 255 ``` ```ini [Match] Name = {name} [Network] ``` -------------------------------- ### Create Netplan Configuration File Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel This snippet shows how to create a Netplan configuration file for network setup. Ensure the file is placed in \/etc\/netplan\/ and follows the YAML format. ```yaml network: version: 2 tunnels: {name}: mode: gretap local: {your side ip} ``` -------------------------------- ### Region Code Examples Source: https://hatsnet.io/docs/docs/community/region-codes Reference patterns for region-based BGP large communities. ```text 203314:201:XX ``` ```text 203314:130:XX ``` -------------------------------- ### Netplan VxLAN Configuration Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Example YAML configuration for defining a VxLAN tunnel in Netplan. ```yaml network: version: 2 tunnels: ``` -------------------------------- ### Example: Keep in-region + Exclude a PoP Source: https://hatsnet.io/docs/docs/community/control-communities This example demonstrates how to keep BGP Large Communities that are in-region while excluding a specific Point of Presence (PoP) identified by its community value. ```python 203314:2:1 + 203314:202:253 ``` -------------------------------- ### Example: No Upstream with Prepend Source: https://hatsnet.io/docs/docs/community/control-communities Demonstrates a scenario with no upstream and prepending data. The code includes identifiers for upstream and prepend operations. ```text Example: No Upstream (203314:1:0) + Prepend 3x (203314:220:3) ``` -------------------------------- ### BGP Large Community Configuration Source: https://hatsnet.io/docs/docs/community Example of adding a BGP large community to prepend routes. ```text bgp_large_community.add((203314, 220, 3)); # Prepend 3x to upstream routes ``` -------------------------------- ### Configure GRE Tunnel Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Setup for GRE tunnels using shell commands, Netplan, and systemd-networkd. ```bash ip tunnel add {name} mode gre local {yourside ip} remote {ourside ip} ttl 255 ip addr add {your tunnel ip cidr} dev {name} ip link set dev {name} up ``` ```yaml network: version: 2 tunnels: { name }: mode: gre local: { yourside ip } remote: { ourside ip } ttl: 255 addresses: - { your tunnel ip cidr } ``` ```ini [NetDev] Name = {name} Kind = gre [Tunnel] Local = {yourside ip} Remote = {ourside ip} TTL = 255 ``` ```ini [Match] Name = {name} [Network] Address = {your tunnel ip cidr} ``` -------------------------------- ### Systemd Network Configuration for Tunnel Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Example of a systemd network configuration file for a tunnel interface. This file should be placed in /etc/systemd/network/. ```ini [Match] Name=* [Network] DHCP=ipv4 [Tunnel] Mode=vxlan ID={vni} Local={yourside ip} Remote={ourside ip} ``` -------------------------------- ### BGP Large Community Syntax Source: https://hatsnet.io/docs/docs/community/control-communities Examples of BGP Large Community syntax for JunOS and BIRD2. ```text large: ``` ```text large:203314:0:666 ``` ```text bgp_large_community ``` ```text (203314, 0, 666) ``` -------------------------------- ### Route Learning Tags Example Source: https://hatsnet.io/docs/docs/community/region-codes Demonstrates the format of learned-in tags that indicate where a route was learned. These tags are set by AS203314 on routes received. ```text # Learned-in tags (set by AS203314 on routes you receive): # (203314, 130, 100) -> Asia West # (203314, 130, 150) -> Asia East # (203314, 130, 300) -> North America ``` -------------------------------- ### Configure Network Address in Netplan Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Example of setting a network address within a Netplan configuration file. Replace '{your tunnel ipv6 cidr}' with your actual IPv6 CIDR block. ```yaml [Network] Address = {your tunnel ipv6 cidr} ``` -------------------------------- ### Regional Filtering Example Source: https://hatsnet.io/docs/docs/community/region-codes Example of regional filtering using BGP communities. This demonstrates how to match and set specific community values for regional routing policies. ```text route for 192.0.2.0/24 { match community \\[ 203314:130:XX \\]; set community \\[ 203314:130:XX \\]; } ``` -------------------------------- ### Select Network Configuration Method Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Choose between wg-quick, systemd-networkd, or enabling a service. This UI element presents options for network configuration. ```javascript \,\"$L54\",null,{\"defaultValue\":\"wg-quick\",\"className\":\"mt-6\",\"children\":\[\[\"$\",\"$L55\",null,{\"children\":\[\[\"$\",\"$L56\",null,{\"value\":\"wg-quick\",\"children\":\[\[\"$\",\"svg\",null,{\"ref\":\"$undefined\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"width\":24,\"height\":24,\"viewBox\":\"0 0 24 24\",\"fill\":\"none\",\"stroke\":\"currentColor\",\"strokeWidth\":2,\"strokeLinecap\":\"round\",\"strokeLinejoin\":\"round\",\"className\":\"lucide lucide-terminal\",\"aria-hidden\":\"true\",\"children\":\[\[\"$\",\"path\",\"baeox8\",{\"d\":\"M12 19h8\"}\]\]}\\n],\"$\",\"p\",null,{\"children\":\"wg-quick\"}\]}\\n],\"$\",\"$L56\",null,{\"value\":\"systemd\",\"children\":\[\[\"$\",\"svg\",null,{\"ref\":\"$undefined\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"width\":24,\"height\":24,\"viewBox\":\"0 0 24 24\",\"fill\":\"none\",\"stroke\":\"currentColor\",\"strokeWidth\":2,\"strokeLinecap\":\"round\",\"strokeLinejoin\":\"round\",\"className\":\"lucide lucide-settings2 lucide-settings-2\",\"aria-hidden\":\"true\",\"children\":\[\[\"$\",\"path\",\"gfn3mx\",{\"d\":\"M14 17H5\"}\]\]}\\n],\"$\",\"p\",null,{\"children\":\"systemd-networkd\"}\]}\\n],\"$\",\"$L56\",null,{\"value\":\"enable\",\"children\":\[\[\"$\",\"svg\",null,{\"ref\":\"$undefined\",\"xmlns\":\"http://www.w3.org/2000/svg\",\"width\":24,\"height\":24,\"viewBox\":\"0 0 24 24\",\"fill\":\"none\",\"stroke\":\"currentColor\",\"strokeWidth\":2,\"strokeLinecap\":\"round\",\"strokeLinejoin\":\"round\",\"className\":\"lucide lucide-play\",\"aria-hidden\":\"true\",\"children\":\[\[\"$\",\"path\",\"10ikf1\",{\"d\":\"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z\"}\]\]}\\n],\"$\",\"p\",null,{\"children\":\"Enable Service\"}\]\]}\]}\\n],\"$\",\"$L57\",null,{\"value\":\"wg-quick\",\"className\":\"space-y-3\",\"children\":\[\[\"$\",\"p\",null,{\"children\":\"Create a WireGuard configuration file:\"}\\n],\"$\",\"$L58\",null,{\"className\":\"shiki shiki-themes github-light github-dark\",\"style\":{\"--shiki-light\":\"#24292e\",\"--shiki-dark\":\"#e1e4e8\",\"--shiki-light-bg\":\"#fff\",\"--shiki-dark-bg\":\"#24292e\"},\"tabIndex\":\"0\",\"title\":\"/etc/wireguard/{name}.conf\",\"icon\":\"\u003csvg viewBox=\\\"0 0 24 24\\\"\u003e\u003cpath d=\\\"M 6,1 C 4.354992,1 3,2.354992 3,4 v 16 c 0,1.645008 1.354992,3 3,3 h 12 c 1.645008,0 3,-1.354992 3,-3 V 8 7 A 1.0001,1.0001 0 0 0 20.707031,6.2929687 l -5,-5 A 1.0001,1.0001 0 0 0 15,1 h -1 z m 0,2 h 7 v 3 c 0,1.645008 1.354992,3 3,3 h 3 v 11 c 0,0.564129 -0.435871,1 -1,1 H 6 C 5.4358712,21 5,20.564129 5,20 V 4 C 5,3.4358712 5.4358712,3 6,3 Z M 15,3.4140625 18.585937,7 H 16 C 15.435871,7 15,6.5641288 15,6 Z\\\ ``` -------------------------------- ### Apply Netplan Configuration Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Use this command to apply Netplan network configurations. Ensure your Netplan configuration file is correctly set up before applying. ```bash sudo netplan apply ``` -------------------------------- ### Combined Community Control Source: https://hatsnet.io/docs/docs/community/control-communities Example of combining multiple communities for complex routing policies. ```text # Deprioritized, Asia-only, no upstream 203314:1:0 # No upstream 203314:2:1 # Asia only 203314:220:2 # Prepend 2x ``` -------------------------------- ### Configure VXLAN Network Settings (.network file) Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Create a .network file to configure the VXLAN interface. Set the local and remote IP addresses for the tunnel endpoints. ```ini [Match] Name = {name} [Network] Mode = vxlan Local = yoursid ip Remote = ourside ip ``` -------------------------------- ### Community Decision Flow Source: https://hatsnet.io/docs/docs/community/control-communities A step-by-step guide on how to use community values for routing decisions. ```APIDOC ## Community Decision Flow ### Description Match the routing goal to the right AS203314 control-community family before you announce the prefix. ### Steps 1. **Announce Route**: Start with the prefix you want AS203314 to propagate. 2. **Pick a Policy**: Decide whether you need local-only propagation, prepending, PoP exclusion, or peer-type filtering. 3. **Apply Communities**: Add the matching `203314:*` tags to the route update you send us. 4. **Announce to AS203314**: Our edge routers ingest the route and evaluate the attached controls. 5. **Verify the Effect**: Check route servers and looking glasses to confirm the intended propagation outcome. ``` -------------------------------- ### Apply WireGuard Configuration Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Commands to apply WireGuard settings via systemd. ```bash systemctl restart systemd-networkd ``` ```bash systemctl enable --now wg-quick@{name} ``` -------------------------------- ### Configure VXLAN via Shell Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Use iproute2 commands to establish a VXLAN tunnel interface. ```bash ip link add {name} type vxlan local {yourside ip} remote {ourside ip} dstport 4789 id {vni} ttl 255 ip addr add {your tunnel ip cidr} dev {name} ip link set dev {name} up ``` -------------------------------- ### Configure .netdev file for systemd Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Create a .netdev file in /etc/systemd/network/ to define network interface settings. ```ini [NetDev] yourside ip: { remote: { ourside ip } ttl: 255 addresses: - { your tunnel ip cidr } ``` -------------------------------- ### BGP Large Community Configuration Source: https://hatsnet.io/docs/docs/community/region-codes Examples of BGP large community configurations for excluding specific regions. ```text bgp_large_community.add((203314, 201, 300)); # Exclude North America ``` ```text bgp_large_community.add((203314, 201, 200)); # Exclude Europe ``` -------------------------------- ### Define VXLAN Interface (.netdev file) Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Create a .netdev file to define the VXLAN network device. Specify the name and kind (vxlan) for the interface. ```ini [NetDev] Name = {name} Kind = vxlan ``` -------------------------------- ### Configure GRETAP via systemd-networkd Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Set up a GRETAP tunnel using .netdev and .network files. ```ini [NetDev] Name = {name} Kind = gretap [Tunnel] Local = {yourside ip} Remote = {ourside ip} TTL = 255 ``` ```ini [Match] Name = {name} [Network] Address = {your tunnel ip cidr} ``` ```bash systemctl restart systemd-networkd ``` -------------------------------- ### Exclude North America and Europe Regions Source: https://hatsnet.io/docs/docs/community/control-communities Example of excluding specific regions while keeping traffic within Asia. ```BGP 203314:2:1 ``` ```BGP 203314:201:300 ``` ```BGP 203314:201:200 ``` -------------------------------- ### Apply Network Configuration Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Commands to apply network configuration changes using systemd-networkd or netplan. ```bash systemctl restart systemd-networkd ``` ```bash netplan apply ``` -------------------------------- ### Configure VXLAN via systemd-networkd Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Set up a VXLAN tunnel using .netdev and .network files. ```ini [NetDev] Name = {name} Kind = vxlan [VXLAN] VNI = {vni} Local = {yourside ip} Remote = {ourside ip} DestinationPort = 4789 TTL = 255 ``` ```ini [Match] Name = {name} [Network] Address = {your tunnel ip cidr} ``` ```bash systemctl restart systemd-networkd ``` -------------------------------- ### Exclude Seattle PoP Announcement Source: https://hatsnet.io/docs/docs/community/control-communities Example of preventing announcement via a specific PoP, using the Seattle PoP exclusion community. ```BGP 203314:202:301 ``` -------------------------------- ### Configure GRETAP via Shell Source: https://hatsnet.io/docs/docs/peering/via-layer2-tunnel Use iproute2 commands to establish a GRETAP tunnel interface. ```bash ip link add {name} type gretap local {yourside ip} remote {ourside ip} ttl 255 ip addr add {your tunnel ip cidr} dev {name} ip link set dev {name} up ``` -------------------------------- ### BGP Community Routing Policy Source: https://hatsnet.io/docs/docs/community/region-codes Example of a BGP routing policy configuration using community matching to set local preference. ```text if (203314, 130, 100) ~ bgp_large_community then bgp_local_pref = 200; accept; ``` -------------------------------- ### Policy Statement Example Source: https://hatsnet.io/docs/docs/community/pop-codes Defines a policy statement with export and rejection terms. This is useful for setting up network access control rules. ```Hatsnet policy-statement EXPORT-TO-HATS term REJECT-ALL then reject ``` -------------------------------- ### BGP Community Reference Source: https://hatsnet.io/docs/docs/community A reference guide for the BGP community strings used by AS203314 to manage routing policies and traffic engineering. ```APIDOC ## BGP Community Reference ### Description This reference lists the BGP community strings used for route origin identification, geographic scoping, and traffic control actions within AS203314. ### Community Categories - **Origin**: `203314:110:XX` (Route source type) - **PoP**: `203314:120:XXX` (Learned at PoP) - **PoP Pass**: `203314:125:XXX` (Passed through PoP) - **Region**: `203314:130:XX` (Learned in region) - **Region Pass**: `203314:135:XX` (Passed through region) ### Control Communities - **Blackhole**: `203314:0:666` (Do not announce) - **No Upstream**: `203314:1:0` (Do not send to upstream) - **No Peering**: `203314:1:1` (Do not send to peering) - **No Customer**: `203314:1:2` (Do not send to downstream) - **No Cross-Region**: `203314:2:1` (Keep within region) - **No Cross-PoP**: `203314:2:2` (Keep within PoP) - **No Region**: `203314:201:XX` (Exclude region) - **No PoP**: `203314:202:XXX` (Exclude PoP) ### AS-Path Prepending - **Prepend 1x**: `203314:220:1` - **Prepend 2x**: `203314:220:2` - **Prepend 3x**: `203314:220:3` - **Prepend 4x**: `203314:220:4` - **Prepend 5x**: `203314:220:5` ``` -------------------------------- ### Manage Tunnel Interfaces with iproute2 Source: https://hatsnet.io/docs/docs/peering/via-layer3-tunnel Command-line instructions for configuring and enabling tunnel interfaces directly. ```bash ip addr add {your tunnel ipv6 cidr} dev {name} ``` ```bash ip link set dev {name} up ``` -------------------------------- ### BGP Large Community Routing Filter Source: https://hatsnet.io/docs/docs/community/internal-communities Example of using BGP large communities to reject specific routes or de-prioritize upstream-learned routes. ```text 80; # de-prioritize upstream-learned routes accept; } ; } bgp_large_community then reject; if (203314, 135, 250) ~ bgp_large_community then reject; ``` -------------------------------- ### BGP Best Practices for Communities Source: https://hatsnet.io/docs/docs/community/control-communities Guidelines for using BGP communities, emphasizing testing, monitoring, documentation, and conservative prepends. ```text Test before production: Use 203314:220:1 (1x prepend) to verify communities work Monitor impact: Check route servers and looking glasses after applying changes Document your policies: Keep track of which prefixes use which communities Use conservative prepends: 3x prepend is usually sufficient; 5x is extreme ``` -------------------------------- ### Configure Community Policy Statement Source: https://hatsnet.io/docs/docs/community/pop-codes Example of setting a community policy for HATSNet IO members. This configuration is used to define network policy options. ```text set policy-options community HATS-NO-AMS members large:203314:202:253 ``` -------------------------------- ### Code Example for Disabling Cross-Region Traffic Source: https://hatsnet.io/docs/docs/community/control-communities Illustrates how to disable cross-region traffic using a specific community ID. This configuration is part of the route propagation control. ```plaintext # Keep traffic within Asia only 203314:2:1 # Disable cross-region ``` -------------------------------- ### JunOS No Upstream and Prepend Configuration Source: https://hatsnet.io/docs/docs/community/control-communities Configuring no-upstream and 3x prepend communities in JunOS. ```junos set policy-options community HATS-NO-UPSTREAM members large:203314:1:0 set policy-options community HATS-PREPEND-3X members large:203314:220:3 set policy-options policy-statement EXPORT-TO-HATS term BACKUP from route-filter 203.0.113.0/24 exact set policy-options policy-statement EXPORT-TO-HATS term BACKUP then community add [ HATS-NO-UPSTREAM HATS-PREPEND-3X ] set policy-options policy-statement EXPORT-TO-HATS term BACKUP then accept set policy-options policy-statement EXPORT-TO-HATS term REJECT-ALL then reject ``` -------------------------------- ### JunOS Configuration Snippet Source: https://hatsnet.io/docs/docs/community/region-codes Example configuration for JunOS to filter BGP communities based on region. This snippet demonstrates how to define and apply community-based filtering policies. ```junos set policy-options community AS203314:130 members \"203314:130:XX\" set policy-options community AS203314:201 members \"203314:201:XX\" ```