Block list of client based on MAC address using IPTables

I want to block list of client who accessing the port TCP 8080.  Blocking based on MAC address. I having MAC details in text file. It possible to give the MAC input to iptables from a text file?
Who is Participating?
tty2Connect With a Mentor Commented:
Type it manually in shell for executing one time.
Add this to local start script for executing when system starts.
Or save the state of iptables after typing it in shell for loading current state at system start up (see the manuals for your system).
while read i; do iptables -A INPUT -p tcp -m tcp --dport 8080 -m mac --mac-source "$i" -j DROP; done < mac_list.txt
rajasekarramasamyAuthor Commented:
Hi tty2,

 where should i put this script?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.