REND 0 Posted 2005-01-11 19:09:48 Share Posted 2005-01-11 19:09:48 есть файлик со списком адресов (ip_list), нужно разрешить доступ к компьютеру только с этих адресов, правила файровола для доступа пишу так: ---rc.firewall--- for i in 'cat ip_list'; do iptables -A INPUT ! -s $i -j DROP; done при выполнении скрипта выдаётся ошибка: Bad argument `ip_list' Подскажите в чём табла пожалуйста Link to post Share on other sites
Keen 10 Posted 2005-01-11 19:25:18 Share Posted 2005-01-11 19:25:18 В общем данная тема уже тут обсуждалась.... Вот тебе пример, только у меня задача чуть обратная: Если пакет на данный адресс - разрешить, иначе ДРОП. #!/bin/sh IPFILE="/etc/stargazer/ips.txt" grep "^" $IPFILE | while read ip; do if [ $ip <> NULL ] then iptables -A UA_IX -d $ip -j ACCEPT fi done iptables -A UA_IX -j DROP Link to post Share on other sites
REND 0 Posted 2005-01-12 18:58:16 Author Share Posted 2005-01-12 18:58:16 Спасибо большое, скрипт получился такой: #!/bin/sh IPFILE="ip_file" grep "^" $IPFILE | while read ip; do if [ $ip <> NULL ] then iptables -A INPUT -s $ip -j ACCEPT fi done iptables -A INPUT -j DROP Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now