有些 FullconeNAT 实现是优先保持原端口的,例如
https://github.com/Chion82/netfilter-full-cone-nat/blob/master/xt_FULLCONENAT.c#L432```c
if ((range->flags & NF_NAT_RANGE_PROTO_RANDOM)
|| (range->flags & NF_NAT_RANGE_PROTO_RANDOM_FULLY)) {
/* for now we do the same thing for both --random and --random-fully */
/* select a random starting point */
start = (uint16_t)(prandom_u32() % (u32)range_size);
} else {
if ((original_port >= min && original_port <= min + range_size - 1)
|| !(range->flags & NF_NAT_RANGE_PROTO_SPECIFIED)) {
/* 1. try to preserve the port if it's available */
mapping = get_mapping_by_ext_port(original_port, ifindex);
if (mapping == NULL || !(check_mapping(mapping, net, zone))) {
return original_port;
}
}
/* otherwise, we start from zero */
start = 0;
}
```