You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Exclude rules allow you to prevent specific traffic from undergoing NAT translation. This is particularly useful for:
351
+
352
+
* **Router management**: Allowing SSH access to the router itself from external networks
353
+
* **Service bypass**: Excluding specific services from NAT processing
354
+
* **Traffic forwarding**: Allowing forwarded traffic to bypass NAT with 1-to-1 mapping
355
+
356
+
Exclude rules take precedence over both dynamic and static NAT rules, ensuring that matching traffic bypasses NAT processing. For forwarded traffic, exclude rules create invisible 1-to-1 mappings that allow packets to pass through without NAT modifications.
357
+
358
+
Basic Exclude Rule Configuration
359
+
--------------------------------
360
+
361
+
To create an exclude rule, you need to specify the traffic characteristics that should bypass NAT. You can configure exclude rules in two ways:
362
+
363
+
**Option 1: Using local address**
364
+
365
+
.. cfgcmd::
366
+
367
+
set vpp nat44 exclude rule <rule-number> local-address <internal-ip>
368
+
369
+
**Option 2: Using external interface**
370
+
371
+
.. cfgcmd::
372
+
373
+
set vpp nat44 exclude rule <rule-number> external-interface <interface-name>
374
+
375
+
Where:
376
+
377
+
* ``<rule-number>`` is a unique identifier for the exclude rule
378
+
* ``<internal-ip>`` is the local IP address that should be excluded from NAT
379
+
* ``<interface-name>`` is the external interface where the traffic originates
380
+
381
+
.. important::
382
+
383
+
You must use either ``local-address`` OR ``external-interface`` in an exclude rule, but not both simultaneously. These options are mutually exclusive.
384
+
385
+
Port-specific Exclude Rules
386
+
---------------------------
387
+
388
+
For more granular control, you can exclude only specific ports and protocols. You can combine port and protocol specifications with either local-address or external-interface:
389
+
390
+
**With local address:**
391
+
392
+
.. cfgcmd::
393
+
394
+
set vpp nat44 exclude rule <rule-number> local-address <internal-ip>
395
+
396
+
.. cfgcmd::
397
+
398
+
set vpp nat44 exclude rule <rule-number> local-port <port-number>
399
+
400
+
.. cfgcmd::
401
+
402
+
set vpp nat44 exclude rule <rule-number> protocol <protocol>
403
+
404
+
**With external interface:**
405
+
406
+
.. cfgcmd::
407
+
408
+
set vpp nat44 exclude rule <rule-number> external-interface <interface-name>
409
+
410
+
.. cfgcmd::
411
+
412
+
set vpp nat44 exclude rule <rule-number> local-port <port-number>
413
+
414
+
.. cfgcmd::
415
+
416
+
set vpp nat44 exclude rule <rule-number> protocol <protocol>
417
+
418
+
Where:
419
+
420
+
* ``<port-number>`` is the specific port to exclude (1-65535)
421
+
* ``<protocol>`` can be ``tcp``, ``udp``, ``icmp``, or ``all`` (default)
422
+
423
+
Rule Documentation
424
+
------------------
425
+
426
+
Add descriptions to your exclude rules for better management:
427
+
428
+
.. cfgcmd::
429
+
430
+
set vpp nat44 exclude rule <rule-number> description <description>
431
+
432
+
Exclude Rules Configuration Examples
433
+
------------------------------------
434
+
435
+
**Exclude SSH access to router:**
436
+
437
+
.. code-block:: none
438
+
439
+
# Allow external SSH access to router without NAT
440
+
set vpp nat44 exclude rule 10 local-address 192.168.1.1
441
+
set vpp nat44 exclude rule 10 local-port 22
442
+
set vpp nat44 exclude rule 10 protocol tcp
443
+
set vpp nat44 exclude rule 10 description "SSH access to router"
444
+
445
+
**Exclude SNMP monitoring:**
446
+
447
+
.. code-block:: none
448
+
449
+
# Allow SNMP monitoring without NAT translation
450
+
set vpp nat44 exclude rule 20 local-port 161
451
+
set vpp nat44 exclude rule 20 protocol udp
452
+
set vpp nat44 exclude rule 20 external-interface eth1
453
+
set vpp nat44 exclude rule 20 description "SNMP monitoring"
454
+
455
+
**Exclude all traffic to router management interface:**
456
+
457
+
.. code-block:: none
458
+
459
+
# Exclude all traffic to router's management IP
460
+
set vpp nat44 exclude rule 30 local-address 192.168.100.1
461
+
set vpp nat44 exclude rule 30 description "Management interface bypass"
462
+
463
+
**Exclude all traffic from external interface:**
464
+
465
+
.. code-block:: none
466
+
467
+
# Exclude all traffic from external interface (alternative approach)
468
+
set vpp nat44 exclude rule 31 external-interface eth1
469
+
set vpp nat44 exclude rule 31 description "External interface bypass"
470
+
471
+
**Exclude forwarded traffic for specific service:**
472
+
473
+
.. code-block:: none
474
+
475
+
# Allow external access to internal server without NAT translation
476
+
set vpp nat44 exclude rule 40 local-address 192.168.1.50
477
+
set vpp nat44 exclude rule 40 local-port 8080
478
+
set vpp nat44 exclude rule 40 protocol tcp
479
+
set vpp nat44 exclude rule 40 description "Direct access to internal service"
480
+
481
+
Common Use Cases
482
+
----------------
483
+
484
+
**Router Administration:**
485
+
486
+
Exclude rules are essential when you need to manage the router from external networks. Without exclude rules, NAT would attempt to translate the router's own traffic, potentially breaking management connections.
487
+
488
+
**Service Monitoring:**
489
+
490
+
Network monitoring systems often need direct access to router services. Exclude rules ensure that monitoring traffic bypasses NAT translation.
491
+
492
+
**Routing Protocols:**
493
+
494
+
Some routing protocols or network services may require direct communication without NAT interference.
495
+
496
+
**Traffic Forwarding:**
497
+
498
+
Exclude rules also work for forwarded traffic between networks. Without exclude rules, traffic from external to local networks must either match a static rule or be dropped. With exclude rules, traffic can bypass NAT processing with invisible 1-to-1 mappings.
499
+
500
+
.. important::
501
+
502
+
Exclude rules affect both traffic destined for the router itself and forwarded traffic flowing through the router. For forwarded traffic, exclude rules create transparent 1-to-1 mappings that allow packets to pass without NAT modifications, while from the outside perspective, the traffic appears to bypass NAT entirely.
503
+
341
504
Advanced NAT44 Settings
342
505
=======================
343
506
@@ -466,6 +629,17 @@ Here's a complete example showing how to configure VyOS NAT44 for a typical netw
466
629
set vpp nat44 address-pool translation address 203.0.113.10-203.0.113.50
467
630
set vpp nat44 address-pool twice-nat address 203.0.113.100-203.0.113.110
468
631
632
+
# Exclude rules for router management
633
+
set vpp nat44 exclude rule 10 local-address 203.0.113.1
634
+
set vpp nat44 exclude rule 10 local-port 22
635
+
set vpp nat44 exclude rule 10 protocol tcp
636
+
set vpp nat44 exclude rule 10 description "SSH access to router"
637
+
638
+
set vpp nat44 exclude rule 11 local-address 203.0.113.1
639
+
set vpp nat44 exclude rule 11 local-port 443
640
+
set vpp nat44 exclude rule 11 protocol tcp
641
+
set vpp nat44 exclude rule 11 description "HTTPS access to router web interface"
642
+
469
643
# Static rule for web server (HTTP)
470
644
set vpp nat44 static rule 100 local address 192.168.1.10
471
645
set vpp nat44 static rule 100 local port 80
@@ -505,6 +679,7 @@ Best Practices and Troubleshooting
505
679
Recommendations
506
680
---------------
507
681
682
+
* **Use exclude rules** for router management services like SSH
508
683
* **Use out-to-in-only** for services that do not need access to external networks
509
684
* **Limit port ranges** in static rules to only necessary ports
510
685
* **Document all rules** using descriptions for easier management
@@ -526,6 +701,18 @@ Common Configuration Issues
526
701
2. Verify static rules have the correct twice-nat option
527
702
3. Check that both translation and twice-nat pools are properly defined
528
703
704
+
**Router management access issues:**
705
+
706
+
1. Verify exclude rules are configured for management services
707
+
2. Check that local-address matches the router's interface IP
708
+
3. Ensure external-interface is correctly specified
709
+
710
+
**Forwarded traffic from external networks not bypassing NAT:**
711
+
712
+
1. Verify exclude rules are configured for the specific traffic flow
713
+
2. Check that local-address matches the destination IP in the internal network
714
+
3. Ensure protocol and port specifications match the traffic requirements
0 commit comments