network/982_cgnat_migration_commands.rsc
2026-05-08 17:47:42 -05:00

49 lines
No EOL
1.7 KiB
Text

# 982 Router CGNAT Migration Script
# Changes CGNAT from 100.64.32.0/22 to 100.64.48.0/20
# This gives 4x more addresses (1,024 -> 4,096)
#
# IMPORTANT: This will cause a brief service interruption
# Run during maintenance window
#
# Current: 100.64.32.0/22 (100.64.32.1 - 100.64.35.254)
# New: 100.64.48.0/20 (100.64.48.1 - 100.64.63.254)
# Step 1: Add new IP pool (do this first to prepare)
/ip pool add name=cgnat-new ranges=100.64.48.1-100.64.63.199
# Step 2: Add new IP address to the interface
/ip address add address=100.64.63.254/20 interface=982 comment="New CGNAT subnet"
# Step 3: Create new PPP profile pointing to new pool
/ppp profile add name=982-new local-address=100.64.63.253 remote-address=cgnat-new
# Step 4: Update PPPoE server to use new profile
/interface pppoe-server server set [find name=982] default-profile=982-new
# Step 5: Wait for existing sessions to reconnect (they will get new IPs)
# Monitor with: /ppp active print count-only
:delay 30s
# Step 6: Check that clients are getting new IPs
# /ppp active print brief
# Step 7: After confirming all clients have new IPs, remove old configuration
# WARNING: Only run these after confirming migration is successful!
# Remove old IP address
# /ip address remove [find address="100.64.35.254/22"]
# Remove old IP pool
# /ip pool remove [find name=cgnat]
# Remove old PPP profile
# /ppp profile remove [find name=982]
# Step 8: Rename new items to standard names
# /ip pool set [find name=cgnat-new] name=cgnat
# /ppp profile set [find name=982-new] name=982
# Step 9: Update any firewall NAT rules if needed
# Check with: /ip firewall nat print where src-address~"100.64.32"
# Step 10: Update NetBox documentation with new subnet