Meine Frage bezieht sich auf Multicasts und iptables
.
Ich möchte ICMP- und IGMP-Multicasts sowohl vom lokalen VLAN 192.168.1.0/24
als auch von 0.0.0.0
auf meinem CentOS-Computer zulassen. Daher habe ich meiner eingehenden Kette folgende Regeln hinzugefügt:
# ACCEPT - Multicast 224.0.0.1 from current VLAN as well as 0.0.0.0 # -- ICMP iptables -A IP-INPUT -s 192.168.1.0/24 -d 224.0.0.1 -m pkttype --pkt-type multicast --protocol icmp -j ACCEPT iptables -A IP-INPUT -s 0.0.0.0 -d 224.0.0.1 -m pkttype --pkt-type multicast --protocol icmp -j ACCEPT # -- IGMP iptables -A IP-INPUT -s 192.168.1.0/24 -d 224.0.0.1 -m pkttype --pkt-type multicast --protocol igmp -j ACCEPT iptables -A IP-INPUT -s 0.0.0.0 -d 224.0.0.1 -m pkttype --pkt-type multicast --protocol igmp -j ACCEPT
Ich habe auch sichergestellt, dass das Kernel-Modul xt_pkttype
geladen ist.
Aber das scheint nicht zu funktionieren ... Ich verstehe:
Oct 12 09:06:22 192.168.1.102 IPTABLES: :: IN::DENY 2 0.0.0.0 ==> 224.0.0.1
Ich habe festgestellt, dass in der Deny-Zeile anstelle des Namens (IGMP
) die Protokollnummer (2
) angezeigt wird, aber das scheint keine Rolle zu spielen. Wenn ich in den Regeln --protocol igmp
durch --protocol 2
ersetze, ist es dasselbe.
Nach einigem Googeln fiel mir auch auf, dass einige Leute es so machen, aber es funktioniert auch nicht für mich:
# ACCEPT - Multicast 224.0.0.1 from current VLAN as well as 0.0.0.0 iptables -A IP-INPUT -s 192.168.1.0/24 -d 224.0.0.1 -j ACCEPT iptables -A IP-INPUT -s 0.0.0.0 -d 224.0.0.1 -j ACCEPT
Wenn relevant, verwende ich iptables
Version 1.4.7
unter CentOS 6.3
mit Kernel-Version 2.6.32-279.19.1.el6.x86_64
.
Kann mir jemand helfen? Danke im Voraus!
Bearbeiten:
/etc/sysconfig/iptables
(siehe unten)# Generated by iptables-save v1.4.7 on Wed Jan 16 14:33:55 2013 *filter :INPUT DROP [0:0] :FORWARD DROP [0:0] :OUTPUT DROP [0:0] :IP-FORWARD - [0:0] :IP-INPUT - [0:0] :IP-OUTPUT - [0:0] -A INPUT -j IP-INPUT -A FORWARD -j IP-FORWARD -A OUTPUT -j IP-OUTPUT -A IP-FORWARD -j LOG --log-prefix "server-FORWARD: " -A IP-FORWARD -j DROP -A IP-INPUT -i lo -m comment --comment "ACCEPT all packets ON LOOPBACK" -j ACCEPT -A IP-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A IP-INPUT -s 192.168.1.0/24 -d 224.0.0.1/32 -p icmp -m pkttype --pkt-type multicast -j ACCEPT -A IP-INPUT -d 224.0.0.1/32 -p icmp -m pkttype --pkt-type multicast -j ACCEPT -A IP-INPUT -s 192.168.1.0/24 -d 224.0.0.1/32 -p igmp -m pkttype --pkt-type multicast -j ACCEPT -A IP-INPUT -d 224.0.0.1/32 -p igmp -m pkttype --pkt-type multicast -j ACCEPT -A IP-INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 22 -m state --state NEW -j ACCEPT -A IP-INPUT -p icmp -f -m comment --comment "DROP fragmented icmp" -j DROP -A IP-INPUT -p icmp -m comment --comment "ACCEPT incoming icmp" -j ACCEPT -A IP-INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -m comment --comment "DROP packets with illegal flags" -j DROP -A IP-INPUT -p tcp -m tcp --tcp-flags FIN,SYN FIN,SYN -j DROP -A IP-INPUT -p tcp -m tcp --tcp-flags SYN,RST SYN,RST -j DROP -A IP-INPUT -p tcp -m tcp --tcp-flags FIN,RST FIN,RST -j DROP -A IP-INPUT -p tcp -m tcp --tcp-flags FIN,ACK FIN -j DROP -A IP-INPUT -p tcp -m tcp --tcp-flags PSH,ACK PSH -j DROP -A IP-INPUT -p tcp -m tcp --tcp-flags ACK,URG URG -j DROP -A IP-INPUT -m state --state INVALID -j LOG -A IP-INPUT -m state --state INVALID -j DROP -A IP-INPUT -j LOG --log-prefix "server-INPUT: " -A IP-OUTPUT -m state --state INVALID -j LOG --log-prefix "server-OUTPUT: " -A IP-OUTPUT -m state --state INVALID -j DROP -A IP-OUTPUT -o lo -m comment --comment "ACCEPT all packets ON LOOPBACK" -j ACCEPT -A IP-OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A IP-OUTPUT -p icmp -f -m comment --comment "DROP fragmented icmp" -j DROP -A IP-OUTPUT -p icmp -m comment --comment "ACCEPT outgoing icmp" -j ACCEPT -A IP-OUTPUT -j LOG --log-prefix "server-OUTPUT: " COMMIT # Completed on Wed Jan 16 14:33:55 2013
Sie haben Ihre Regeln NACH den Regeln hinzugefügt, die Ihren Verkehr protokollieren und VERLASSEN. Diese Regeln sollten die letzten Regeln in der Tabelle sein. Ordne die Linien einfach so an, dass sie zuletzt erscheinen.
Wenn Ihr Computer auf Multicast-Ping antworten soll, müssen Sie
ausführensysctl -w net.ipv4.icmp_echo_ignore_broadcasts=0
Standardmäßig wird dieser ICMP-Broadcast/Multicast aus offensichtlichen Gründen ignoriert.