Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm facing a problem while compiling iptables module for my 12.04 ubuntu with kernel v. 3.7.1.

The problem began with my system unable to show the list of rules for all chains in nat table

root:# iptables --table nat --list <br/>
root:# iptables v1.4.12: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)

I also can't find iptable_nat.ko in /lib/modules/3.7.1/kernel/net/ipv4/netfilter folder, so It always returns error every time I execute modprobe iptable_nat.

My next move is to compile all modules located in /usr/src/linux-3.7/net/ipv4/netfilter using with:

# make M=net/ipv4/netfilter -j2

And after the compiling process finished, there are lots of .ko files except iptable_nat.ko in /usr/src/linux-3.7/net/ipv4/netfilter folder. I've set IPv4 NAT as M in the kernel configuration before the compilation started.

How can I get iptable_nat.c compiled?

share|improve this question
add comment

1 Answer

I think that this wiki entry says it all:

Reasons for NOT compiling a custom kernel

  1. You merely need to compile a special driver. For this, you only need to install the linux-headers packages.
  2. You have no idea what you are doing, and if you break something, you'll need help fixing it. Depending on what you do wrong, you might end up having to reinstall your system from scratch.

If any of those conditions applies to you: just purge your compiled version of the kernel and install the pre-build kernel, included with any version of Ubuntu.

sudo apt-get --reinstall install linux-generic-lts-quantal linux-headers-3.5.0-23 linux-headers-generic-lts-quantal linux-image-generic-lts-quantal
share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.