Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to drop ALL the ipv4 traffic on a certain port and only allow ipv6 traffic with iptables. Is it possible? is so, how?

share|improve this question
    
You should be setting your chain policies to default to drop. So all you have to do is not add rule to permit traffic. If you already have a complex rule set, then you might need to tell us what rules you currently have, so we can tell you what to add, and where. –  Zoredache Jun 28 '12 at 18:37
    
When you say port, do you mean an ethernet port, or a protocol port (please specify TCP or UDP) –  Mike Pennington Jun 28 '12 at 18:47
add comment

2 Answers

You can't do this directly with just iptables as it only controls ipv4. To interact with netfilter for ipv6 you have to use the ip6tables command. To block the IPv4 port just use iptables as you would normally e,g,

iptables -I INPUT -p tcp --dport 80 -j DROP

To open the IPv6 port use ip6tables e.g.

ip6tables -I INPUT -p tcp --dport 80 -j ACCEPT
share|improve this answer
add comment

Presumably the best way to block all IPv4 traffic is not to have an IPv4 address on the port; I'm not sure why iptables would be needed to drop all IPv4 traffic.

share|improve this answer
    
You could conceivably want to do something like this for testing purposes. –  Iain Jun 28 '12 at 18:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.