Iptables : pb avec le module physdev

Fermé
viellepe Messages postés 5 Date d'inscription mercredi 14 octobre 2009 Statut Membre Dernière intervention 18 décembre 2009 - 14 oct. 2009 à 11:10
lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 - 16 oct. 2009 à 18:19
iptables : pb pour utiliser le module physdev

Bonjour,

Il m'est impossible d'utiliser le module physdev avec iptables !

root@viellepe:/proc/net/netfilter# iptables -A FORWARD -m physdev
iptables v1.3.7: Couldn't load match 'physdev' : File not found

Ma config :
Kamikaze 7.09
kernel 2.6.21.6
iptables v1.3.7

J'ai installé aussi les packages suivants :

root@viellepe:/proc/net/netfilter# ipkg files kmod-ipt-extra
Package kmod-ipt-extra (2.6.21.6-ixp4xx-1) is installed on root and has the fol:
/lib/modules/2.6.21.6/ipt_owner.ko
/etc/modules.d/40-ipt-extra
/lib/modules/2.6.21.6/xt_pkttype.ko
/lib/modules/2.6.21.6/xt_portscan.ko
/lib/modules/2.6.21.6/xt_CHAOS.ko
/lib/modules/2.6.21.6/xt_DELUDE.ko
/lib/modules/2.6.21.6/iptable_raw.ko

Done.

root@viellepe:/proc/net/netfilter# ipkg files iptables-mod-extra
Package iptables-mod-extra (1.3.7-1) is installed on root and has the following files:
/usr/lib/iptables/libipt_DELUDE.so
/usr/lib/iptables/libipt_owner.so
/usr/lib/iptables/libipt_portscan.so
/usr/lib/iptables/libipt_CHAOS.so
/usr/lib/iptables/libipt_pkttype.so
/usr/lib/iptables

Done.

D'après ce que j'ai lu, normalement le module physdev devrait être inclus dans kmod-mod-extra
Il semble que non !

Je ne sais vraiment plus quoi faire pour pouvoir utiliser ce module qui est le seul moyen pour moi de faire du filtrage de paquets sur ma machine transformée en bridge. Mon bridge est constituée d'une interface virtuelle br-lan regroupant les interfaces physiques eth0 et ath0. Il faut que je filtre sur eth0 des paquets rentrants avec certaines adresses IP.

Merci de votre aide, vous me serez d'un grand secours !

PS : Il semble aussi que la commande ebtables soit impossible à utiliser sur ma version :
root@viellepe:/proc/net/netfilter# ebtables -A FORWARD
The kernel does not support the ebtables 'filter' table
(ebtables 2.0.8-rc2-2 is installed)

1 réponse

lami20j Messages postés 21331 Date d'inscription jeudi 4 novembre 2004 Statut Modérateur, Contributeur sécurité Dernière intervention 30 octobre 2019 3 567
16 oct. 2009 à 18:19
Salut,

Pour vérifier si le module est intégré

lami20j@debian:~$ grep -i physdev /boot/config-$(uname -r)
CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m


Ensuite regarde man iptables

   physdev
       This module matches on the bridge port input and output devices enslaved to a bridge device. This module is a part of the infrastructure that enables a transparent bridging IP firewall and is only useful for kernel versions
       above version 2.5.44.

       [!] --physdev-in name
              Name  of  a  bridge  port  via which a packet is received (only for packets entering the INPUT, FORWARD and PREROUTING chains). If the interface name ends in a "+", then any interface which begins with this name will
              match. If the packet didn't arrive through a bridge device, this packet won't match this option, unless '!' is used.

       [!] --physdev-out name
              Name of a bridge port via which a packet is going to be sent (for packets entering the FORWARD, OUTPUT and POSTROUTING chains).  If the interface name ends in a "+", then any interface which  begins  with  this  name
              will match. Note that in the nat and mangle OUTPUT chains one cannot match on the bridge output port, however one can in the filter OUTPUT chain. If the packet won't leave by a bridge device or it is yet unknown what
              the output device will be, then the packet won't match this option, unless '!' is used.

       [!] --physdev-is-in
              Matches if the packet has entered through a bridge interface.

       [!] --physdev-is-out
              Matches if the packet will leave through a bridge interface.

       [!] --physdev-is-bridged
              Matches if the packet is being bridged and therefore is not being routed.  This is only useful in the FORWARD and POSTROUTING chains.


iptables -A FORWARD -m physdev

Tu dois utiliser comme ça par exemple (mais c'est à toi d'adapter en fonction de ta configuration et besoins)
iptables -A FORWARD -m physdev --physdev-in eth0 --physdev-out eth1 -j ACCEPT
1