Hello tout le monde, je m’attaque du routage avancé sur un packetfence (NAC) avec plusieurs interfaces:
Eth0 : interface de management
Eth1 : interface pour le trafic utilisateur wifi
Eth2.15 : guest wifi
Eth2.16 : wifi interne
A l’heure actuelle voila les manipulations faites sur la distrib pour router tout le trafic provenant de Eth2.15 vers eth1 et qui ne fonctionne pas (j’ai toujours eth0 comme patte de sortie) :
Activation du routage dans le noyau
net.ipv4.ip_forward=1
création d’une “rule” de routage et d’une table dédié au traffic wifi
ip rule add from all fwmark 1 table wifi
/etc/iproute2/rt_tables
#
# reserved values
#
255 local
254 main
253 default
0 unspec
#
# local
#
#1 inr.ruhep
1 wifi
ajout d’une route par défaut pour la table wifi
iproute add default dev eth1 table wifi
root@packetfence:~# ip route show table 1
default dev eth1 scope link
Marquage des paquet en provenance de eth2.15 (192.168.15.0/24) via IPtables
iptables -t mangle -A PREROUTING -s 192.168.15.0/24 -j MARK --set-mark 1
root@packetfence:~# iptables -L --table mangle
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
MARK all -- 192.168.15.0/24 anywhere MARK set 0x1
Chain INPUT (policy ACCEPT)target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
Chain postrouting-int-inline-if (0 references)
target prot opt source destination
Chain prerouting-int-inline-if (0 references)
target prot opt source destination
la table de routage par défaut n’a pas été touché (puissque la table wifi doit être prioritaire pour les paquets marqués avec la valeur “1”)
root@packetfence:~# route
Table de routage IP du noyau
Destination Passerelle Genmask Indic Metric Ref Use Ifacedefault
192.168.120.1 0.0.0.0 UG 0 0 0 eth0
192.168.15.0 * 255.255.255.0 U 0 0 0 eth2.15
192.168.16.0 * 255.255.255.0 U 0 0 0 eth2.16
192.168.17.0 * 255.255.255.0 U 0 0 0 eth1
192.168.120.0 * 255.255.255.0 U 0 0 0 eth0
Le marquage fonctionne bien en “pré-routage” :
root@packetfence:~# iptables -L -v -n -t mangle
Chain PREROUTING (policy ACCEPT 99212 packets, 24M bytes)
pkts bytes target prot opt in out source destination
8142 461K MARK all -- * * 192.168.15.0/24 0.0.0.0/0 MARK set 0x1
Chain INPUT (policy ACCEPT 90924 packets, 23M bytes)
pkts bytes target prot opt in out source destination
Chain FORWARD (policy ACCEPT 7562 packets, 412K bytes)
pkts bytes target prot opt in out source destination
Chain OUTPUT (policy ACCEPT 89915 packets, 23M bytes)
pkts bytes target prot opt in out source destination
Chain POSTROUTING (policy ACCEPT 97477 packets, 23M bytes)
pkts bytes target prot opt in out source destination
Chain postrouting-int-inline-if (0 references)
pkts bytes target prot opt in out source destination
Chain prerouting-int-inline-if (0 references)
pkts bytes target prot opt in out source destination
root@packetfence:~#
Mais j’ai toujours le trafic sur mon firewall provenant d’eth0 . Je suis preneur pour des pistes et ou reflection autour de ce problème, personnellement je bute…
bonne journée