LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Closed Thread
  Search this Thread
Old 02-18-2010, 06:32 AM   #1
waranha
LQ Newbie
 
Registered: Jul 2009
Posts: 7

Rep: Reputation: 0
firewall script with MAC and IP


I have a file called mac.txt and inside it contains the following: IP and MAC,
192.168.0.10;F0:AF:FF:FE:FA:00

My script for firewall is as follows:

#!/bin/bash
for i in `cat /root/mac1.txt`;
do
MACSOURCE=`echo $i | cut -d ';' -f1`
IPSOURCE=`echo $i | cut -d ';' -f2`
iptables -t filter -A FORWARD -d 0/0 -s $IPSOURCE -m mac --mac-source $MACSOURCE -j ACCEPT
iptables -t filter -A FORWARD -d $IPSOURCE -s 0/0 -j ACCEPT
iptables -t filter -A INPUT -s $IPSOURCE -d 0/0 -m mac --mac-source $MACSOURCE -j ACCEPT
iptables -t nat -A POSTROUTING -s $IPSOURCE -o eth0 -j MASQUERADE
done
iptables v1.4.3.1: Bad mac address "192.168.0.10"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.3.1: host/network `F0:AF:FF:FE:FA:00' not found
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.3.1: Bad mac address "192.168.0.10"
Try `iptables -h' or 'iptables --help' for more information.
iptables v1.4.3.1: host/network `F0:ADF:FF:FE:FA:00' not found
Try `iptables -h' or 'iptables --help' for more information.

Please help me.
 
Old 02-18-2010, 07:21 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
The best firewall, with ip and mac blocks? rowebil Linux - Security 9 03-20-2009 09:12 AM
Laptop Firewall Considerations - MAC Addresses Meson Linux - Security 17 10-28-2007 11:04 AM
PIX firewall MAC address trebek Linux - Networking 2 08-12-2005 05:36 PM
MAC address filtering firewall? gigaah Linux - Security 5 06-07-2004 11:05 AM
slackware's /etc/rc.d/rc.firewall equivalent ||| firewall script startup win32sux Debian 1 03-06-2004 09:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration