Skip to content

Instantly share code, notes, and snippets.

@danehans
Last active September 24, 2019 12:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danehans/2ca5b731cd69063c2560a1d12ff81e9e to your computer and use it in GitHub Desktop.
Save danehans/2ca5b731cd69063c2560a1d12ff81e9e to your computer and use it in GitHub Desktop.
Jool NAT64

Note: Dues to Jool's GRO offload limitation, it can not be used in cloud environments such as GCE.

Jool NAT64 (WIP)

NAT64 runs on an Ubuntu 16.04.2 host and is implemented using Jool v3.5.4. Start by installing the Jool dependencies:

sudo apt-get update && sudo apt-get install -y zip gcc make linux-headers-$(uname -r) dkms \
pkg-config libnl-genl-3-dev autoconf

Install the Jool kernel module:

curl -O https://raw.githubusercontent.com/NICMx/releases/master/Jool/Jool-3.5.4.zip
unzip Jool-3.5.4.zip 
sudo dkms install Jool-3.5.4

Install the Jool userspace application:

cd Jool-3.5.4/usr && ./autogen.sh && ./configure && sudo make && sudo make install

Update sysctl to allow IPv6 forwarding:

sudo bash -c 'cat << EOF > /etc/sysctl.conf
net.ipv6.conf.all.forwarding=1
EOF'
sudo sysctl -p

If 'jool' does not show up in $PATH, add an alias for jool:

cat >> ~/.bashrc << EOF
# Alias definitions
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi
EOF

echo "alias jool='/usr/local/bin/jool'" >> ~/.bash_aliases
source ~/.bashrc

Load the Jool kernel module via modprobe:

sudo modprobe jool

Configure the Jool IPv4 address and port range used for translating synthetic IPv6 addresses:

sudo jool -4 -a 10.138.0.2 7000-8000 

Verify the Jool IPv4 address pool:

jool -4 -d
0	TCP	10.138.0.2	7000-8000
0	UDP	10.138.0.2	7000-8000
0	ICMP	10.138.0.2	7000-8000
  (Fetched 3 samples.)

Configure the synthetic IPv6 prefix used by Jool to NAT IPv6-only client addresses. The prefix specifies synthetic IPv6 addresses and should match the prefix used by DNS64.

sudo jool -6 -a 64:ff9b::/96 

Verify the Jool IPv6 prefix:

jool -6 -d
64:ff9b::/96
  (Fetched 1 entries.)

Verify the status of Jool:

jool -d

  Status: Enabled
  Manually enabled (--enable, --disable): ON
<SNIP>

Enable jool if jool -d shows Status: Disabled:

jool --enable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment