File: firewall2-3.fw.orig

package info (click to toggle)
fwbuilder 5.3.7-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 41,724 kB
  • sloc: cpp: 193,157; sh: 71,239; ansic: 4,343; xml: 3,963; python: 83; makefile: 76; perl: 49
file content (1207 lines) | stat: -rwxr-xr-x 55,980 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
#!/bin/sh 
#
#  This is automatically generated file. DO NOT MODIFY !
#
#  Firewall Builder  fwb_ipt v5.0.2.3596
#
#  Generated Sun Mar 18 21:16:25 2012 PDT by vadim
#
# files: * firewall2-3.fw /etc/fw/firewall2-3.fw
#
# Compiled for iptables ge_1.2.6
#
# copy of firewall2, version >= 1.2.6

# firewall2-3:NAT:20: warning: Adding of virtual address for address range is not implemented (object ext_range)

# firewall2-3:Policy:: warning: Log prefix has been truncated to 29 characters
# firewall2-3:Policy:: warning: Log prefix has been truncated to 29 characters
# firewall2-3:Policy:: warning: Log prefix has been truncated to 29 characters
# firewall2-3:Policy:10: warning: Rule action 'Reject' with TCP RST can be used only with TCP services.
# firewall2-3:Policy:: warning: Log prefix has been truncated to 29 characters
# firewall2-3:Policy:: warning: Log prefix has been truncated to 29 characters


FWBDEBUG=""

PATH="/sbin:/usr/sbin:/bin:/usr/bin:${PATH}"
export PATH



LSMOD="/sbin/lsmod"
MODPROBE="/sbin/modprobe"
IPTABLES="/sbin/iptables"
IP6TABLES="/sbin/ip6tables"
IPTABLES_RESTORE="/sbin/iptables-restore"
IP6TABLES_RESTORE="/sbin/ip6tables-restore"
IP="/sbin/ip"
IFCONFIG="/sbin/ifconfig"
VCONFIG="/sbin/vconfig"
BRCTL="/sbin/brctl"
IFENSLAVE="/sbin/ifenslave"
IPSET="/usr/sbin/ipset"
LOGGER="/usr/bin/logger"

log() {
    echo "$1"
    which "$LOGGER" >/dev/null 2>&1 && $LOGGER -p info "$1"
}

getInterfaceVarName() {
    echo $1 | sed 's/\./_/'
}

getaddr_internal() {
    dev=$1
    name=$2
    af=$3
    L=$($IP $af addr show dev $dev |  sed -n '/inet/{s!.*inet6* !!;s!/.*!!p}' | sed 's/peer.*//')
    test -z "$L" && { 
        eval "$name=''"
        return
    }
    eval "${name}_list=\"$L\"" 
}

getnet_internal() {
    dev=$1
    name=$2
    af=$3
    L=$($IP route list proto kernel | grep $dev | grep -v default |  sed 's! .*$!!')
    test -z "$L" && { 
        eval "$name=''"
        return
    }
    eval "${name}_list=\"$L\"" 
}


getaddr() {
    getaddr_internal $1 $2 "-4"
}

getaddr6() {
    getaddr_internal $1 $2 "-6"
}

getnet() {
    getnet_internal $1 $2 "-4"
}

getnet6() {
    getnet_internal $1 $2 "-6"
}

# function getinterfaces is used to process wildcard interfaces
getinterfaces() {
    NAME=$1
    $IP link show | grep ": $NAME" | while read L; do
        OIFS=$IFS
        IFS=" :"
        set $L
        IFS=$OIFS
        echo $2
    done
}

diff_intf() {
    func=$1
    list1=$2
    list2=$3
    cmd=$4
    for intf in $list1
    do
        echo $list2 | grep -q $intf || {
        # $vlan is absent in list 2
            $func $intf $cmd
        }
    done
}

find_program() {
  PGM=$1
  which $PGM >/dev/null 2>&1 || {
    echo "\"$PGM\" not found"
    exit 1
  }
}
check_tools() {
  find_program which
  find_program $IPTABLES 
  find_program $IP 
}
reset_iptables_v4() {
  $IPTABLES -P OUTPUT  DROP
  $IPTABLES -P INPUT   DROP
  $IPTABLES -P FORWARD DROP

cat /proc/net/ip_tables_names | while read table; do
  $IPTABLES -t $table -L -n | while read c chain rest; do
      if test "X$c" = "XChain" ; then
        $IPTABLES -t $table -F $chain
      fi
  done
  $IPTABLES -t $table -X
done
}

reset_iptables_v6() {
  $IP6TABLES -P OUTPUT  DROP
  $IP6TABLES -P INPUT   DROP
  $IP6TABLES -P FORWARD DROP

cat /proc/net/ip6_tables_names | while read table; do
  $IP6TABLES -t $table -L -n | while read c chain rest; do
      if test "X$c" = "XChain" ; then
        $IP6TABLES -t $table -F $chain
      fi
  done
  $IP6TABLES -t $table -X
done
}


P2P_INTERFACE_WARNING=""

missing_address() {
    address=$1
    cmd=$2

    oldIFS=$IFS
    IFS="@"
    set $address
    addr=$1
    interface=$2
    IFS=$oldIFS



    $IP addr show dev $interface | grep -q POINTOPOINT && {
        test -z "$P2P_INTERFACE_WARNING" && echo "Warning: Can not update address of interface $interface. fwbuilder can not manage addresses of point-to-point interfaces yet"
        P2P_INTERFACE_WARNING="yes"
        return
    }

    test "$cmd" = "add" && {
      echo "# Adding ip address: $interface $addr"
      echo $addr | grep -q ':' && {
          $FWBDEBUG $IP addr $cmd $addr dev $interface
      } || {
          $FWBDEBUG $IP addr $cmd $addr broadcast + dev $interface
      }
    }

    test "$cmd" = "del" && {
      echo "# Removing ip address: $interface $addr"
      $FWBDEBUG $IP addr $cmd $addr dev $interface || exit 1
    }

    $FWBDEBUG $IP link set $interface up
}

list_addresses_by_scope() {
    interface=$1
    scope=$2
    ignore_list=$3
    $IP addr ls dev $interface | \
      awk -v IGNORED="$ignore_list" -v SCOPE="$scope" \
        'BEGIN {
           split(IGNORED,ignored_arr);
           for (a in ignored_arr) {ignored_dict[ignored_arr[a]]=1;}
         }
         (/inet |inet6 / && $0 ~ SCOPE && !($2 in ignored_dict)) {print $2;}' | \
        while read addr; do
          echo "${addr}@$interface"
	done | sort
}


update_addresses_of_interface() {
    ignore_list=$2
    set $1 
    interface=$1 
    shift

    FWB_ADDRS=$(
      for addr in $*; do
        echo "${addr}@$interface"
      done | sort
    )

    CURRENT_ADDRS_ALL_SCOPES=""
    CURRENT_ADDRS_GLOBAL_SCOPE=""

    $IP link show dev $interface >/dev/null 2>&1 && {
      CURRENT_ADDRS_ALL_SCOPES=$(list_addresses_by_scope $interface 'scope .*' "$ignore_list")
      CURRENT_ADDRS_GLOBAL_SCOPE=$(list_addresses_by_scope $interface 'scope global' "$ignore_list")
    } || {
      echo "# Interface $interface does not exist"
      # Stop the script if we are not in test mode
      test -z "$FWBDEBUG" && exit 1
    }

    diff_intf missing_address "$FWB_ADDRS" "$CURRENT_ADDRS_ALL_SCOPES" add
    diff_intf missing_address "$CURRENT_ADDRS_GLOBAL_SCOPE" "$FWB_ADDRS" del
}

