According to the manpage, when running natd(8) with the option unregistered_only, it should
It should specifically not alter IPv6 packets - which it should not alter in any case because NAT is not allowed in IPv6.
So, my imagination was that it would either drop these packets, or move them through unaltered. (And in the latter case I would just add my IPv6 addresses to the rulesets and get all things working IPv6 without handling separate cases.)
In reality, however, things look as follows. This is the connection without NAT: a request to DNS is immediately rejected by the other end:
And this is how it looks as soon as a NAT is inserted in the flow:
Apparently the NAT does not only alter the packet, but prefers to happily send out to the network what looks like arbitrary memory content, in bulk. (And obviousely the destination does not even bother to reply to this.)
The NAT itself, when run in debug mode, reports this for the event:
So be careful when designing your rulesets and/or enabling IPv6. Somebody might be able to craft some packet that makes this scheme send out data that you would prefer to keep private.
(I'm not sure if this is a bug or just not supposed to be done.)
Only alter outgoing packets with an unregistered source
address. According to RFC 1918, unregistered source
addresses are 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16.
It should specifically not alter IPv6 packets - which it should not alter in any case because NAT is not allowed in IPv6.
So, my imagination was that it would either drop these packets, or move them through unaltered. (And in the latter case I would just add my IPv6 addresses to the rulesets and get all things working IPv6 without handling separate cases.)
In reality, however, things look as follows. This is the connection without NAT: a request to DNS is immediately rejected by the other end:
Code:
03:29:56.765409 IP6 fd00::8202.59916 > fd00::8101.53: Flags [S], seq 3969472462, win 65535, options [mss 1327,nop,wscale 6,sackOK,TS val 2962064279 ecr 0], length 0
03:29:57.042697 IP6 fd00::8101.53 > fd00::8202.59916: Flags [R.], seq 0, ack 3969472463, win 0, length 0
And this is how it looks as soon as a NAT is inserted in the flow:
Code:
03:33:09.280568 IP6 fd00::8202 > fd00::8101: frag (0|1336) 53499 > 53: Flags [S], seq 1481404086:1481405382, win 65535, options [mss 1327,nop,wscale 6,sackOK,TS val 1596323357 ecr 0], length 1296 304+% [304a] [304q] [304n] [304au] PTR? 0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f.ip6.arpa. PTR? 1.0.1.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.f.ip6.ARPA. MINFO (Class 4096)? .[|domain]
03:33:09.280579 IP6 fd00::8202 > fd00::8101: frag (1336|1336)
03:33:09.280580 IP6 fd00::8202 > fd00::8101: frag (2672|1336)
03:33:09.280581 IP6 fd00::8202 > fd00::8101: frag (4008|1336)
03:33:09.280582 IP6 fd00::8202 > fd00::8101: frag (5344|1336)
03:33:09.280583 IP6 fd00::8202 > fd00::8101: frag (6680|1336)
03:33:09.280584 IP6 fd00::8202 > fd00::8101: frag (8016|1336)
03:33:09.280585 IP6 fd00::8202 > fd00::8101: frag (9352|1336)
03:33:09.280586 IP6 fd00::8202 > fd00::8101: frag (10688|1336)
03:33:09.280586 IP6 fd00::8202 > fd00::8101: frag (12024|1336)
03:33:09.280587 IP6 fd00::8202 > fd00::8101: frag (13360|1336)
03:33:09.280588 IP6 fd00::8202 > fd00::8101: frag (14696|1336)
03:33:09.280589 IP6 fd00::8202 > fd00::8101: frag (16032|1336)
03:33:09.280590 IP6 fd00::8202 > fd00::8101: frag (17368|1336)
03:33:09.280591 IP6 fd00::8202 > fd00::8101: frag (18704|1336)
03:33:09.280592 IP6 fd00::8202 > fd00::8101: frag (20040|1336)
03:33:09.280593 IP6 fd00::8202 > fd00::8101: frag (21376|1336)
03:33:09.280593 IP6 fd00::8202 > fd00::8101: frag (22712|1336)
03:33:09.280594 IP6 fd00::8202 > fd00::8101: frag (24048|1336)
03:33:09.280595 IP6 fd00::8202 > fd00::8101: frag (25384|1336)
03:33:09.280596 IP6 fd00::8202 > fd00::8101: frag (26720|1336)
03:33:09.280597 IP6 fd00::8202 > fd00::8101: frag (28056|1336)
03:33:09.280598 IP6 fd00::8202 > fd00::8101: frag (29392|1336)
03:33:09.280600 IP6 fd00::8202 > fd00::8101: frag (30728|1336)
03:33:09.280604 IP6 fd00::8202 > fd00::8101: frag (32064|1336)
03:33:09.280605 IP6 fd00::8202 > fd00::8101: frag (33400|1336)
03:33:09.280606 IP6 fd00::8202 > fd00::8101: frag (34736|1336)
03:33:09.280607 IP6 fd00::8202 > fd00::8101: frag (36072|1336)
03:33:09.280608 IP6 fd00::8202 > fd00::8101: frag (37408|1336)
03:33:09.280609 IP6 fd00::8202 > fd00::8101: frag (38744|1336)
03:33:09.280610 IP6 fd00::8202 > fd00::8101: frag (40080|1336)
03:33:09.280611 IP6 fd00::8202 > fd00::8101: frag (41416|1336)
03:33:09.280612 IP6 fd00::8202 > fd00::8101: frag (42752|1336)
03:33:09.280613 IP6 fd00::8202 > fd00::8101: frag (44088|1336)
03:33:09.280614 IP6 fd00::8202 > fd00::8101: frag (45424|1336)
03:33:09.280615 IP6 fd00::8202 > fd00::8101: frag (46760|1336)
03:33:09.280616 IP6 fd00::8202 > fd00::8101: frag (48096|1336)
03:33:09.280617 IP6 fd00::8202 > fd00::8101: frag (49432|1336)
03:33:09.280617 IP6 fd00::8202 > fd00::8101: frag (50768|1336)
03:33:09.280618 IP6 fd00::8202 > fd00::8101: frag (52104|1336)
03:33:09.280619 IP6 fd00::8202 > fd00::8101: frag (53440|1336)
03:33:09.280620 IP6 fd00::8202 > fd00::8101: frag (54776|1336)
03:33:09.280621 IP6 fd00::8202 > fd00::8101: frag (56112|1336)
03:33:09.280622 IP6 fd00::8202 > fd00::8101: frag (57448|1336)
03:33:09.280626 IP6 fd00::8202 > fd00::8101: frag (58784|762)
Apparently the NAT does not only alter the packet, but prefers to happily send out to the network what looks like arbitrary memory content, in bulk. (And obviousely the destination does not even bother to reply to this.)
The NAT itself, when run in debug mode, reports this for the event:
Code:
Out {default}[0] [0] 0.0.0.0 -> 0.0.0.0 aliased to
[0] 0.0.0.0 -> 0.0.0.0
So be careful when designing your rulesets and/or enabling IPv6. Somebody might be able to craft some packet that makes this scheme send out data that you would prefer to keep private.
(I'm not sure if this is a bug or just not supposed to be done.)