On many virtual servers, NAT and other iptables modules may not be loaded by default. This module is critical for using types of network address translation like MASQUERADE.
To test whether your Linux VPS or server has the NAT module loaded, run the following command and check for the example output (meaning NAT is not installed).
# iptables -t nat -L
iptables v1.4.7: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
To solve this, simply run the modprobe command to load the module:
modprobe iptable_nat
That’s it! NAT and related address translation modules are now active and loaded on your system.
You may receive errors similar to these:
WARNING: Error inserting nf_conntrack_ipv4 (/lib/modules/2.6.32-431.11.2.el6.x86_64/kernel/net/ipv4/netfilter/nf_conntrack_ipv4.ko): Cannot allocate memory
WARNING: Error inserting nf_nat (/lib/modules/2.6.32-431.11.2.el6.x86_64/kernel/net/ipv4/netfilter/nf_nat.ko): Cannot allocate memory
WARNING: Error inserting ip_tables (/lib/modules/2.6.32-431.11.2.el6.x86_64/kernel/net/ipv4/netfilter/ip_tables.ko): Cannot allocate memory
FATAL: Error inserting iptable_nat (/lib/modules/2.6.32-431.11.2.el6.x86_64/kernel/net/ipv4/netfilter/iptable_nat.ko): Cannot allocate memory
In this case, the server’s (or virtual server’s) RAM is insufficient, so you should add some additional memory to the server before trying the modprobe command again.