clear_addresses_except_known_interfaces() {
    $IP link show | sed 's/://g' | awk -v IGNORED="$*" \
        'BEGIN {
           split(IGNORED,ignored_arr);
           for (a in ignored_arr) {ignored_dict[ignored_arr[a]]=1;}
         }
         (/state/ && !($2 in ignored_dict)) {print $2;}' | \
         while read intf; do
            echo "# Removing addresses not configured in fwbuilder from interface $intf"
            $FWBDEBUG $IP addr flush dev $intf scope global
            $FWBDEBUG $IP link set $intf down
         done
}

check_file() {
    test -r "$2" || {
        echo "Can not find file $2 referenced by address table object $1"
        exit 1
    }
}

check_run_time_address_table_files() {
    :
    
}

load_modules() {
    :
    
}

verify_interfaces() {
    :
    
}

prolog_commands() {
    echo "Running prolog script"
    
}

epilog_commands() {
    echo "Running epilog script"
    
}

run_epilog_and_exit() {
    epilog_commands
    exit $1
}

configure_interfaces() {
    :
    # Configure interfaces
    # See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=429689
    # this ensures that secondary ip address is "promoted" to primary
    # when primary address is deleted, instead of deleting both
    # primary and secondary addresses. It looks like this is only
    # available starting from Linux 2.6.16 
    test -f /proc/sys/net/ipv4/conf/all/promote_secondaries && \
        echo 1 >  /proc/sys/net/ipv4/conf/all/promote_secondaries
    update_addresses_of_interface "eth0 192.168.1.1/24 192.168.1.10/24 192.168.1.50/24" ""
    update_addresses_of_interface "eth1 22.22.22.22/24 22.22.22.23/24 22.22.22.24/24 22.22.22.25/24 22.22.22.0/32 22.22.22.1/32 22.22.22.2/32 22.22.22.3/32 22.22.22.4/32 22.22.22.5/32 22.22.22.6/32 22.22.22.7/32 22.22.22.8/32 22.22.22.9/32 22.22.22.10/32 22.22.22.11/32 22.22.22.12/32 22.22.22.13/32 22.22.22.14/32 22.22.22.15/32 22.22.22.16/32 22.22.22.17/32 22.22.22.18/32 22.22.22.19/32 22.22.22.20/32 22.22.22.21/32 22.22.22.22/32 22.22.22.23/32 22.22.22.24/32 22.22.22.25/32 22.22.22.26/32 22.22.22.27/32 22.22.22.28/32 22.22.22.29/32 22.22.22.30/32 22.22.22.31/32 22.22.22.32/32 22.22.22.33/32 22.22.22.34/32 22.22.22.35/32 22.22.22.36/32 22.22.22.37/32 22.22.22.38/32 22.22.22.39/32 22.22.22.40/32 22.22.22.41/32 22.22.22.42/32 22.22.22.43/32 22.22.22.44/32 22.22.22.45/32 22.22.22.46/32 22.22.22.47/32 22.22.22.48/32 22.22.22.49/32 22.22.22.50/32 22.22.22.51/32 22.22.22.52/32 22.22.22.53/32 22.22.22.54/32 22.22.22.55/32 22.22.22.56/32 22.22.22.57/32 22.22.22.58/32 22.22.22.59/32 22.22.22.60/32 22.22.22.61/32 22.22.22.62/32 22.22.22.63/32 22.22.22.64/32 22.22.22.65/32 22.22.22.66/32 22.22.22.67/32 22.22.22.68/32 22.22.22.69/32 22.22.22.70/32 22.22.22.71/32 22.22.22.72/32 22.22.22.73/32 22.22.22.74/32 22.22.22.75/32 22.22.22.76/32 22.22.22.77/32 22.22.22.78/32 22.22.22.79/32 22.22.22.80/32 22.22.22.81/32 22.22.22.82/32 22.22.22.83/32 22.22.22.84/32 22.22.22.85/32 22.22.22.86/32 22.22.22.87/32 22.22.22.88/32 22.22.22.89/32 22.22.22.90/32 22.22.22.91/32 22.22.22.92/32 22.22.22.93/32 22.22.22.94/32 22.22.22.95/32 22.22.22.96/32 22.22.22.97/32 22.22.22.98/32 22.22.22.99/32 22.22.22.100/32 22.22.22.101/32 22.22.22.102/32 22.22.22.103/32 22.22.22.104/32 22.22.22.105/32 22.22.22.106/32 22.22.22.107/32 22.22.22.108/32 22.22.22.109/32 22.22.22.110/32 22.22.22.111/32 22.22.22.112/32 22.22.22.113/32 22.22.22.114/32 22.22.22.115/32 22.22.22.116/32 22.22.22.117/32 22.22.22.118/32 22.22.22.119/32 22.22.22.120/32 22.22.22.121/32 22.22.22.122/32 22.22.22.123/32 22.22.22.124/32 22.22.22.125/32 22.22.22.126/32 22.22.22.127/32 22.22.22.128/32 22.22.22.129/32 22.22.22.130/32 22.22.22.131/32 22.22.22.132/32 22.22.22.133/32 22.22.22.134/32 22.22.22.135/32 22.22.22.136/32 22.22.22.137/32 22.22.22.138/32 22.22.22.139/32 22.22.22.140/32 22.22.22.141/32 22.22.22.142/32 22.22.22.143/32 22.22.22.144/32 22.22.22.145/32 22.22.22.146/32 22.22.22.147/32 22.22.22.148/32 22.22.22.149/32 22.22.22.150/32 22.22.22.151/32 22.22.22.152/32 22.22.22.153/32 22.22.22.154/32 22.22.22.155/32 22.22.22.156/32 22.22.22.157/32 22.22.22.158/32 22.22.22.159/32 22.22.22.160/32 22.22.22.161/32 22.22.22.162/32 22.22.22.163/32 22.22.22.164/32 22.22.22.165/32 22.22.22.166/32 22.22.22.167/32 22.22.22.168/32 22.22.22.169/32 22.22.22.170/32 22.22.22.171/32 22.22.22.172/32 22.22.22.173/32 22.22.22.174/32 22.22.22.175/32 22.22.22.176/32 22.22.22.177/32 22.22.22.178/32 22.22.22.179/32 22.22.22.180/32 22.22.22.181/32 22.22.22.182/32 22.22.22.183/32 22.22.22.184/32 22.22.22.185/32 22.22.22.186/32 22.22.22.187/32 22.22.22.188/32 22.22.22.189/32 22.22.22.190/32 22.22.22.191/32 22.22.22.192/32 22.22.22.193/32 22.22.22.194/32 22.22.22.195/32 22.22.22.196/32 22.22.22.197/32 22.22.22.198/32 22.22.22.199/32 22.22.22.200/32 22.22.22.201/32 22.22.22.202/32 22.22.22.203/32 22.22.22.204/32 22.22.22.205/32 22.22.22.206/32 22.22.22.207/32 22.22.22.208/32 22.22.22.209/32 22.22.22.210/32 22.22.22.211/32 22.22.22.212/32 22.22.22.213/32 22.22.22.214/32 22.22.22.215/32 22.22.22.216/32 22.22.22.217/32 22.22.22.218/32 22.22.22.219/32 22.22.22.220/32 22.22.22.221/32 22.22.22.222/32 22.22.22.223/32 22.22.22.224/32 22.22.22.225/32 22.22.22.226/32 22.22.22.227/32 22.22.22.228/32 22.22.22.229/32 22.22.22.230/32 22.22.22.231/32 22.22.22.232/32 22.22.22.233/32 22.22.22.234/32 22.22.22.235/32 22.22.22.236/32 22.22.22.237/32 22.22.22.238/32 22.22.22.239/32 22.22.22.240/32 22.22.22.241/32 22.22.22.242/32 22.22.22.243/32 22.22.22.244/32 22.22.22.245/32 22.22.22.246/32 22.22.22.247/32 22.22.22.248/32 22.22.22.249/32 22.22.22.250/32 22.22.22.251/32 22.22.22.252/32 22.22.22.253/32 22.22.22.254/32" ""
    update_addresses_of_interface "eth3 22.22.23.23/24 22.22.25.50/24 22.22.23.24/24" ""
    update_addresses_of_interface "eth2 192.168.2.1/24 192.168.2.40/24" ""
    update_addresses_of_interface "lo 127.0.0.1/8" ""
}

script_body() {
    echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter 
     echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route 
     echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects 
     echo 1 > /proc/sys/net/ipv4/conf/all/log_martians 
     echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all 
     echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses 
     echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout 
     echo 1800 > /proc/sys/net/ipv4/tcp_keepalive_intvl 


    # ================ IPv4


    # ================ Table 'filter', automatic rules
    $IPTABLES -A FORWARD -p tcp -m tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu

    # accept established sessions
    $IPTABLES -A INPUT   -m state --state ESTABLISHED,RELATED -j ACCEPT 
    $IPTABLES -A OUTPUT  -m state --state ESTABLISHED,RELATED -j ACCEPT 
    $IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT 
    # drop TCP sessions opened prior firewall restart
    $IPTABLES -A INPUT   -p tcp -m tcp ! --tcp-flags SYN,RST,ACK SYN -m state --state NEW -j DROP 
    $IPTABLES -A OUTPUT  -p tcp -m tcp ! --tcp-flags SYN,RST,ACK SYN -m state --state NEW -j DROP 
    $IPTABLES -A FORWARD -p tcp -m tcp ! --tcp-flags SYN,RST,ACK SYN -m state --state NEW -j DROP 
    # drop packets that do not match any valid state and log them
    $IPTABLES -N drop_invalid
    $IPTABLES -A OUTPUT   -m state --state INVALID  -j drop_invalid 
    $IPTABLES -A INPUT    -m state --state INVALID  -j drop_invalid 
    $IPTABLES -A FORWARD  -m state --state INVALID  -j drop_invalid 
    $IPTABLES -A drop_invalid -j ULOG --ulog-nlgroup 1  --ulog-qthreshold 1 --ulog-prefix "INVALID state -- DENY "
    $IPTABLES -A drop_invalid -j DROP


    # ================ Table 'nat',  rule set NAT
    # 
    # Rule 0 (NAT)
    # 
    echo "Rule 0 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth1   -s 192.168.1.0/24  -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3   -s 192.168.1.0/24  -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3   -s 192.168.1.0/24  -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2   -s 192.168.1.0/24  -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2   -s 192.168.1.0/24  -j SNAT --to-source 192.168.2.40
    # 
    # Rule 1 (NAT)
    # 
    echo "Rule 1 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 192.168.2.40
    # 
    # Rule 2 (NAT)
    # 
    echo "Rule 2 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 3 -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 0/0  -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/0  -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p icmp -m icmp  -s 192.168.1.0/24   --icmp-type 11/1  -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p 50  -s 192.168.1.0/24   -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p 50  -s 192.168.1.0/24   -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p 50  -s 192.168.1.0/24   -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p 50  -s 192.168.1.0/24   -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p 50  -s 192.168.1.0/24   -j SNAT --to-source 192.168.2.40
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p 88  -s 192.168.1.0/24   -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p 88  -s 192.168.1.0/24   -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3  -p 88  -s 192.168.1.0/24   -j SNAT --to-source 22.22.25.50
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p 88  -s 192.168.1.0/24   -j SNAT --to-source 192.168.2.1
    $IPTABLES -t nat -A POSTROUTING -o eth2  -p 88  -s 192.168.1.0/24   -j SNAT --to-source 192.168.2.40
    # 
    # Rule 3 (NAT)
    # 
    echo "Rule 3 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth3   -s 192.168.1.0/24  -j SNAT --to-source 22.22.23.23
    $IPTABLES -t nat -A POSTROUTING -o eth3   -s 192.168.1.0/24  -j SNAT --to-source 22.22.25.50
    # 
    # Rule 4 (NAT)
    # 
    echo "Rule 4 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth3   -s 192.168.1.0/24  -j SNAT --to-source 22.22.25.50
    # 
    # Rule 5 (NAT)
    # 
    echo "Rule 5 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth+   -s 192.168.1.0/24  -j SNAT --to-source 22.22.25.50
    # 
    # Rule 6 (NAT)
    # 
    echo "Rule 6 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth+   -s 192.168.1.10  -j SNAT --to-source 22.22.22.23
    # 
    # Rule 7 (NAT)
    # 
    echo "Rule 7 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth+   -s 192.168.1.10  -j SNAT --to-source 22.22.22.23
    $IPTABLES -t nat -A POSTROUTING -o eth+   -s 192.168.1.10  -j SNAT --to-source 22.22.22.24
    $IPTABLES -t nat -A POSTROUTING -o eth+   -s 192.168.1.10  -j SNAT --to-source 22.22.22.25
    # 
    # Rule 8 (NAT)
    # 
    echo "Rule 8 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth+   -s 192.168.1.0/24  -d 192.168.1.10  -j SNAT --to-source 192.168.1.1
    # 
    # Rule 9 (NAT)
    # 
    echo "Rule 9 (NAT)"
    # 
    $IPTABLES -t nat -N Cid35496X1833.0
    $IPTABLES -t nat -A POSTROUTING  -d 192.168.2.10  -j Cid35496X1833.0
    $IPTABLES -t nat -A POSTROUTING  -d 192.168.2.11  -j Cid35496X1833.0
    $IPTABLES -t nat -A Cid35496X1833.0  -s 22.22.22.22  -j ACCEPT
    $IPTABLES -t nat -A Cid35496X1833.0  -s 22.22.23.23  -j ACCEPT
    $IPTABLES -t nat -A Cid35496X1833.0  -s 22.22.25.50  -j ACCEPT
    $IPTABLES -t nat -A Cid35496X1833.0  -s 192.168.1.1  -j ACCEPT
    $IPTABLES -t nat -A Cid35496X1833.0  -s 192.168.2.1  -j ACCEPT
    $IPTABLES -t nat -A Cid35496X1833.0  -s 192.168.2.40  -j ACCEPT
    $IPTABLES -t nat -A OUTPUT  -d 192.168.2.10  -j ACCEPT
    $IPTABLES -t nat -A OUTPUT  -d 192.168.2.11  -j ACCEPT
    $IPTABLES -t nat -N Cid35496X1833.1
    $IPTABLES -t nat -A POSTROUTING  -d 192.168.2.10  -j Cid35496X1833.1
    $IPTABLES -t nat -A POSTROUTING  -d 192.168.2.11  -j Cid35496X1833.1
    $IPTABLES -t nat -A Cid35496X1833.1  -s 192.168.1.10  -j ACCEPT
    $IPTABLES -t nat -A Cid35496X1833.1  -s 192.168.1.20  -j ACCEPT
    $IPTABLES -t nat -N Cid35496X1833.2
    $IPTABLES -t nat -A PREROUTING  -d 192.168.2.10  -j Cid35496X1833.2
    $IPTABLES -t nat -A PREROUTING  -d 192.168.2.11  -j Cid35496X1833.2
    $IPTABLES -t nat -A Cid35496X1833.2  -s 192.168.1.10  -j ACCEPT
    $IPTABLES -t nat -A Cid35496X1833.2  -s 192.168.1.20  -j ACCEPT
    # 
    # Rule 10 (NAT)
    # 
    echo "Rule 10 (NAT)"
    # 
    $IPTABLES -t nat -N Cid35514X1833.0
    $IPTABLES -t nat -A POSTROUTING  -s 192.168.1.10  -j Cid35514X1833.0
    $IPTABLES -t nat -A POSTROUTING  -s 192.168.1.20  -j Cid35514X1833.0
    $IPTABLES -t nat -A PREROUTING  -s 192.168.1.10  -j Cid35514X1833.0
    $IPTABLES -t nat -A PREROUTING  -s 192.168.1.20  -j Cid35514X1833.0
    $IPTABLES -t nat -A Cid35514X1833.0  -d 192.168.2.10  -j RETURN
    $IPTABLES -t nat -A Cid35514X1833.0  -d 192.168.2.11  -j RETURN
    $IPTABLES -t nat -A Cid35514X1833.0  -j ACCEPT
    # 
    # Rule 11 (NAT)
    # 
    echo "Rule 11 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p icmp -m icmp   -d 22.22.22.23  --icmp-type 3 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p icmp -m icmp   -d 22.22.22.23  --icmp-type 0/0  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p icmp -m icmp   -d 22.22.22.23  --icmp-type 11/0  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p icmp -m icmp   -d 22.22.22.23  --icmp-type 11/1  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp -m multiport   -d 22.22.22.23  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p 50   -d 22.22.22.23  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p 88   -d 22.22.22.23  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p icmp -m icmp   -d 22.22.22.23  --icmp-type 3 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p icmp -m icmp   -d 22.22.22.23  --icmp-type 0/0  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p icmp -m icmp   -d 22.22.22.23  --icmp-type 11/0  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p icmp -m icmp   -d 22.22.22.23  --icmp-type 11/1  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp -m multiport   -d 22.22.22.23  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p 50   -d 22.22.22.23  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p 88   -d 22.22.22.23  -j DNAT --to-destination 192.168.1.10
    # 
    # Rule 12 (NAT)
    # 
    echo "Rule 12 (NAT)"
    # 
    $IPTABLES -t nat -A OUTPUT -p icmp -m icmp   -d 22.22.22.23  --icmp-type 3 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p icmp -m icmp   -d 22.22.22.23  --icmp-type 0/0  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p icmp -m icmp   -d 22.22.22.23  --icmp-type 11/0  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p icmp -m icmp   -d 22.22.22.23  --icmp-type 11/1  -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp -m multiport   -d 22.22.22.23  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    # 
    # Rule 13 (NAT)
    # 
    echo "Rule 13 (NAT)"
    # 
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp -m multiport  -s 22.22.23.23   -d 22.22.22.23  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp -m multiport  -s 22.22.25.50   -d 22.22.22.23  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    # 
    # Rule 14 (NAT)
    # 
    echo "Rule 14 (NAT)"
    # 
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp -m multiport   -d 22.22.22.23  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp -m multiport  -s 200.200.200.200   -d 22.22.22.23  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    # 
    # Rule 16 (NAT)
    # 
    echo "Rule 16 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp -m multiport   -d 22.22.22.23  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp -m multiport   -d 22.22.22.24  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp -m multiport   -d 22.22.22.25  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp -m multiport   -d 22.22.22.23  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp -m multiport   -d 22.22.22.24  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp -m multiport   -d 22.22.22.25  --dports 80,119 -j DNAT --to-destination 192.168.1.10
    # 
    # Rule 17 (NAT)
    # 
    echo "Rule 17 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.22.22  --dport 119 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.22.22  --dport 119 -j DNAT --to-destination 192.168.1.10
    # 
    # Rule 18 (NAT)
    # 
    echo "Rule 18 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth+   -s 192.168.1.20  -j SNAT --to-source 22.22.23.24
    # 
    # Rule 19 (NAT)
    # 
    echo "Rule 19 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING  -d 22.22.23.24  -j DNAT --to-destination 192.168.1.20
    $IPTABLES -t nat -A OUTPUT  -d 22.22.23.24  -j DNAT --to-destination 192.168.1.20
    # 
    # Rule 20 (NAT)
    # 
    echo "Rule 20 (NAT)"
    # 
    # firewall2-3:NAT:20: warning: Adding of virtual address for address range is not implemented (object ext_range)

    $IPTABLES -t nat -A POSTROUTING -o eth+   -s 192.168.1.0/24  -j SNAT --to-source 22.22.22.100-22.22.22.110
    # 
    # Rule 21 (NAT)
    # 
    echo "Rule 21 (NAT)"
    # 
    # NETMAP 
    $IPTABLES -t nat -A POSTROUTING  -s 192.168.1.0/24  -j NETMAP --to 22.22.22.0/24
    # 
    # Rule 22 (NAT)
    # 
    echo "Rule 22 (NAT)"
    # 
    # NETMAP
    $IPTABLES -t nat -A PREROUTING  -d 22.22.22.0/24  -j NETMAP --to 192.168.1.0/24
    # 
    # Rule 23 (NAT)
    # 
    echo "Rule 23 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.22.22  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.23.23  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.25.50  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.1.1  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.2.1  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.2.40  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.22.22  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.23.23  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.25.50  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 192.168.1.1  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 192.168.2.1  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 192.168.2.40  --dport 10000:11000 -j DNAT --to-destination 192.168.1.10:10000-11000
    # 
    # Rule 24 (NAT)
    # 
    echo "Rule 24 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.22.22  --dport 80 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.22.22  --dport 80 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.23.23  --dport 80 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.25.50  --dport 80 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.23.23  --dport 80 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.25.50  --dport 80 -j DNAT --to-destination 192.168.1.10
    $IPTABLES -t nat -A POSTROUTING -o eth0  -p tcp -m tcp   -d 192.168.1.10  --dport 80 -j SNAT --to-source 192.168.1.1
    # 
    # Rule 25 (NAT)
    # 
    echo "Rule 25 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.22.23  --dport 80 -j DNAT --to-destination 192.168.1.10:25
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.22.23  --dport 80 -j DNAT --to-destination 192.168.1.10:25
    # 
    # Rule 26 (NAT)
    # 
    echo "Rule 26 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.22.22  --dport 80 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.23.23  --dport 80 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.25.50  --dport 80 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.1.1  --dport 80 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.2.1  --dport 80 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.2.40  --dport 80 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.22.22  --dport 443 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.23.23  --dport 443 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.25.50  --dport 443 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.1.1  --dport 443 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.2.1  --dport 443 -j REDIRECT --to-ports 3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.2.40  --dport 443 -j REDIRECT --to-ports 3128
    # 
    # Rule 27 (NAT)
    # 
    echo "Rule 27 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.22.22  --dport 8080 -j DNAT --to-destination 192.168.1.10-192.168.1.100
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.22.22  --dport 8080 -j DNAT --to-destination 192.168.1.10-192.168.1.100
    # 
    # Rule 28 (NAT)
    # 
    echo "Rule 28 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 22.22.22.22  --dport 8080 -j DNAT --to-destination 192.168.1.11-192.168.1.15
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 22.22.22.22  --dport 8080 -j DNAT --to-destination 192.168.1.11-192.168.1.15
    # 
    # Rule 29 (NAT)
    # 
    echo "Rule 29 (NAT)"
    # 
    # transparent proxy rule
    $IPTABLES -t nat -A PREROUTING  -s 192.168.1.0/24  -d ! 22.22.22.23  -j DNAT --to-destination 192.168.2.10
    # 
    # Rule 31 (NAT)
    # 
    echo "Rule 31 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   --dport 80 -j DNAT --to-destination :8080
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   --dport 80 -j DNAT --to-destination :8080
    # 
    # Rule 32 (NAT)
    # 
    echo "Rule 32 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d 192.168.1.10  --dport 80 -j DNAT --to-destination 192.168.1.10:8080
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d 192.168.1.10  --dport 80 -j DNAT --to-destination 192.168.1.10:8080
    # 
    # Rule 33 (NAT)
    # 
    echo "Rule 33 (NAT)"
    # 
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p tcp -m tcp  -s 192.168.1.10   --dport 80 -j SNAT --to-source 22.22.22.22
    # 
    # Rule 34 (NAT)
    # 
    echo "Rule 34 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp  -s ! 192.168.1.10   --dport 80 -j DNAT --to-destination 192.168.1.10:3128
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   --dport 80 -j DNAT --to-destination 192.168.1.10:3128
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp  -s ! 192.168.1.10   --dport 80 -j DNAT --to-destination 192.168.1.10:3128
    $IPTABLES -t nat -A POSTROUTING -o eth0  -p tcp -m tcp  -s ! 192.168.1.10   -d 192.168.1.10  --dport 3128 -j SNAT --to-source 192.168.1.1
    # 
    # Rule 35 (NAT)
    # 
    echo "Rule 35 (NAT)"
    # 
    $IPTABLES -t nat -N Cid35884X1833.0
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   -d ! 192.168.1.50  --dport 80 -j Cid35884X1833.0
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   -d ! 192.168.1.50  --dport 80 -j Cid35884X1833.0
    $IPTABLES -t nat -A Cid35884X1833.0  -s 192.168.1.10  -j RETURN
    $IPTABLES -t nat -A Cid35884X1833.0  -s 192.168.1.20  -j RETURN
    $IPTABLES -t nat -A Cid35884X1833.0 -p tcp -m tcp   --dport 80 -j DNAT --to-destination 192.168.1.50:3128
    # 
    # Rule 36 (NAT)
    # 
    echo "Rule 36 (NAT)"
    # 
    $IPTABLES -t nat -N Cid35898X1833.1
    $IPTABLES -t nat -A POSTROUTING -o eth0   -j Cid35898X1833.1
    $IPTABLES -t nat -A Cid35898X1833.1  -s 192.168.1.10  -j RETURN
    $IPTABLES -t nat -A Cid35898X1833.1  -s 192.168.1.20  -j RETURN
    $IPTABLES -t nat -N Cid35898X1833.0
    $IPTABLES -t nat -A Cid35898X1833.1  -j Cid35898X1833.0
    $IPTABLES -t nat -A Cid35898X1833.0 -p tcp -m tcp   --dport 80 -j RETURN
    $IPTABLES -t nat -A Cid35898X1833.0  -j SNAT --to-source 192.168.1.1
    # 
    # Rule 37 (NAT)
    # 
    echo "Rule 37 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j DNAT --to-destination 192.168.1.10:3128
    $IPTABLES -t nat -A POSTROUTING -o eth0  -p tcp -m tcp  -s 192.168.1.0/24   -d 192.168.1.10  --dport 3128 -j SNAT --to-source 192.168.1.1
    # 
    # Rule 38 (NAT)
    # 
    echo "Rule 38 (NAT)"
    # 
    # this is the "exception" rule
    # used in support req. originally
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p tcp -m tcp  -s 192.168.1.10   --dport 80 -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p tcp -m tcp  -s 192.168.1.20   --dport 80 -j SNAT --to-source 22.22.22.22
    # 
    # Rule 39 (NAT)
    # 
    echo "Rule 39 (NAT)"
    # 
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp  -s 192.168.1.0/24   --dport 80 -j DNAT --to-destination 192.168.1.1:3128
    # 
    # Rule 40 (NAT)
    # 
    echo "Rule 40 (NAT)"
    # 
    # "exception" rule in the pair
    # from a support req.
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p tcp -m tcp  -s 192.168.1.10   --dport 80 -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p tcp -m tcp  -s 192.168.1.20   --dport 80 -j SNAT --to-source 22.22.22.22
    # 
    # Rule 41 (NAT)
    # 
    echo "Rule 41 (NAT)"
    # 
    # testing transparent proxy
    # roules for a support req.
    $IPTABLES -t nat -N Cid35968X1833.0
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   --dport 80 -j Cid35968X1833.0
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   --dport 80 -j Cid35968X1833.0
    $IPTABLES -t nat -A Cid35968X1833.0  -s 192.168.1.10  -j RETURN
    $IPTABLES -t nat -A Cid35968X1833.0  -s 192.168.1.20  -j RETURN
    $IPTABLES -t nat -A Cid35968X1833.0 -p tcp -m tcp   --dport 80 -j DNAT --to-destination 192.168.1.1:3128
    # 
    # Rule 42 (NAT)
    # 
    echo "Rule 42 (NAT)"
    # 
    # testing transparent proxy
    # roules for a support req.
    $IPTABLES -t nat -N Cid35982X1833.0
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   --dport 80 -j Cid35982X1833.0
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   --dport 80 -j Cid35982X1833.0
    $IPTABLES -t nat -A Cid35982X1833.0  -s 192.168.1.10  -j RETURN
    $IPTABLES -t nat -A Cid35982X1833.0  -s 192.168.1.20  -j RETURN
    $IPTABLES -t nat -A Cid35982X1833.0 -p tcp -m tcp   --dport 80 -j DNAT --to-destination 192.168.1.1:3128
    # 
    # Rule 43 (NAT)
    # 
    echo "Rule 43 (NAT)"
    # 
    # testing transparent proxy
    # roules for a support req.
    $IPTABLES -t nat -N Cid35996X1833.0
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   --dport 80 -j Cid35996X1833.0
    $IPTABLES -t nat -A Cid35996X1833.0  -s 192.168.1.10  -j RETURN
    $IPTABLES -t nat -A Cid35996X1833.0  -s 192.168.1.20  -j RETURN
    $IPTABLES -t nat -A Cid35996X1833.0 -p tcp -m tcp   --dport 80 -j REDIRECT --to-ports 3128
    # 
    # Rule 44 (NAT)
    # 
    echo "Rule 44 (NAT)"
    # 
    # "exception" rule in the pair
    # from a support req.
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p tcp -m tcp  -s 192.168.1.10   --dport 80 -j SNAT --to-source 22.22.22.22
    $IPTABLES -t nat -A POSTROUTING -o eth1  -p tcp -m tcp  -s 192.168.1.20   --dport 80 -j SNAT --to-source 22.22.22.22
    # 
    # Rule 45 (NAT)
    # 
    echo "Rule 45 (NAT)"
    # 
    # testing transparent proxy
    # roules for a support req.
    $IPTABLES -t nat -N Cid36024X1833.0
    $IPTABLES -t nat -A PREROUTING -p tcp -m tcp   --dport 80 -j Cid36024X1833.0
    $IPTABLES -t nat -A OUTPUT -p tcp -m tcp   --dport 80 -j Cid36024X1833.0
    $IPTABLES -t nat -A Cid36024X1833.0  -s 192.168.1.10  -j RETURN
    $IPTABLES -t nat -A Cid36024X1833.0  -s 192.168.1.20  -j RETURN
    $IPTABLES -t nat -A Cid36024X1833.0 -p tcp -m tcp   --dport 80 -j DNAT --to-destination 192.168.1.50:3128



    # ================ Table 'filter', rule set Policy
    # 
    # Rule 0 (eth1)
    # 
    echo "Rule 0 (eth1)"
    # 
    # Anti-spoofing rule
    $IPTABLES -N In_RULE_0
    $IPTABLES -A INPUT -i eth1   -s 22.22.22.22   -j In_RULE_0
    $IPTABLES -A INPUT -i eth1   -s 22.22.23.23   -j In_RULE_0
    $IPTABLES -A INPUT -i eth1   -s 22.22.25.50   -j In_RULE_0
    $IPTABLES -A INPUT -i eth1   -s 192.168.1.1   -j In_RULE_0
    $IPTABLES -A INPUT -i eth1   -s 192.168.2.1   -j In_RULE_0
    $IPTABLES -A INPUT -i eth1   -s 192.168.2.40   -j In_RULE_0
    $IPTABLES -A INPUT -i eth1   -s 192.168.1.0/24   -j In_RULE_0
    $IPTABLES -A FORWARD -i eth1   -s 22.22.22.22   -j In_RULE_0
    $IPTABLES -A FORWARD -i eth1   -s 22.22.23.23   -j In_RULE_0
    $IPTABLES -A FORWARD -i eth1   -s 22.22.25.50   -j In_RULE_0
    $IPTABLES -A FORWARD -i eth1   -s 192.168.1.1   -j In_RULE_0
    $IPTABLES -A FORWARD -i eth1   -s 192.168.2.1   -j In_RULE_0
    $IPTABLES -A FORWARD -i eth1   -s 192.168.2.40   -j In_RULE_0
    $IPTABLES -A FORWARD -i eth1   -s 192.168.1.0/24   -j In_RULE_0
    $IPTABLES -A In_RULE_0  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "Iface: global RULE 0 -- DENY " --ulog-qthreshold 1
    $IPTABLES -A In_RULE_0  -j DROP
    # 
    # Rule 1 (eth1)
    # 
    echo "Rule 1 (eth1)"
    # 
    # Anti-spoofing rule
    $IPTABLES -N Cid35127X1833.0
    $IPTABLES -A OUTPUT -o eth1   -j Cid35127X1833.0
    $IPTABLES -A Cid35127X1833.0  -s 22.22.22.22   -j RETURN
    $IPTABLES -A Cid35127X1833.0  -s 22.22.23.23   -j RETURN
    $IPTABLES -A Cid35127X1833.0  -s 22.22.25.50   -j RETURN
    $IPTABLES -A Cid35127X1833.0  -s 192.168.1.1   -j RETURN
    $IPTABLES -A Cid35127X1833.0  -s 192.168.2.1   -j RETURN
    $IPTABLES -A Cid35127X1833.0  -s 192.168.2.40   -j RETURN
    $IPTABLES -N Out_RULE_1_3
    $IPTABLES -A Cid35127X1833.0  -j Out_RULE_1_3
    $IPTABLES -A Out_RULE_1_3  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "Iface: global RULE 1 -- DENY " --ulog-qthreshold 1
    $IPTABLES -A Out_RULE_1_3  -j DROP
    $IPTABLES -N Cid35127X1833.1
    $IPTABLES -A FORWARD -o eth1   -j Cid35127X1833.1
    $IPTABLES -A Cid35127X1833.1  -s 192.168.1.0/24   -j RETURN
    $IPTABLES -A Cid35127X1833.1  -j Out_RULE_1_3
    # 
    # Rule 2 (fw2i1,3)
    # 
    echo "Rule 2 (fw2i1,3)"
    # 
    # testing group in "interface"
    # this rule should be identical to rule 3
    $IPTABLES -N In_RULE_2
    $IPTABLES -A INPUT -i eth1  -p udp -m udp  -m multiport  -s 192.168.1.0/24   --dports 68,67  -j In_RULE_2
    $IPTABLES -A INPUT -i eth3  -p udp -m udp  -m multiport  -s 192.168.1.0/24   --dports 68,67  -j In_RULE_2
    $IPTABLES -A FORWARD -i eth1  -p udp -m udp  -m multiport  -s 192.168.1.0/24   --dports 68,67  -j In_RULE_2
    $IPTABLES -A FORWARD -i eth3  -p udp -m udp  -m multiport  -s 192.168.1.0/24   --dports 68,67  -j In_RULE_2
    $IPTABLES -A In_RULE_2  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 2 - DENY **" --ulog-qthreshold 1
    $IPTABLES -A In_RULE_2  -j DROP
    # 
    # Rule 3 (eth1,eth3)
    # 
    echo "Rule 3 (eth1,eth3)"
    # 
    $IPTABLES -N In_RULE_3
    $IPTABLES -A INPUT -i eth1  -p udp -m udp  -m multiport  -s 192.168.1.0/24   --dports 68,67  -j In_RULE_3
    $IPTABLES -A INPUT -i eth3  -p udp -m udp  -m multiport  -s 192.168.1.0/24   --dports 68,67  -j In_RULE_3
    $IPTABLES -A FORWARD -i eth1  -p udp -m udp  -m multiport  -s 192.168.1.0/24   --dports 68,67  -j In_RULE_3
    $IPTABLES -A FORWARD -i eth3  -p udp -m udp  -m multiport  -s 192.168.1.0/24   --dports 68,67  -j In_RULE_3
    $IPTABLES -A In_RULE_3  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 3 - DENY **" --ulog-qthreshold 1
    $IPTABLES -A In_RULE_3  -j DROP
    # 
    # Rule 4 (eth1,eth3)
    # 
    echo "Rule 4 (eth1,eth3)"
    # 
    # testing choice of chains in case when several
    # interfaces are used and rule matches 'any' or
    # broadcast 
    $IPTABLES -A INPUT -i eth1  -p udp -m udp  -m multiport  -d 255.255.255.255   --dports 68,67  -m state --state NEW  -j ACCEPT
    $IPTABLES -A INPUT -i eth3  -p udp -m udp  -m multiport  -d 255.255.255.255   --dports 68,67  -m state --state NEW  -j ACCEPT
    $IPTABLES -A OUTPUT -o eth1  -p udp -m udp  -m multiport  -d 255.255.255.255   --dports 68,67  -m state --state NEW  -j ACCEPT
    $IPTABLES -A OUTPUT -o eth3  -p udp -m udp  -m multiport  -d 255.255.255.255   --dports 68,67  -m state --state NEW  -j ACCEPT
    # 
    # Rule 5 (eth1,eth3)
    # 
    echo "Rule 5 (eth1,eth3)"
    # 
    $IPTABLES -A INPUT -i eth1  -p udp -m udp  -m multiport  -s 0.0.0.0   -d 255.255.255.255   --dports 68,67  -m state --state NEW  -j ACCEPT
    $IPTABLES -A INPUT -i eth3  -p udp -m udp  -m multiport  -s 0.0.0.0   -d 255.255.255.255   --dports 68,67  -m state --state NEW  -j ACCEPT
    # 
    # Rule 6 (eth1,eth3)
    # 
    echo "Rule 6 (eth1,eth3)"
    # 
    $IPTABLES -A OUTPUT -o eth1  -p udp -m udp  -m multiport  -s 192.168.1.0/24   -d 255.255.255.255   --dports 68,67  -m state --state NEW  -j ACCEPT
    $IPTABLES -A OUTPUT -o eth3  -p udp -m udp  -m multiport  -s 192.168.1.0/24   -d 255.255.255.255   --dports 68,67  -m state --state NEW  -j ACCEPT
    # 
    # Rule 7 (global)
    # 
    echo "Rule 7 (global)"
    # 
    $IPTABLES -N Cid35204X1833.0
    $IPTABLES -A OUTPUT  -j Cid35204X1833.0
    $IPTABLES -A INPUT  -j Cid35204X1833.0
    $IPTABLES -A FORWARD  -j Cid35204X1833.0
    $IPTABLES -A Cid35204X1833.0 -p tcp -m tcp   --tcp-flags SYN,RST,ACK SYN   -j RETURN
    $IPTABLES -N RULE_7_3
    $IPTABLES -A Cid35204X1833.0  -j RULE_7_3
    $IPTABLES -A RULE_7_3  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 7 - DENY **" --ulog-qthreshold 1
    $IPTABLES -A RULE_7_3  -j DROP
    # 
    # Rule 8 (global)
    # 
    echo "Rule 8 (global)"
    # 
    # block fragments
    $IPTABLES -N RULE_8
    $IPTABLES -A OUTPUT -p all  -f   -j RULE_8
    $IPTABLES -A INPUT -p all  -f   -j RULE_8
    $IPTABLES -A FORWARD -p all  -f   -j RULE_8
    $IPTABLES -A RULE_8  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 8 - DENY **" --ulog-qthreshold 1
    $IPTABLES -A RULE_8  -j DROP
    # 
    # Rule 9 (global)
    # 
    echo "Rule 9 (global)"
    # 
    # sends TCP RST and makes custom record
    # in the log
    $IPTABLES -N RULE_9
    $IPTABLES -A OUTPUT -p tcp -m tcp  --dport 113  -j RULE_9
    $IPTABLES -A INPUT -p tcp -m tcp  --dport 113  -j RULE_9
    $IPTABLES -A FORWARD -p tcp -m tcp  --dport 113  -j RULE_9
    $IPTABLES -A RULE_9  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "IDENT" --ulog-qthreshold 1
    $IPTABLES -A RULE_9 -p tcp -m tcp  -j REJECT  --reject-with tcp-reset
    # 
    # Rule 10 (global)
    # 
    echo "Rule 10 (global)"
    # 
    # firewall2-3:Policy:10: warning: Rule action 'Reject' with TCP RST can be used only with TCP services.

    $IPTABLES -N RULE_10
    $IPTABLES -A OUTPUT -p udp -m udp  --dport 161  -j RULE_10
    $IPTABLES -A INPUT -p udp -m udp  --dport 161  -j RULE_10
    $IPTABLES -A FORWARD -p udp -m udp  --dport 161  -j RULE_10
    $IPTABLES -A RULE_10  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 10 - REJECT **" --ulog-qthreshold 1
    $IPTABLES -A RULE_10  -j REJECT  --reject-with icmp-net-unreachable
    # 
    # Rule 11 (global)
    # 
    echo "Rule 11 (global)"
    # 
    $IPTABLES -N Cid35252X1833.0
    $IPTABLES -A INPUT -p icmp  -s 192.168.2.0/24   -m state --state NEW  -j Cid35252X1833.0
    $IPTABLES -N RULE_11
    $IPTABLES -A Cid35252X1833.0  -d 192.168.2.1   -j RULE_11
    $IPTABLES -A Cid35252X1833.0  -d 192.168.2.40   -j RULE_11
    $IPTABLES -A RULE_11  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 11 - ACCEPT **" --ulog-qthreshold 1
    $IPTABLES -A RULE_11  -j ACCEPT
    # 
    # Rule 12 (global)
    # 
    echo "Rule 12 (global)"
    # 
    $IPTABLES -N Cid35264X1833.0
    $IPTABLES -A FORWARD  -d 211.11.11.11   -m state --state NEW  -j Cid35264X1833.0
    $IPTABLES -A Cid35264X1833.0  -s 192.168.1.10   -j ACCEPT
    $IPTABLES -A Cid35264X1833.0  -s 192.168.1.20   -j ACCEPT
    # 
    # Rule 13 (global)
    # 
    echo "Rule 13 (global)"
    # 
    $IPTABLES -N Cid35277X1833.0
    $IPTABLES -A FORWARD  -s 211.11.11.11   -m state --state NEW  -j Cid35277X1833.0
    $IPTABLES -A Cid35277X1833.0  -d 192.168.1.10   -j ACCEPT
    $IPTABLES -A Cid35277X1833.0  -d 192.168.1.20   -j ACCEPT
    # 
    # Rule 14 (global)
    # 
    echo "Rule 14 (global)"
    # 
    $IPTABLES -N Cid35290X1833.0
    $IPTABLES -A OUTPUT -p tcp -m tcp  -j Cid35290X1833.0
    $IPTABLES -A INPUT -p tcp -m tcp  -j Cid35290X1833.0
    $IPTABLES -A FORWARD -p tcp -m tcp  -j Cid35290X1833.0
    $IPTABLES -A Cid35290X1833.0  -s 192.168.1.0/24   -j RETURN
    $IPTABLES -A Cid35290X1833.0  -s 192.168.2.0/24   -j RETURN
    $IPTABLES -A Cid35290X1833.0 -p tcp -m tcp  -j REJECT  --reject-with tcp-reset
    $IPTABLES -N Cid35290X1833.1
    $IPTABLES -A OUTPUT  -j Cid35290X1833.1
    $IPTABLES -A INPUT  -j Cid35290X1833.1
    $IPTABLES -A FORWARD  -j Cid35290X1833.1
    $IPTABLES -A Cid35290X1833.1  -s 192.168.1.0/24   -j RETURN
    $IPTABLES -A Cid35290X1833.1  -s 192.168.2.0/24   -j RETURN
    $IPTABLES -A Cid35290X1833.1  -j REJECT  --reject-with icmp-net-unreachable
    # 
    # Rule 15 (global)
    # 
    echo "Rule 15 (global)"
    # 
    $IPTABLES -A INPUT  -s 192.168.1.0/24   -m state --state NEW  -j ACCEPT
    $IPTABLES -A INPUT  -s 192.168.2.0/24   -m state --state NEW  -j ACCEPT
    $IPTABLES -A OUTPUT  -s 192.168.1.0/24   -m state --state NEW  -j ACCEPT
    $IPTABLES -A OUTPUT  -s 192.168.2.0/24   -m state --state NEW  -j ACCEPT
    $IPTABLES -A FORWARD  -s 192.168.1.0/24   -m state --state NEW  -j ACCEPT
    $IPTABLES -A FORWARD  -s 192.168.2.0/24   -m state --state NEW  -j ACCEPT
    # 
    # Rule 16 (global)
    # 
    echo "Rule 16 (global)"
    # 
    $IPTABLES -N RULE_16
    $IPTABLES -A INPUT  -s 192.168.1.0/24   -j RULE_16
    $IPTABLES -A OUTPUT  -s 192.168.1.0/24   -j RULE_16
    $IPTABLES -A FORWARD  -s 192.168.1.0/24   -j RULE_16
    $IPTABLES -A RULE_16  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 16 - DENY **" --ulog-qthreshold 1
    $IPTABLES -A RULE_16  -j DROP
    # 
    # Rule 17 (global)
    # 
    echo "Rule 17 (global)"
    # 
    # host-fw2 has the same address as 
    #         one of the firewall's interfaces
    $IPTABLES -N RULE_17
    $IPTABLES -A OUTPUT -p tcp -m tcp  -d 22.22.22.22   --dport 21  -m state --state NEW  -m limit --limit 5/minute --limit-burst 10 -j RULE_17
    $IPTABLES -A INPUT -p tcp -m tcp  -d 22.22.22.22   --dport 21  -m state --state NEW  -m limit --limit 5/minute --limit-burst 10 -j RULE_17
    $IPTABLES -A RULE_17  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 17 - ACCEPT **" --ulog-qthreshold 1
    $IPTABLES -A RULE_17  -j ACCEPT
    # 
    # Rule 18 (global)
    # 
    echo "Rule 18 (global)"
    # 
    $IPTABLES -N Cid35340X1833.0
    $IPTABLES -A OUTPUT -p tcp -m tcp  --dport 21  -m state --state NEW  -j Cid35340X1833.0
    $IPTABLES -N RULE_18
    $IPTABLES -A Cid35340X1833.0  -d 22.22.22.22   -j RULE_18
    $IPTABLES -A Cid35340X1833.0  -d 22.22.23.23   -j RULE_18
    $IPTABLES -A Cid35340X1833.0  -d 22.22.25.50   -j RULE_18
    $IPTABLES -A Cid35340X1833.0  -d 192.168.1.1   -j RULE_18
    $IPTABLES -A Cid35340X1833.0  -d 192.168.2.1   -j RULE_18
    $IPTABLES -A Cid35340X1833.0  -d 192.168.2.40   -j RULE_18
    $IPTABLES -N Cid35340X1833.1
    $IPTABLES -A INPUT -p tcp -m tcp  --dport 21  -m state --state NEW  -j Cid35340X1833.1
    $IPTABLES -A Cid35340X1833.1  -d 22.22.22.22   -j RULE_18
    $IPTABLES -A Cid35340X1833.1  -d 22.22.23.23   -j RULE_18
    $IPTABLES -A Cid35340X1833.1  -d 22.22.25.50   -j RULE_18
    $IPTABLES -A Cid35340X1833.1  -d 192.168.1.1   -j RULE_18
    $IPTABLES -A Cid35340X1833.1  -d 192.168.2.1   -j RULE_18
    $IPTABLES -A Cid35340X1833.1  -d 192.168.2.40   -j RULE_18
    $IPTABLES -A RULE_18  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 18 - ACCEPT **" --ulog-qthreshold 1
    $IPTABLES -A RULE_18  -j ACCEPT
    # 
    # Rule 19 (global)
    # 
    echo "Rule 19 (global)"
    # 
    # 'catch all' rule
    $IPTABLES -N RULE_19
    $IPTABLES -A OUTPUT  -j RULE_19
    $IPTABLES -A INPUT  -j RULE_19
    $IPTABLES -A FORWARD  -j RULE_19
    $IPTABLES -A RULE_19  -m limit --limit 5/second -j ULOG  --ulog-nlgroup 1 --ulog-prefix "RULE 19 - DENY **" --ulog-qthreshold 1
    $IPTABLES -A RULE_19  -j DROP
}

