I have a bash script for initializing iptables.
#!/bin/sh
EXTIF="eth0"
INTIF="eth1"
INTIP="192.168.0.1/32"
EXTIP=$(/sbin/ip addr show dev "$EXTIF" | perl -lne 'if(/inet (\S+)/){print$1;last}');
UNIVERSE="0.0.0.0/0"
INTNET="192.168.0.1/24"
/sbin/iptables-restore -v < iptables.rules
I have iptables.rules
file containing something like this:
-A OUTPUT -o $EXTIF -s $UNIVERSE -d $INTNET -j REJECT
How can I pass those variables from bash script to iptables.rules
or evaluate them?