Hi,
I need to write a Shell or Perl script for updating iptables on Linux servers, Let me explain the concept.
need to change iptable entries for many our servers located at different countries, so script would be run by any users.
Let us keep it as 3-locations(india, singapore, malaysia) each location has different ip's.
my sample script
Code:
#/bin/bash
india=10.31.0.1
singapore=10.31.0.2
malaysia=10.31.0.3
echo "Enter the country name:"
read country
if [ `$country=$singapore` ]
sed -i /192.168.0.1/$singapore/" /etc/sysconfig/iptables
else
echo "error"
fi
OUTPUT sample:
./ipchange.sh
Enter the country name: singapore
(after entering the country name, script should verify and update the user required country ip-address. So everything will be embedded with the script)
ipatables updated sucessfully.
Kindly help me out to create a clear script for the same.
Regards,
Subash.