Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-27-2003, 09:29 AM
|
#1
|
|
Member
Registered: Jul 2003
Location: Frankfurt, Germany
Distribution: Mint, Ubuntu, Knoppix, RHEL
Posts: 64
Rep:
|
iptables - blocking a host by MAC address
Hi folks,
Please shed some light upon my linux question:
In my LAN, the host with IP 192.68.0.113 has some Winblows virus that is generating outgoing traffic on my network. I donṫ know where this PC is, since it wasnṫ given a DHCP name. I issued the following three commands but they didnṫ stop the traffic:
iptables -I INPUT -s 192.168.0.113 -j DROP
iptables -I OUTPUT -s 192.168.0.113 -j DROP
iptables -I FORWARD -s 192.168.0.113 -j DROP
I wanna try blocking it by its MAC address. How do I do that?
I am running RH9.0
Thanks in advance.
|
|
|
|
08-27-2003, 10:16 AM
|
#2
|
|
Member
Registered: Apr 2003
Location: Chicago, IL
Distribution: openbsd 3.6, slackware 10.0
Posts: 244
Rep:
|
do this (make sure you have the ipt_mac module loaded, too)
iptables -A INPUT -p ALL -m mac --mac-source <insert MAC of offending computer here> -j DROP
this matches the source of the packet to a given MAC, then drops it if it matches (might be obvious, but just in case  ). you can also put this in the FORWARD/OUTPUT chain to stop stuff (depends on your iptables).
gl,
y-p
|
|
|
|
08-27-2003, 09:31 PM
|
#3
|
|
Member
Registered: Aug 2001
Location: Off the coast of Madadascar
Posts: 498
Rep:
|
What sort of equipment is conncting the PCs in the network? If its Cisco catalyst equipment I might be able to help track the PC down.
--tarballedtux
|
|
|
|
08-28-2003, 01:56 PM
|
#4
|
|
Member
Registered: Jul 2003
Location: Frankfurt, Germany
Distribution: Mint, Ubuntu, Knoppix, RHEL
Posts: 64
Original Poster
Rep:
|
Yocompia:
iptables -A INPUT -p ALL -m mac --mac-source <insert MAC of offending computer here> -j DROP
didnṫ work!
I also added
iptables -A FORWARD -p ALL -m mac --mac-source <insert MAC of offending computer here> -j DROP
and tried adding
iptables -A OUTPUT -p ALL -m mac --mac-source <insert MAC of offending computer here> -j DROP
but it would give me an ¨īnvalid argument" error
In any case, I still have the problem. Here is my lsmod output, just in case:
[root@proxy root]# lsmod
Module Size Used by Not tainted
ipt_mac 1208 2
soundcore 7108 0 (autoclean)
autofs 13700 0 (autoclean) (unused)
tulip 44256 1
pcnet32 18304 1
mii 2268 0 [pcnet32]
iptable_filter 2412 1 (autoclean)
ip_tables 15864 2 [ipt_mac iptable_filter]
mousedev 5688 1
keybdev 2976 0 (unused)
hid 22404 0 (unused)
input 6240 0 [mousedev keybdev hid]
usb-uhci 27276 0 (unused)
usbcore 80512 1 [hid usb-uhci]
ext3 72960 3
jbd 56752 3 [ext3]
ips 45088 4
sd_mod 13552 8
scsi_mod 110408 2 [ips sd_mod]
|
|
|
|
08-28-2003, 01:57 PM
|
#5
|
|
Member
Registered: Jul 2003
Location: Frankfurt, Germany
Distribution: Mint, Ubuntu, Knoppix, RHEL
Posts: 64
Original Poster
Rep:
|
tarballedtux:
I have an old Cisco 2500 and a few CNET and SMC hubs.
|
|
|
|
08-28-2003, 04:59 PM
|
#6
|
|
Member
Registered: Aug 2001
Location: Off the coast of Madadascar
Posts: 498
Rep:
|
If the that particular cisco switch can be consoled. Use these commands to find the station:
Get into EXEC mode and type this command:
show mac-address table <mac address>
If the port it says connected to another switch hopefully its a cisco otherwise you have a lead at the least.
--tarballedtux
|
|
|
|
08-29-2003, 11:58 AM
|
#7
|
|
Member
Registered: Apr 2003
Location: Chicago, IL
Distribution: openbsd 3.6, slackware 10.0
Posts: 244
Rep:
|
it's definitely odd that that rule doesn't work. i have a rule like that to match the MAC of my remote computer and it works fine. here's are some rules (verbatim; except for changed MAC) i have in my iptables:
# allows DHCPACK for setup of w-lan
$IPTABLES -A INPUT -p UDP -i wlan0 --dport 67 --sport 68 -m mac --mac-source <remote MAC> -j ACCEPT
...
# allow ssh in from horatio
$IPTABLES -A INPUT -p TCP -i wlan0 --dport 22 -m mac --mac-source <remote MAC> -j ACCEPT
# only let established/related ssh connections to chimaera in from horatio
$IPTABLES -A INPUT -p TCP -i wlan0 -m state --state ESTABLISHED,RELATED -m mac --mac-source <remote MAC> -j ACCEPT
...
# allows w-lan valid outgoing through, but stops new/invalid connections through wlan0
$IPTABLES -A FORWARD -i ppp0 -o wlan0 -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i wlan0 -o ppp0 -m state ! --state INVALID -m mac --mac-source <remote MAC> -j ACCEPT
these rules all work on my router/firewall box. it's odd that the rule didn't work, but maybe it has something to do with the cisco stuff that tarballed has been talking about.
gl,
y-p
|
|
|
|
| Thread Tools |
Search this 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
HTML code is Off
|
|
|
All times are GMT -5. The time now is 11:19 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|