--- tags: Linux, Network --- # can't initialize iptables table `nat': Table does not exist ## Scenario Original ubuntu16.04 with Linux 3.5 kernel, I changed it to Linux 4.4.35 kernel. Under the new kernel environment, I make some network settings. When I was using the iptables command like: ```shell $ iptables -t nat -A POSTROUTING -o $EIF -s $INNET -j MASQUERADE ``` An error happened is shown as below. ```shell iptables v1.4.12: can't initialize iptables table `nf_nat': Table does not exist (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded. ``` ## Solution When you try to execute modprobe iptable_nat, the system return "FATAL" Module iptable_nat not found. It means that you don't have this kind of modules. So you need to recompile your kernel to enable related modules. * make menuconfig * Networking support -> Network packet filtering framework (Netfilter) * Enter "Core Netfilter Configuration" and to modularize features for all sub-items of Netfilter nf_tables support. * Go back previous config menu and enter "IP: Netfilter Configuration" * Modularize IPv4 NAT and all the sub-items of iptables NAT support * save .config * recompile linux kernel * sudo make -j8 * sudo make modules -j8 * sudo make modules_install * sudo make install * sudo reboot