Disclaimer: Not using IPv6 but I've read a few articles etc. .......in case I'm forced to!I guess it's not possible?
I don't think this approach would work anymore, although it depends on the particular client. For example, since Windows 7 randomised identifiers are used by default instead of EUI-64. This was introduced as part of the privacy extension for SLAAC.
At least the OP has a possible solution and can ultimately decide if it is feasible for his environment/privacy requirements.I don't think this approach would work anymore, although it depends on the particular client. For example, since Windows 7 randomised identifiers are used by default instead of EUI-64. This was introduced as part of the privacy extension for SLAAC.
PS C:\Users\admin> Get-NetIPv6Protocol
DefaultHopLimit : 128
NeighborCacheLimit(Entries) : 256
RouteCacheLimit(Entries) : 4096
ReassemblyLimit(Bytes) : 66145536
IcmpRedirects : Enabled
SourceRoutingBehavior : DontForward
DhcpMediaSense : Enabled
MediaSenseEventLog : Disabled
MldLevel : All
MldVersion : Version2
MulticastForwarding : Disabled
GroupForwardedFragments : Disabled
RandomizeIdentifiers : Disabled <<====== Overidden
AddressMaskReply : Disabled
UseTemporaryAddresses : Enabled
MaxTemporaryDadAttempts : 3
MaxTemporaryValidLifetime : 7.00:00:00
MaxTemporaryPreferredLifetime : 1.00:00:00
TemporaryRegenerateTime : 00:00:05
MaxTemporaryDesyncTime : 00:10:00
DeadGatewayDetection : Enabled
I'd guess it would depend on the particular Linux distro you're using in your Docker container. It may already be using EUI-64 addresses so check for that before wasting time trying to change something that doesn't need changing.Thanks for all the replies
As I mentioned, it's Linux based so it might work.
As I'm a newbie, and guidance how to achieve my goal (I understand that it's not via GUI) would be appreciated.
ipset -! create myip6device hash:ip family inet6 timeout 86400
ip6tables -A PREROUTING -i br0 -m conntrack --ctstate NEW -m mac --mac-source aa:bb:cc:dd:ee:ff -j SET --add-set myip6device src --exist
ip6tables -A FORWARD -i eth0 -m set --match-set myip6device dst -J ACCEPT
Follow the rule example in the article linked by Martineau, specifying your fixed suffixWhat I need is a way to make a rule in firewall which will take into account the dynamic prefix and the fixed suffix.
::aaaa:bbbb:cccc:dddd/::ffff:ffff:ffff:ffff
as the template for the host portion of the address. Leave the ffff’s as they are.Could a script be made that dynamically update the firewall rules as the ipv6 prefix changes? simply define the rules up under a chain, as the prefix changes an event based script is triggered that simply updates the rules inside the chain?Depending on what you want your rule to do, you might consider combining ip6tables and ipset to get a MAC-based solution.
This might not work, but demonstrates the idea:
- Create an inet6 hash:ip ipset with a 1-day timeout.
- Create an ip6tables PREROUTING rule that matches a specified MAC address and add the local address to the ipset created above.
- Create your desired rule matching on the ipset which will be updated as new prefixes or SLAAC addresses come and go.
Code:ipset -! create myip6device hash:ip family inet6 timeout 86400 ip6tables -A PREROUTING -i br0 -m conntrack --ctstate NEW -m mac --mac-source aa:bb:cc:dd:ee:ff -j SET --add-set myip6device src --exist ip6tables -A FORWARD -i eth0 -m set --match-set myip6device dst -J ACCEPT
This is by far probably the simplest solution I have seen in a while. Awesome share @Martineau!Follow the rule example in the article linked by Martineau, specifying your fixed suffix::aaaa:bbbb:cccc:dddd/::ffff:ffff:ffff:ffff
as the template for the host portion of the address. Leave the ffff’s as they are.
Well.....only if it actually works?This is by far probably the simplest solution I have seen in a while. Awesome share @Martineau!
::0023:a3a3:beff:fe89:93af/::00ff:ffff:ffff:ffff:ffff
No one said the easiest/simplest is the safest .Well.....only if it actually works?
P.S. I was hoping that an IPv6 Guru would chime in to say beware!....a minor security issue with it as-is, is that it opens up all inbound subnets, so if you have say a /56 from your provider then you should really restrict it to just the relevant one of your /64 subnets.
eg. Only subnet 0x23
Can't recall/find the relevant article/reference at the moment, but this does sound plausible?Code:::0023:a3a3:beff:fe89:93af/::00ff:ffff:ffff:ffff:ffff
::
, the firmware assumes it’s an eui64 address and adds the bitmask automatically.# ip6tables -S FORWARD | grep beef
-A FORWARD -d ::abcd:dead:beef:cafe/::ffff:ffff:ffff:ffff -p tcp -m state --state NEW -m tcp --dport 7695 -j ACCEPT
A bit off to the side but how are you dealing with ipv6 in docker containers with a dynamic prefix?The clients are Linux based (actually docker containers)
Well in the docker-compose.yml you have to specify the subnet for the network it creates.Be more specific
No "dealing" is required
The docker is getting IPV6 based on the (dynamic) prefix and fixed suffix (based on Mac address).
And port opening is based on the suffix like suggested by the guys above.
networks:
lan:
name: lan
driver: macvlan
enable_ipv6: true
driver_opts:
parent: eth0
ipam:
config:
- subnet: 2600:1111:2222:3333::/64
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!