ip_forward() {
    :
    echo 1 > /proc/sys/net/ipv4/ip_forward
}

reset_all() {
    :
    reset_iptables_v4
}

block_action() {
    reset_all
}

stop_action() {
    reset_all
    $IPTABLES -P OUTPUT  ACCEPT
    $IPTABLES -P INPUT   ACCEPT
    $IPTABLES -P FORWARD ACCEPT
}

check_iptables() {
    IP_TABLES="$1"
    [ ! -e $IP_TABLES ] && return 151
    NF_TABLES=$(cat $IP_TABLES 2>/dev/null)
    [ -z "$NF_TABLES" ] && return 152
    return 0
}
status_action() {
    check_iptables "/proc/net/ip_tables_names"
    ret_ipv4=$?
    check_iptables "/proc/net/ip6_tables_names"
    ret_ipv6=$?
    [ $ret_ipv4 -eq 0 -o $ret_ipv6 -eq 0 ] && return 0
    [ $ret_ipv4 -eq 151 -o $ret_ipv6 -eq 151 ] && {
        echo "iptables modules are not loaded"
    }
    [ $ret_ipv4 -eq 152 -o $ret_ipv6 -eq 152 ] && {
        echo "Firewall is not configured"
    }
    exit 3
}

# See how we were called.
# For backwards compatibility missing argument is equivalent to 'start'

cmd=$1
test -z "$cmd" && {
    cmd="start"
}

case "$cmd" in
    start)
        log "Activating firewall script generated Sun Mar 18 21:16:25 2012 by vadim"
        check_tools
        
        check_run_time_address_table_files
        
        load_modules "nat "
        configure_interfaces
        verify_interfaces
        
         reset_all 
         prolog_commands 
        script_body
        ip_forward
        epilog_commands
        RETVAL=$?
        ;;

    stop)
        stop_action
        RETVAL=$?
        ;;

    status)
        status_action
        RETVAL=$?
        ;;

    block)
        block_action
        RETVAL=$?
        ;;

    reload)
        $0 stop
        $0 start
        RETVAL=$?
        ;;

    interfaces)
        configure_interfaces
        RETVAL=$?
        ;;

    test_interfaces)
        FWBDEBUG="echo"
        configure_interfaces
        RETVAL=$?
        ;;



    *)
        echo "Usage $0 [start|stop|status|block|reload|interfaces|test_interfaces]"
        ;;

esac

exit $RETVAL