optional hosts-based snat-dnat tools modified to generate iptables restore config
[svn/Prometheus-QoS/.git] / optional-tools / make-pimp
1 #!/bin/bash
2 pimp_2way_nat="/mnt/mtdblock0/pimp-2way-nat.tmp"
3 pimp_snat="/mnt/mtdblock0/pimp-snat.tmp"
4 etchosts="/mnt/mtdblock0/hosts"
5
6 echo -n "Writing $pimp_2way_nat"
7 echo "#This file was generated by Prometheus-tools/make-pimp" > $pimp_2way_nat
8 for czfip in `grep -v ^# $etchosts|grep [[]|cut -f 1`
9 do
10 pubip=`grep "^$czfip " $etchosts|cut -f 2 -d "["|cut -f 1 -d "]"`
11 if ! [ -z $pubip ]
12 then
13 echo "$czfip $pubip" >> $pimp_2way_nat
14 echo -n .
15 fi
16 done
17 echo " done."
18
19 echo -n "Writing $pimp_snat"
20 echo "#This file was generated by Prometheus-tools/make-pimp" > $pimp_snat
21 for czfip in `grep -v ^# $etchosts|grep "("|cut -f 1`
22 do
23 pubip=`grep "^$czfip " $etchosts|cut -f 2 -d "("|cut -f 1 -d ")"`
24 if ! [ -z "$pubip" ]
25 then
26 echo "$czfip $pubip" >> $pimp_snat
27 echo -n .
28 fi
29 done
30 echo " done."
This page took 0.240993 seconds and 4 git commands to generate.