# ipfw configuration file.txt



## luzzo (Apr 29, 2013)

Hi, do you know if it is possible to set a series of IP addresses in a text file and use it in this way:

```
$IPF 90 allow all from 37.59.15.197,127.0.0.1,"file.txt" to any
```

If it is possible do you know how the right syntax must be in file.txt? And where is the path of file.txt?


----------



## bkouhi (Apr 29, 2013)

Not related but you can use "lookup tables". Instead of a file, you can use a lookup table to save a large set of IP addresses, port numbers, etc. For example:

`ipfw table 1 add 192.168.1.1`
`ipfw table 1 add 192.168.2.0/24`

`ipfw add 100 allow all from table(1) to any`

Where "1" is table number. Please refer to ipfw(8)() for more information.

HTH


----------



## qsecofr (Apr 29, 2013)

```
# IPs i want to block
exec < /etc/rc.ipfw_blocked_ip.txt
while read ip
do
        $ipfw -q table 2 add $ip
done

$ipfw -q add deny ip from table\(2\) to any in via $oif
```
The text file is just a simple list of dotted-decimal IP addresses, one per line.


----------

