LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-16-2015, 12:12 AM   #1
psycroptic
Member
 
Registered: Aug 2011
Location: USA
Distribution: ArchLinux - 3.0 kernel
Posts: 349

Rep: Reputation: Disabled
ip6tables - allow specific port number v6 traffic to specific machine


I have enabled IPv6 w/prefix delegation on my Comcast-connected Arch Linux router; 2 ethernet ports, WAN and LAN. The router splits a Comcast DHCPv6-provided 2601::/64 subnet for use on an internal LAN interface, with LAN systems getting autoconfig addresses from radvd. I have a basic ip6tables which default DROPs on INPUT and FORWARD chains, ACCEPTs all traffic incoming on the LAN interface , and ACCEPTs related/established connections & ICMPv6 messages on INPUT and FORWARD chains. I would like to open a specific port through to allow a listening service on a LAN machine to be world-accessible. I have not found out how to do this on a client-specific basis. I am currently wishing to open port 1234, and am doing so with the following:

Code:
ip6tables -A FORWARD -p tcp --dport 1234 -j ACCEPT
Which works, but is sort of a "blanket" allow, whereby any system on the LAN that has a v6 service listening on port 1234 is accessible from the WAN. In an IPv4 scenario, I would set a static internal address for the listening client, and then filter the iptables rule by both port number and destination (static) address for the client. But with IPv6, I can't really do that. The 2601:: addresses provided by Comcast change from time to time, and I don't want to configure ULA addresses on LAN clients because of compatibility problems I've heard with certain OSes (the client is Win7 in this case).

ACCEPTing traffic to a dport of 1234 and a particular destination MAC would do the job, but I haven't found a way to do this with iptables/ip6tables.

Any ideas? Here is the full /etc/iptables/ip6tables.rules (WAN interface is named "external", LAN is "internal"):

Code:
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p icmpv6 -j ACCEPT
-A INPUT -p udp --dport 546 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i internal -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

-A FORWARD -i internal -j ACCEPT
-A FORWARD -i lo -j ACCEPT
-A FORWARD -p icmpv6 -j ACCEPT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -p tcp --dport 1234 -j ACCEPT

COMMIT
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get FTP to use a specific port number? evansd321 Linux - Server 2 03-17-2011 11:32 AM
Routing traffic by port number to specific interface meekamoo Linux - Networking 3 01-17-2011 08:14 AM
sed replacing a specific character with a specific number ieatbunnies Linux - Newbie 2 11-04-2010 10:14 AM
monitoring traffic on specific port lildee Programming 2 10-03-2009 06:03 AM
Blocking outgoing traffic from a specific port billy3 Linux - Security 10 09-24-2004 08:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration