At present, Netfilter Jool only hooks itself to PRE_ROUTING. It does not attach itself to LOCAL_OUT. This means it can only translate traffic that inbounds from some interface (physical or otherwise). It does not intercept packets sourced from its own network namespace.
# 为 jool_siit 配置一个独立的 Network Namespace ip netns add joolns ip link add name to_jool type veth peer name to_world ip linkset up dev to_jool ip linkset dev to_world netns joolns ip netns exec joolns ip linkset up dev to_world to_jool_addr=$(ip -6 addr show scope link dev to_jool | grep 'inet6' | awk '{print $2}' | cut -d/ -f1) to_world_addr=$(ip netns exec joolns ip -6 addr show scope link dev to_world | grep 'inet6' | awk '{print $2}' | cut -d/ -f1)
# 配置连接 jool_siit 的接口 ip netns exec joolns ip -6 route add default via $to_jool_addr dev to_world ip netns exec joolns ip addr add 192.0.2.2/24 dev to_world ip route add $clat_ip/128 via $to_world_addr dev to_jool ip addr add 192.0.2.1/24 dev to_jool ip route del 0.0.0.0/0 ip route add default via 192.0.2.2 dev to_jool
# 配置 jool_siit modprobe jool_siit echo 1 | tee /proc/sys/net/ipv6/conf/*/forwarding ip netns exec joolns sysctl -w net.ipv4.conf.all.forwarding=1 ip netns exec joolns sysctl -w net.ipv6.conf.all.forwarding=1 ip netns exec joolns jool_siit instance add --netfilter --pool6 $plat_prefix ip netns exec joolns jool_siit eamt add 192.0.2.1 $clat_ip