toots pisze:Kod: Zaznacz cały
iptables -A INPUT -p tcp ! -s właściwy_adres_ip -m mac --mac-source mac_adres -j DROP
Zabiłeś kotka takim lamerstwem.
Do takich rzeczy jest ipset:
http://www.varlog.pl/2010/03/ipset-znany-i-nieznany/
man ipset pisze:
bitmap:ip,mac
The bitmap:ip,mac set type uses a memory range to store IPv4 and a MAC
address pairs. A bitmap:ip,mac type of set can store up to 65536
entries.
CREATE-OPTIONS := range fromip-toip|ip/cidr [ timeout value ]
ADD-ENTRY := ip[,macaddr]
ADD-OPTIONS := [ timeout value ]
DEL-ENTRY := ip[,macaddr]
TEST-ENTRY := ip[,macaddr]
Mandatory options to use when creating a bitmap:ip,mac type of set:
range fromip-toip|ip/cidr
Create the set from the specified inclusive address range
expressed in an IPv4 address range or network. The size of the
range cannot exceed the limit of maximum 65536 entries.
The bitmap:ip,mac type is exceptional in the sense that the MAC part
can be left out when adding/deleting/testing entries in the set. If we
add an entry without the MAC address specified, then when the first
time the entry is matched by the kernel, it will automatically fill out
the missing MAC address with the source MAC address from the packet. If
the entry was specified with a timeout value, the timer starts off when
the IP and MAC address pair is complete.
The bitmap:ip,mac type of sets require two src/dst parameters of the
set match and SET target netfilter kernel modules and the second one
must be src to match, add or delete entries because the set match and
SET target have access to the source MAC address only.
Examples:
ipset create foo bitmap:ip,mac range 192.168.0.0/16
ipset add foo 192.168.1.1,12:34:56:78:9A:BC
ipset test foo 192.168.1.1
RTFM:
Pozdro

Problemy rozwiązujemy na forum nie na PW -> Niech inni na tym skorzystają.
Komputer jest jak klimatyzacja - gdy otworzysz okna, robi się bezużyteczny...
Linux User #499936
Inny OS: Gentoo Linux
