You won't because the NAT rules are only used when handling the initial packet of each connection. Once chains srcnat and dstnat give their verdicts (instructions) regarding the initial packet, these instructions get stored into the context data of that connection maintained by the conn(ection)track(ing) module, and all subsequent packets of the same connection are handled the same or reverse way depending on their direction. And the CPU load of this handling of mid-connection packets is always the same no matter how complex it was to find the instruction for the initial packet.I just hope I don't kill it with a full NAT444 configuration.
anav.Excuse my ignorance TOM, but do you mean that customers are limited to access only X number of ports (inbound and outbound)? Put in another way they can only run servers on a choice of 8000 ports or is this simply an allocation schema for WANIP and port association to the WANIP. I have no clue in general and even less about CGNAT.
Not just port 80 - all of them have to access port 80 at the same remote IP address to get into trouble (hit the limit of N ports in a common pool).Understood if the problem is exacerbated by that CGN address being shared by 10 households then you quickly get into a problem if all attempting to use port 80 ??
/ip firewall nat
add action=jump chain=srcnat jump-target=000001-CGN src-address=100.64.0.0/18 comment=/18
add action=jump chain=000001-CGN jump-target=000010-CGN src-address=100.64.0.0/19 comment=/19
add action=jump chain=000001-CGN jump-target=000011-CGN src-address=100.64.32.0/19
add action=jump chain=000010-CGN jump-target=000100-CGN src-address=100.64.0.0/20 comment=/20
add action=jump chain=000010-CGN jump-target=000101-CGN src-address=100.64.16.0/20
add action=jump chain=000011-CGN jump-target=000110-CGN src-address=100.64.32.0/20
add action=jump chain=000011-CGN jump-target=000111-CGN src-address=100.64.48.0/20
add action=jump chain=000100-CGN jump-target=001000-CGN src-address=100.64.0.0/21 comment=/21
add action=jump chain=000100-CGN jump-target=001001-CGN src-address=100.64.8.0/21
add action=jump chain=000101-CGN jump-target=001010-CGN src-address=100.64.16.0/21
add action=jump chain=000101-CGN jump-target=001011-CGN src-address=100.64.24.0/21
add action=jump chain=000110-CGN jump-target=001100-CGN src-address=100.64.32.0/21
add action=jump chain=000110-CGN jump-target=001101-CGN src-address=100.64.40.0/21
add action=jump chain=000111-CGN jump-target=001110-CGN src-address=100.64.48.0/21
add action=jump chain=000111-CGN jump-target=001111-CGN src-address=100.64.56.0/21
add action=jump chain=001000-CGN jump-target=010000-CGN src-address=100.64.0.0/22 comment=/22
add action=jump chain=001000-CGN jump-target=010001-CGN src-address=100.64.4.0/22
add action=jump chain=001001-CGN jump-target=010010-CGN src-address=100.64.8.0/22
add action=jump chain=001001-CGN jump-target=010011-CGN src-address=100.64.12.0/22
add action=jump chain=001010-CGN jump-target=010100-CGN src-address=100.64.16.0/22
add action=jump chain=001010-CGN jump-target=010101-CGN src-address=100.64.20.0/22
add action=jump chain=001011-CGN jump-target=010110-CGN src-address=100.64.24.0/22
add action=jump chain=001011-CGN jump-target=010111-CGN src-address=100.64.28.0/22
add action=jump chain=001100-CGN jump-target=011000-CGN src-address=100.64.32.0/22
add action=jump chain=001100-CGN jump-target=011001-CGN src-address=100.64.36.0/22
add action=jump chain=001101-CGN jump-target=011010-CGN src-address=100.64.40.0/22
add action=jump chain=001101-CGN jump-target=011011-CGN src-address=100.64.44.0/22
add action=jump chain=001110-CGN jump-target=011100-CGN src-address=100.64.48.0/22
add action=jump chain=001110-CGN jump-target=011101-CGN src-address=100.64.52.0/22
add action=jump chain=001111-CGN jump-target=011110-CGN src-address=100.64.56.0/22
add action=jump chain=001111-CGN jump-target=011111-CGN src-address=100.64.60.0/22
add action=jump chain=010000-CGN jump-target=100000-CGN src-address=100.64.0.0/23 comment=/23
add action=jump chain=010000-CGN jump-target=100001-CGN src-address=100.64.2.0/23
add action=jump chain=010001-CGN jump-target=100010-CGN src-address=100.64.4.0/23
add action=jump chain=010001-CGN jump-target=100011-CGN src-address=100.64.6.0/23
add action=jump chain=010010-CGN jump-target=100100-CGN src-address=100.64.8.0/23
add action=jump chain=010010-CGN jump-target=100101-CGN src-address=100.64.10.0/23
add action=jump chain=010011-CGN jump-target=100110-CGN src-address=100.64.12.0/23
add action=jump chain=010011-CGN jump-target=100111-CGN src-address=100.64.14.0/23
add action=jump chain=010100-CGN jump-target=101000-CGN src-address=100.64.16.0/23
add action=jump chain=010100-CGN jump-target=101001-CGN src-address=100.64.18.0/23
add action=jump chain=010101-CGN jump-target=101010-CGN src-address=100.64.20.0/23
add action=jump chain=010101-CGN jump-target=101011-CGN src-address=100.64.22.0/23
add action=jump chain=010110-CGN jump-target=101100-CGN src-address=100.64.24.0/23
add action=jump chain=010110-CGN jump-target=101101-CGN src-address=100.64.26.0/23
add action=jump chain=010111-CGN jump-target=101110-CGN src-address=100.64.28.0/23
add action=jump chain=010111-CGN jump-target=101111-CGN src-address=100.64.30.0/23
add action=jump chain=011000-CGN jump-target=110000-CGN src-address=100.64.32.0/23
add action=jump chain=011000-CGN jump-target=110001-CGN src-address=100.64.34.0/23
add action=jump chain=011001-CGN jump-target=110010-CGN src-address=100.64.36.0/23
add action=jump chain=011001-CGN jump-target=110011-CGN src-address=100.64.38.0/23
add action=jump chain=011010-CGN jump-target=110100-CGN src-address=100.64.40.0/23
add action=jump chain=011010-CGN jump-target=110101-CGN src-address=100.64.42.0/23
add action=jump chain=011011-CGN jump-target=110110-CGN src-address=100.64.44.0/23
add action=jump chain=011011-CGN jump-target=110111-CGN src-address=100.64.46.0/23
add action=jump chain=011100-CGN jump-target=111000-CGN src-address=100.64.48.0/23
add action=jump chain=011100-CGN jump-target=111001-CGN src-address=100.64.50.0/23
add action=jump chain=011101-CGN jump-target=111010-CGN src-address=100.64.52.0/23
add action=jump chain=011101-CGN jump-target=111011-CGN src-address=100.64.54.0/23
add action=jump chain=011110-CGN jump-target=111100-CGN src-address=100.64.56.0/23
add action=jump chain=011110-CGN jump-target=111101-CGN src-address=100.64.58.0/23
add action=jump chain=011111-CGN jump-target=111110-CGN src-address=100.64.60.0/23
add action=jump chain=011111-CGN jump-target=111111-CGN src-address=100.64.62.0/23
add action=netmap chain=100000-CGN protocol=tcp src-address=100.64.0.0/24 to-addresses=3.2.1.0/24 to-ports=1024-2031 comment=/24
add action=netmap chain=100000-CGN protocol=tcp src-address=100.64.1.0/24 to-addresses=3.2.1.0/24 to-ports=2032-3039
add action=netmap chain=100001-CGN protocol=tcp src-address=100.64.2.0/24 to-addresses=3.2.1.0/24 to-ports=3040-4047
add action=netmap chain=100001-CGN protocol=tcp src-address=100.64.3.0/24 to-addresses=3.2.1.0/24 to-ports=4048-5055
add action=netmap chain=100010-CGN protocol=tcp src-address=100.64.4.0/24 to-addresses=3.2.1.0/24 to-ports=5056-6063
add action=netmap chain=100010-CGN protocol=tcp src-address=100.64.5.0/24 to-addresses=3.2.1.0/24 to-ports=6064-7071
add action=netmap chain=100011-CGN protocol=tcp src-address=100.64.6.0/24 to-addresses=3.2.1.0/24 to-ports=7072-8079
add action=netmap chain=100011-CGN protocol=tcp src-address=100.64.7.0/24 to-addresses=3.2.1.0/24 to-ports=8080-9087
add action=netmap chain=100100-CGN protocol=tcp src-address=100.64.8.0/24 to-addresses=3.2.1.0/24 to-ports=9088-10095
add action=netmap chain=100100-CGN protocol=tcp src-address=100.64.9.0/24 to-addresses=3.2.1.0/24 to-ports=10096-11103
add action=netmap chain=100101-CGN protocol=tcp src-address=100.64.10.0/24 to-addresses=3.2.1.0/24 to-ports=11104-12111
add action=netmap chain=100101-CGN protocol=tcp src-address=100.64.11.0/24 to-addresses=3.2.1.0/24 to-ports=12112-13119
add action=netmap chain=100110-CGN protocol=tcp src-address=100.64.12.0/24 to-addresses=3.2.1.0/24 to-ports=13120-14127
add action=netmap chain=100110-CGN protocol=tcp src-address=100.64.13.0/24 to-addresses=3.2.1.0/24 to-ports=14128-15135
add action=netmap chain=100111-CGN protocol=tcp src-address=100.64.14.0/24 to-addresses=3.2.1.0/24 to-ports=15136-16143
add action=netmap chain=100111-CGN protocol=tcp src-address=100.64.15.0/24 to-addresses=3.2.1.0/24 to-ports=16144-17151
add action=netmap chain=101000-CGN protocol=tcp src-address=100.64.16.0/24 to-addresses=3.2.1.0/24 to-ports=17152-18159
add action=netmap chain=101000-CGN protocol=tcp src-address=100.64.17.0/24 to-addresses=3.2.1.0/24 to-ports=18160-19167
add action=netmap chain=101001-CGN protocol=tcp src-address=100.64.18.0/24 to-addresses=3.2.1.0/24 to-ports=19168-20175
add action=netmap chain=101001-CGN protocol=tcp src-address=100.64.19.0/24 to-addresses=3.2.1.0/24 to-ports=20176-21183
add action=netmap chain=101010-CGN protocol=tcp src-address=100.64.20.0/24 to-addresses=3.2.1.0/24 to-ports=21184-22191
add action=netmap chain=101010-CGN protocol=tcp src-address=100.64.21.0/24 to-addresses=3.2.1.0/24 to-ports=22192-23199
add action=netmap chain=101011-CGN protocol=tcp src-address=100.64.22.0/24 to-addresses=3.2.1.0/24 to-ports=23200-24207
add action=netmap chain=101011-CGN protocol=tcp src-address=100.64.23.0/24 to-addresses=3.2.1.0/24 to-ports=24208-25215
add action=netmap chain=101100-CGN protocol=tcp src-address=100.64.24.0/24 to-addresses=3.2.1.0/24 to-ports=25216-26223
add action=netmap chain=101100-CGN protocol=tcp src-address=100.64.25.0/24 to-addresses=3.2.1.0/24 to-ports=26224-27231
add action=netmap chain=101101-CGN protocol=tcp src-address=100.64.26.0/24 to-addresses=3.2.1.0/24 to-ports=27232-28239
add action=netmap chain=101101-CGN protocol=tcp src-address=100.64.27.0/24 to-addresses=3.2.1.0/24 to-ports=28240-29247
add action=netmap chain=101110-CGN protocol=tcp src-address=100.64.28.0/24 to-addresses=3.2.1.0/24 to-ports=29248-30255
add action=netmap chain=101110-CGN protocol=tcp src-address=100.64.29.0/24 to-addresses=3.2.1.0/24 to-ports=30256-31263
add action=netmap chain=101111-CGN protocol=tcp src-address=100.64.30.0/24 to-addresses=3.2.1.0/24 to-ports=31264-32271
add action=netmap chain=101111-CGN protocol=tcp src-address=100.64.31.0/24 to-addresses=3.2.1.0/24 to-ports=32272-33279
add action=netmap chain=110000-CGN protocol=tcp src-address=100.64.32.0/24 to-addresses=3.2.1.0/24 to-ports=33280-34287
add action=netmap chain=110000-CGN protocol=tcp src-address=100.64.33.0/24 to-addresses=3.2.1.0/24 to-ports=34288-35295
add action=netmap chain=110001-CGN protocol=tcp src-address=100.64.34.0/24 to-addresses=3.2.1.0/24 to-ports=35296-36303
add action=netmap chain=110001-CGN protocol=tcp src-address=100.64.35.0/24 to-addresses=3.2.1.0/24 to-ports=36304-37311
add action=netmap chain=110010-CGN protocol=tcp src-address=100.64.36.0/24 to-addresses=3.2.1.0/24 to-ports=37312-38319
add action=netmap chain=110010-CGN protocol=tcp src-address=100.64.37.0/24 to-addresses=3.2.1.0/24 to-ports=38320-39327
add action=netmap chain=110011-CGN protocol=tcp src-address=100.64.38.0/24 to-addresses=3.2.1.0/24 to-ports=39328-40335
add action=netmap chain=110011-CGN protocol=tcp src-address=100.64.39.0/24 to-addresses=3.2.1.0/24 to-ports=40336-41343
add action=netmap chain=110100-CGN protocol=tcp src-address=100.64.40.0/24 to-addresses=3.2.1.0/24 to-ports=41344-42352
add action=netmap chain=110100-CGN protocol=tcp src-address=100.64.41.0/24 to-addresses=3.2.1.0/24 to-ports=42352-43359
add action=netmap chain=110101-CGN protocol=tcp src-address=100.64.42.0/24 to-addresses=3.2.1.0/24 to-ports=43360-44367
add action=netmap chain=110101-CGN protocol=tcp src-address=100.64.43.0/24 to-addresses=3.2.1.0/24 to-ports=44368-45375
add action=netmap chain=110110-CGN protocol=tcp src-address=100.64.44.0/24 to-addresses=3.2.1.0/24 to-ports=45376-46383
add action=netmap chain=110110-CGN protocol=tcp src-address=100.64.45.0/24 to-addresses=3.2.1.0/24 to-ports=46384-47391
add action=netmap chain=110111-CGN protocol=tcp src-address=100.64.46.0/24 to-addresses=3.2.1.0/24 to-ports=47392-48399
add action=netmap chain=110111-CGN protocol=tcp src-address=100.64.47.0/24 to-addresses=3.2.1.0/24 to-ports=48400-49407
add action=netmap chain=111000-CGN protocol=tcp src-address=100.64.48.0/24 to-addresses=3.2.1.0/24 to-ports=49408-50415
add action=netmap chain=111000-CGN protocol=tcp src-address=100.64.49.0/24 to-addresses=3.2.1.0/24 to-ports=50416-51423
add action=netmap chain=111001-CGN protocol=tcp src-address=100.64.50.0/24 to-addresses=3.2.1.0/24 to-ports=51424-52431
add action=netmap chain=111001-CGN protocol=tcp src-address=100.64.51.0/24 to-addresses=3.2.1.0/24 to-ports=52432-53439
add action=netmap chain=111010-CGN protocol=tcp src-address=100.64.52.0/24 to-addresses=3.2.1.0/24 to-ports=53440-54447
add action=netmap chain=111010-CGN protocol=tcp src-address=100.64.53.0/24 to-addresses=3.2.1.0/24 to-ports=54448-55455
add action=netmap chain=111011-CGN protocol=tcp src-address=100.64.54.0/24 to-addresses=3.2.1.0/24 to-ports=55456-56463
add action=netmap chain=111011-CGN protocol=tcp src-address=100.64.55.0/24 to-addresses=3.2.1.0/24 to-ports=56464-57471
add action=netmap chain=111100-CGN protocol=tcp src-address=100.64.56.0/24 to-addresses=3.2.1.0/24 to-ports=57472-58479
add action=netmap chain=111100-CGN protocol=tcp src-address=100.64.57.0/24 to-addresses=3.2.1.0/24 to-ports=58480-59487
add action=netmap chain=111101-CGN protocol=tcp src-address=100.64.58.0/24 to-addresses=3.2.1.0/24 to-ports=59488-60495
add action=netmap chain=111101-CGN protocol=tcp src-address=100.64.59.0/24 to-addresses=3.2.1.0/24 to-ports=60496-61503
add action=netmap chain=111110-CGN protocol=tcp src-address=100.64.60.0/24 to-addresses=3.2.1.0/24 to-ports=61504-62511
add action=netmap chain=111110-CGN protocol=tcp src-address=100.64.61.0/24 to-addresses=3.2.1.0/24 to-ports=62512-63519
add action=netmap chain=111111-CGN protocol=tcp src-address=100.64.62.0/24 to-addresses=3.2.1.0/24 to-ports=63520-64527
add action=netmap chain=111111-CGN protocol=tcp src-address=100.64.63.0/24 to-addresses=3.2.1.0/24 to-ports=64528-65535
add action=netmap chain=100000-CGN protocol=udp src-address=100.64.0.0/24 to-addresses=3.2.1.0/24 to-ports=1024-2031
add action=netmap chain=100000-CGN protocol=udp src-address=100.64.1.0/24 to-addresses=3.2.1.0/24 to-ports=2032-3039
add action=netmap chain=100001-CGN protocol=udp src-address=100.64.2.0/24 to-addresses=3.2.1.0/24 to-ports=3040-4047
add action=netmap chain=100001-CGN protocol=udp src-address=100.64.3.0/24 to-addresses=3.2.1.0/24 to-ports=4048-5055
add action=netmap chain=100010-CGN protocol=udp src-address=100.64.4.0/24 to-addresses=3.2.1.0/24 to-ports=5056-6063
add action=netmap chain=100010-CGN protocol=udp src-address=100.64.5.0/24 to-addresses=3.2.1.0/24 to-ports=6064-7071
add action=netmap chain=100011-CGN protocol=udp src-address=100.64.6.0/24 to-addresses=3.2.1.0/24 to-ports=7072-8079
add action=netmap chain=100011-CGN protocol=udp src-address=100.64.7.0/24 to-addresses=3.2.1.0/24 to-ports=8080-9087
add action=netmap chain=100100-CGN protocol=udp src-address=100.64.8.0/24 to-addresses=3.2.1.0/24 to-ports=9088-10095
add action=netmap chain=100100-CGN protocol=udp src-address=100.64.9.0/24 to-addresses=3.2.1.0/24 to-ports=10096-11103
add action=netmap chain=100101-CGN protocol=udp src-address=100.64.10.0/24 to-addresses=3.2.1.0/24 to-ports=11104-12111
add action=netmap chain=100101-CGN protocol=udp src-address=100.64.11.0/24 to-addresses=3.2.1.0/24 to-ports=12112-13119
add action=netmap chain=100110-CGN protocol=udp src-address=100.64.12.0/24 to-addresses=3.2.1.0/24 to-ports=13120-14127
add action=netmap chain=100110-CGN protocol=udp src-address=100.64.13.0/24 to-addresses=3.2.1.0/24 to-ports=14128-15135
add action=netmap chain=100111-CGN protocol=udp src-address=100.64.14.0/24 to-addresses=3.2.1.0/24 to-ports=15136-16143
add action=netmap chain=100111-CGN protocol=udp src-address=100.64.15.0/24 to-addresses=3.2.1.0/24 to-ports=16144-17151
add action=netmap chain=101000-CGN protocol=udp src-address=100.64.16.0/24 to-addresses=3.2.1.0/24 to-ports=17152-18159
add action=netmap chain=101000-CGN protocol=udp src-address=100.64.17.0/24 to-addresses=3.2.1.0/24 to-ports=18160-19167
add action=netmap chain=101001-CGN protocol=udp src-address=100.64.18.0/24 to-addresses=3.2.1.0/24 to-ports=19168-20175
add action=netmap chain=101001-CGN protocol=udp src-address=100.64.19.0/24 to-addresses=3.2.1.0/24 to-ports=20176-21183
add action=netmap chain=101010-CGN protocol=udp src-address=100.64.20.0/24 to-addresses=3.2.1.0/24 to-ports=21184-22191
add action=netmap chain=101010-CGN protocol=udp src-address=100.64.21.0/24 to-addresses=3.2.1.0/24 to-ports=22192-23199
add action=netmap chain=101011-CGN protocol=udp src-address=100.64.22.0/24 to-addresses=3.2.1.0/24 to-ports=23200-24207
add action=netmap chain=101011-CGN protocol=udp src-address=100.64.23.0/24 to-addresses=3.2.1.0/24 to-ports=24208-25215
add action=netmap chain=101100-CGN protocol=udp src-address=100.64.24.0/24 to-addresses=3.2.1.0/24 to-ports=25216-26223
add action=netmap chain=101100-CGN protocol=udp src-address=100.64.25.0/24 to-addresses=3.2.1.0/24 to-ports=26224-27231
add action=netmap chain=101101-CGN protocol=udp src-address=100.64.26.0/24 to-addresses=3.2.1.0/24 to-ports=27232-28239
add action=netmap chain=101101-CGN protocol=udp src-address=100.64.27.0/24 to-addresses=3.2.1.0/24 to-ports=28240-29247
add action=netmap chain=101110-CGN protocol=udp src-address=100.64.28.0/24 to-addresses=3.2.1.0/24 to-ports=29248-30255
add action=netmap chain=101110-CGN protocol=udp src-address=100.64.29.0/24 to-addresses=3.2.1.0/24 to-ports=30256-31263
add action=netmap chain=101111-CGN protocol=udp src-address=100.64.30.0/24 to-addresses=3.2.1.0/24 to-ports=31264-32271
add action=netmap chain=101111-CGN protocol=udp src-address=100.64.31.0/24 to-addresses=3.2.1.0/24 to-ports=32272-33279
add action=netmap chain=110000-CGN protocol=udp src-address=100.64.32.0/24 to-addresses=3.2.1.0/24 to-ports=33280-34287
add action=netmap chain=110000-CGN protocol=udp src-address=100.64.33.0/24 to-addresses=3.2.1.0/24 to-ports=34288-35295
add action=netmap chain=110001-CGN protocol=udp src-address=100.64.34.0/24 to-addresses=3.2.1.0/24 to-ports=35296-36303
add action=netmap chain=110001-CGN protocol=udp src-address=100.64.35.0/24 to-addresses=3.2.1.0/24 to-ports=36304-37311
add action=netmap chain=110010-CGN protocol=udp src-address=100.64.36.0/24 to-addresses=3.2.1.0/24 to-ports=37312-38319
add action=netmap chain=110010-CGN protocol=udp src-address=100.64.37.0/24 to-addresses=3.2.1.0/24 to-ports=38320-39327
add action=netmap chain=110011-CGN protocol=udp src-address=100.64.38.0/24 to-addresses=3.2.1.0/24 to-ports=39328-40335
add action=netmap chain=110011-CGN protocol=udp src-address=100.64.39.0/24 to-addresses=3.2.1.0/24 to-ports=40336-41343
add action=netmap chain=110100-CGN protocol=udp src-address=100.64.40.0/24 to-addresses=3.2.1.0/24 to-ports=41344-42352
add action=netmap chain=110100-CGN protocol=udp src-address=100.64.41.0/24 to-addresses=3.2.1.0/24 to-ports=42352-43359
add action=netmap chain=110101-CGN protocol=udp src-address=100.64.42.0/24 to-addresses=3.2.1.0/24 to-ports=43360-44367
add action=netmap chain=110101-CGN protocol=udp src-address=100.64.43.0/24 to-addresses=3.2.1.0/24 to-ports=44368-45375
add action=netmap chain=110110-CGN protocol=udp src-address=100.64.44.0/24 to-addresses=3.2.1.0/24 to-ports=45376-46383
add action=netmap chain=110110-CGN protocol=udp src-address=100.64.45.0/24 to-addresses=3.2.1.0/24 to-ports=46384-47391
add action=netmap chain=110111-CGN protocol=udp src-address=100.64.46.0/24 to-addresses=3.2.1.0/24 to-ports=47392-48399
add action=netmap chain=110111-CGN protocol=udp src-address=100.64.47.0/24 to-addresses=3.2.1.0/24 to-ports=48400-49407
add action=netmap chain=111000-CGN protocol=udp src-address=100.64.48.0/24 to-addresses=3.2.1.0/24 to-ports=49408-50415
add action=netmap chain=111000-CGN protocol=udp src-address=100.64.49.0/24 to-addresses=3.2.1.0/24 to-ports=50416-51423
add action=netmap chain=111001-CGN protocol=udp src-address=100.64.50.0/24 to-addresses=3.2.1.0/24 to-ports=51424-52431
add action=netmap chain=111001-CGN protocol=udp src-address=100.64.51.0/24 to-addresses=3.2.1.0/24 to-ports=52432-53439
add action=netmap chain=111010-CGN protocol=udp src-address=100.64.52.0/24 to-addresses=3.2.1.0/24 to-ports=53440-54447
add action=netmap chain=111010-CGN protocol=udp src-address=100.64.53.0/24 to-addresses=3.2.1.0/24 to-ports=54448-55455
add action=netmap chain=111011-CGN protocol=udp src-address=100.64.54.0/24 to-addresses=3.2.1.0/24 to-ports=55456-56463
add action=netmap chain=111011-CGN protocol=udp src-address=100.64.55.0/24 to-addresses=3.2.1.0/24 to-ports=56464-57471
add action=netmap chain=111100-CGN protocol=udp src-address=100.64.56.0/24 to-addresses=3.2.1.0/24 to-ports=57472-58479
add action=netmap chain=111100-CGN protocol=udp src-address=100.64.57.0/24 to-addresses=3.2.1.0/24 to-ports=58480-59487
add action=netmap chain=111101-CGN protocol=udp src-address=100.64.58.0/24 to-addresses=3.2.1.0/24 to-ports=59488-60495
add action=netmap chain=111101-CGN protocol=udp src-address=100.64.59.0/24 to-addresses=3.2.1.0/24 to-ports=60496-61503
add action=netmap chain=111110-CGN protocol=udp src-address=100.64.60.0/24 to-addresses=3.2.1.0/24 to-ports=61504-62511
add action=netmap chain=111110-CGN protocol=udp src-address=100.64.61.0/24 to-addresses=3.2.1.0/24 to-ports=62512-63519
add action=netmap chain=111111-CGN protocol=udp src-address=100.64.62.0/24 to-addresses=3.2.1.0/24 to-ports=63520-64527
add action=netmap chain=111111-CGN protocol=udp src-address=100.64.63.0/24 to-addresses=3.2.1.0/24 to-ports=64528-65535
add action=netmap chain=100000-CGN protocol=icmp src-address=100.64.0.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100000-CGN protocol=icmp src-address=100.64.1.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100001-CGN protocol=icmp src-address=100.64.2.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100001-CGN protocol=icmp src-address=100.64.3.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100010-CGN protocol=icmp src-address=100.64.4.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100010-CGN protocol=icmp src-address=100.64.5.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100011-CGN protocol=icmp src-address=100.64.6.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100011-CGN protocol=icmp src-address=100.64.7.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100100-CGN protocol=icmp src-address=100.64.8.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100100-CGN protocol=icmp src-address=100.64.9.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100101-CGN protocol=icmp src-address=100.64.10.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100101-CGN protocol=icmp src-address=100.64.11.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100110-CGN protocol=icmp src-address=100.64.12.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100110-CGN protocol=icmp src-address=100.64.13.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100111-CGN protocol=icmp src-address=100.64.14.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=100111-CGN protocol=icmp src-address=100.64.15.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101000-CGN protocol=icmp src-address=100.64.16.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101000-CGN protocol=icmp src-address=100.64.17.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101001-CGN protocol=icmp src-address=100.64.18.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101001-CGN protocol=icmp src-address=100.64.19.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101010-CGN protocol=icmp src-address=100.64.20.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101010-CGN protocol=icmp src-address=100.64.21.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101011-CGN protocol=icmp src-address=100.64.22.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101011-CGN protocol=icmp src-address=100.64.23.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101100-CGN protocol=icmp src-address=100.64.24.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101100-CGN protocol=icmp src-address=100.64.25.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101101-CGN protocol=icmp src-address=100.64.26.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101101-CGN protocol=icmp src-address=100.64.27.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101110-CGN protocol=icmp src-address=100.64.28.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101110-CGN protocol=icmp src-address=100.64.29.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101111-CGN protocol=icmp src-address=100.64.30.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=101111-CGN protocol=icmp src-address=100.64.31.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110000-CGN protocol=icmp src-address=100.64.32.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110000-CGN protocol=icmp src-address=100.64.33.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110001-CGN protocol=icmp src-address=100.64.34.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110001-CGN protocol=icmp src-address=100.64.35.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110010-CGN protocol=icmp src-address=100.64.36.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110010-CGN protocol=icmp src-address=100.64.37.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110011-CGN protocol=icmp src-address=100.64.38.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110011-CGN protocol=icmp src-address=100.64.39.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110100-CGN protocol=icmp src-address=100.64.40.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110100-CGN protocol=icmp src-address=100.64.41.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110101-CGN protocol=icmp src-address=100.64.42.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110101-CGN protocol=icmp src-address=100.64.43.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110110-CGN protocol=icmp src-address=100.64.44.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110110-CGN protocol=icmp src-address=100.64.45.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110111-CGN protocol=icmp src-address=100.64.46.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=110111-CGN protocol=icmp src-address=100.64.47.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111000-CGN protocol=icmp src-address=100.64.48.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111000-CGN protocol=icmp src-address=100.64.49.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111001-CGN protocol=icmp src-address=100.64.50.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111001-CGN protocol=icmp src-address=100.64.51.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111010-CGN protocol=icmp src-address=100.64.52.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111010-CGN protocol=icmp src-address=100.64.53.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111011-CGN protocol=icmp src-address=100.64.54.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111011-CGN protocol=icmp src-address=100.64.55.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111100-CGN protocol=icmp src-address=100.64.56.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111100-CGN protocol=icmp src-address=100.64.57.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111101-CGN protocol=icmp src-address=100.64.58.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111101-CGN protocol=icmp src-address=100.64.59.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111110-CGN protocol=icmp src-address=100.64.60.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111110-CGN protocol=icmp src-address=100.64.61.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111111-CGN protocol=icmp src-address=100.64.62.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=111111-CGN protocol=icmp src-address=100.64.63.0/24 to-addresses=3.2.1.0/24
add action=netmap chain=srcnat src-address=100.64.0.0/18 to-addresses=3.2.1.0/24
/ip firewall connection tracking
set generic-timeout=1m tcp-established-timeout=1h tcp-max-retrans-timeout=1m tcp-unacked-timeout=1m udp-stream-timeout=10s udp-timeout=3m
/system scheduler
add interval=2s name=Clear-DNS on-event="/ip firewall connection remove [find protocol=udp dst-address~\":53\" timeout<2m57s]" policy=ftp,reboot,read,write,policy,test,password,sniff,sensitive,romon start-date=jun/29/2018 start-time=07:46:54
I am re-looking at doing this with Netmap.you really have to have a look at the netmap. single translations will kill your router's cpu.
Netmap for CGNAT is some sort of Brainfuck, sure. But it's worth the effort.
I did some reading on Netmap.you really have to have a look at the netmap. single translations will kill your router's cpu.
Netmap for CGNAT is some sort of Brainfuck, sure. But it's worth the effort.
chain=srcnat src-address=x.x.x.128/25 action=jump jump-target=128.25
chain=srcnat src-address=x.x.x.64/26 action=jump jump-target=64-26
chain=srcnat src-address=x.x.x.32/27 action=jump jump-target=32-27
chain=srcnat src-address=x.x.x.16/28 action=jump jump-target=16-28
chain=srcnat src-address=x.x.x.0 action=src-nat to-addresses=y.y.y.y to-ports=F0-L0
:
chain=srcnat src-address=x.x.x.15 action=src-nat to-addresses=y.y.y.y to-ports=F15-L15
chain=128-25 src-address=x.x.x.192/26 action=jump jump-target=192-26
chain=128-25 src-address=x.x.x.160/27 action=jump jump-target=160-27
chain=128-25 src-address=x.x.x.144/28 action=jump jump-target=144-28
chain=srcnat src-address=x.x.x.128 action=src-nat to-addresses=y.y.y.y to-ports=F128-L128
:
chain=srcnat src-address=x.x.x.143 action=src-nat to-addresses=y.y.y.y to-ports=F143-L143
chain=64-26 src-address=x.x.x.96/27 action=jump jump-target=96-27
chain=64-26 src-address=x.x.x.80/28 action=jump jump-target=80-28
chain=64-26 src-address=x.x.x.64 action=src-nat to-addresses=y.y.y.y to-ports=F64-L64
:
chain=64-26 src-address=x.x.x.79 action=src-nat to-addresses=y.y.y.y to-ports=F79-L79
chain=96-27 src-address=x.x.x.112/28 action=jump jump-target=112-28
chain=96-27 src-address=x.x.x.96 action=src-nat to-addresses=y.y.y.y to-ports=F96-L96
:
chain=96-27 src-address=x.x.x.111 action=src-nat to-addresses=y.y.y.y to-ports=F111-L111
chain=112-28 src-address=x.x.x.112 action=src-nat to-addresses=y.y.y.y to-ports=F112-L112
:
chain=112-28 src-address=x.x.x.127 action=src-nat to-addresses=y.y.y.y to-ports=F127-L127
I don't know if it's the appropriate place to ask, but what happens if a customer consumes too much TCP or UDP ports ?Well - I think I finally got my NAT444 working
It is well in the context of the current topic so I'd say it is OK, but I am neither an admin nor the OP so my opinion is not much significant.I don't know if it's the appropriate place to ask, but what happens if a customer consumes too much TCP or UDP ports ?
Definitely not with a high severity, the new connection just does not get through.1. Is this something that is logged ?
No. In better case (Mikrotik), the TCP connection attempt will just time out, and the browser will show a corresponding error message like "the server did not respond". In worse case (other devices I've seen), the newer connection will succeed but it will break some existing older one. A UDP attempt will also time out and the application will notify the user depending on how it is written. As @sup5 alerts, DNS request may be quite severely affected.2. From end user perspective, does it trigger some 5XX HTTP error code ?
As I wrote to @anav above - you need a number of factors to aggregate in order that a limited pool of ports per source IP address and destination socket address would cause a problem to the source. When normal web browsers open multiple connections for a single page, these rarely open towards the same server. If VOD is "video on demand", the issue would pop up if more devices at customer site would connect to the same server at the "broadcasting" end than the number of ports dedicated for that customer. So I'd personally be most afraid of DNS requests to get affected.3. What are the network usages that consumes the most TCP/UDP ports ? VOD ? Web browsing ?
But still, original and re-used ports are always binded to the very same private IP, right ?Limiting the ports per user does not mean there will be a hard limit of connections=ports. Mikrotik does port-overloading. This means it can re-use the same port for another destination.
Can you elaborate, both above points, please ?Be aware that only 63 concurrent DNS requests are possible, still.
You might also want to aggressively time down your UDP timers in connection tracking, when using such a low amount of ports per user.
Yes. For the same private IP, the same pool of ports is used for all connections.But still, original and re-used ports are always binded to the very same private IP, right ?
I'm closely following this thread as I urgently need to prepare for such notices (One good thing for me is that it is super easy and quick to lookup and identify what customer is being referenced when I now get one of those copyright notices where some customer downloaded a copyrighted movie. These notices provide two pieces of information ( Live-IP-Address and the Port-Number ), With this , it is simple to quickly identify the customer.
I'm closely following this thread as I urgently need to prepare for such notices (One good thing for me is that it is super easy and quick to lookup and identify what customer is being referenced when I now get one of those copyright notices where some customer downloaded a copyrighted movie. These notices provide two pieces of information ( Live-IP-Address and the Port-Number ), With this , it is simple to quickly identify the customer.
In a worst case scenario, if I can't get severaI IP, I would have to NAT traffic from 250 devices into 1 public IP.
In case I can't implement CGN, I was thinking of implementing a NAT-logging system instead, maybe using Netflow.
I'm still hesitating between both routes (logging or CGN).
First of all, I would like to thank you for sharing your experiences here and helping us. I'm currently doing research to switch to nat444 from nat44, and I'm wondering that how do you print all these rules on your CHR , Can you help me to fight with this?
I'm closely following this thread as I urgently need to prepare for such notices (
In a worst case scenario, if I can't get severaI IP, I would have to NAT traffic from 250 devices into 1 public IP.
In case I can't implement CGN, I was thinking of implementing a NAT-logging system instead, maybe using Netflow.
I'm still hesitating between both routes (logging or CGN).
In your worst case scenario - do you have 250 devices on an inside NATted /24 network ?
Do you have an available Live-IP-Address that is not being used at this time ?
If you don't have a un-used IP free available address, then it may be possible to NAT444 to the outside Live-IP-Address of your NAT router. Is this your plan ?
Are you wanting to NAT an inside network that is larger than a /24 ( or multiple /24 networks ) ?
I might be able to make a config and send it to you so that all you have to do is:
- disable the existing nat statements and paste in the new NAT444 statements.
North Idaho Tom Jones
I was talking about this, yes its better to import it to the CHR .rsc or prepare txt file but how do you prepare this files ? do you write them to the txt by your self or any script to create or any web page that create these rules.
I ended up makin a text file and uploaded the text file to the CHR via winbox , then ran the file as a script ( I think my file was a .rsc file ?? ) --- Anyway - that way worked well and pretty fast.
North Idaho Tom Jones
When I created my NAT444.rsc file , I used an txt editor. I first created a base configuration , then pasted in my config , edit the original config then past-append to my rsc file , then repeat many times.I was talking about this, yes its better to import it to the CHR .rsc or prepare txt file but how do you prepare this files ? do you write them to the txt by your self or any script to create or any web page that create these rules.
I ended up makin a text file and uploaded the text file to the CHR via winbox , then ran the file as a script ( I think my file was a .rsc file ?? ) --- Anyway - that way worked well and pretty fast.
North Idaho Tom Jones
how many port do you use for per customer without problem ? at the topic seems that 250 port per ip , still no any problem with 250 port ?
Don't forget to read this:Thank you for sharing, I am starting to do the same process, only by using netmap instead of src-nat, I aim to reduce the number of rules.
Bear in mind that 250 ports per customer actually mean 250 ports per connection to a particular remote socket, so far more than 250 connections per customer in total. There are just a few scenarios where that may still be a limitation - what comes to my mind is that some of your customers would have hundreds of IoT devices talking to the same cloud server. Too many kids watching Youtube are far less likely.still no any problem with 250 port ?
It's not the number of firewall/nat rules that slows down throughput and places a large CPU load on the system. What slows down a system is how many rules have to be processed to get packets through the system. Thus - efficient use of jump tables is where you get the speed because you are then able to jump/skip rules that do not apply to a packet. Thus a large number of rules is OK if you have efficient jump tables to quickly get packets through the system.Thank you for sharing, I am starting to do the same process, only by using netmap instead of src-nat, I aim to reduce the number of rules.
will definitely be examined in detail , thanks for informDon't forget to read this:Thank you for sharing, I am starting to do the same process, only by using netmap instead of src-nat, I aim to reduce the number of rules.
viewtopic.php?t=176358
I think using 250 ports may cause problems, for example a crowded restaurant... That's why I asked how is going with 250 ports.Bear in mind that 250 ports per customer actually mean 250 ports per connection to a particular remote socket, so far more than 250 connections per customer in total. There are just a few scenarios where that may still be a limitation - what comes to my mind is that some of your customers would have hundreds of IoT devices talking to the same cloud server. Too many kids watching Youtube are far less likely.
As for the creation of the rules, I always prefer to use a script to generate any kind of large configurations because if you make a mistake in the script, you learn about it quite quickly as it affects a good deal of the result; if you make a mistake in the copy-paste-edit process, it is much harder to notice. So even though the time spent on writing the script may be similar to the one spent on copy-paste-edit, the debugging phase is typically faster.
Thank you very much for the examples and information. It's great that you care so much about the subject.
It's not the number of firewall/nat rules that slows down throughput and places a large CPU load on the system. What slows down a system is how many rules have to be processed to get packets through the system. Thus - efficient use of jump tables is where you get the speed because you are then able to jump/skip rules that do not apply to a packet. Thus a large number of rules is OK if you have efficient jump tables to quickly get packets through the system.
- - -
example below for efficient use of jumps ( note - did not double check my counts )
however , the concept I am emphasizing is to make rules/test that result is the fewest condition tests being performed/examined and exit/finish the rules with the average fewest number of condition test being performed - to get the fastest average speed. Something similar to this applies to your code when creating a NAT444 configuration that may be thousands of lines of code.
It didn't even come to my mind you might plan on connecting businesses, let alone hospitality ones, this way. Indeed if the whole restaurant is watching youtube, or even worse, if the restaurant has a cloud-based order management service used directly by the guests, 250 ports might be insufficient.I think using 250 ports may cause problems, for example a crowded restaurant...
IMO - if the customer is a business, then sell them a high-speed business account with a static IP address - otherwise no normal residential customer will never need to make 250+ port connections to any single Internet located server. If a customer needs to make 250+ port connections to anything , then they are behaving like a business so then sell them a business account with a static IP address.It didn't even come to my mind you might plan on connecting businesses, let alone hospitality ones, this way. Indeed if the whole restaurant is watching youtube, or even worse, if the restaurant has a cloud-based order management service used directly by the guests, 250 ports might be insufficient.I think using 250 ports may cause problems, for example a crowded restaurant...