Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Can't initialize iptables table `nat'
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
noodles006
n00b
n00b


Joined: 18 Jan 2018
Posts: 19

PostPosted: Thu Feb 22, 2018 7:37 pm    Post subject: Can't initialize iptables table `nat' Reply with quote

I'm trying to set up my laptop to be able to share its wireless connection over ethernet following this guide: http://xmodulo.com/internet-connection-sharing-iptables-linux.html
Whenever I run
Code:
sudo iptables -t nat -X
, I get the following error:
Code:
iptables v1.6.1: can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

I reinstalled iptables with the nftables use flags enabled, and enabled the NFT_NAT module in the kernel. Here is the output of searching NFT_NAT:
Code:
 Symbol: NFT_NAT [=m]                                                                                                                           │
  │ Type  : tristate                                                                                                                               │
  │ Prompt: Netfilter nf_tables nat module                                                                                                         │
  │   Location:                                                                                                                                    │
  │     -> Networking support (NET [=y])                                                                                                           │
  │       -> Networking options                                                                                                                    │
  │         -> Network packet filtering framework (Netfilter) (NETFILTER [=y])                                                                     │
  │           -> Core Netfilter Configuration                                                                                                      │
  │ (1)         -> Netfilter nf_tables support (NF_TABLES [=m])                                                                                    │
  │   Defined at net/netfilter/Kconfig:536                                                                                                         │
  │   Depends on: NET [=y] && INET [=y] && NETFILTER [=y] && NF_TABLES [=m] && NF_CONNTRACK [=m]                                                   │
  │   Selects: NF_NAT [=m]

But I still get the same error message. I also initially compiled the kernel with genkernel all. What else do I need to enable?
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3554
Location: Hamburg

PostPosted: Thu Feb 22, 2018 8:27 pm    Post subject: Reply with quote

maybe CONFIG_NETFILTER_XT_NAT ?
Back to top
View user's profile Send private message
noodles006
n00b
n00b


Joined: 18 Jan 2018
Posts: 19

PostPosted: Thu Feb 22, 2018 8:46 pm    Post subject: Reply with quote

It says I have that enabled as a module
Code:
Symbol: NETFILTER_XT_NAT [=m]                                                                                                                  │ 
  │ Type  : tristate                                                                                                                               │ 
  │ Prompt: "SNAT and DNAT" targets support                                                                                                        │ 
  │   Location:                                                                                                                                    │ 
  │     -> Networking support (NET [=y])                                                                                                           │ 
  │       -> Networking options                                                                                                                    │ 
  │         -> Network packet filtering framework (Netfilter) (NETFILTER [=y])                                                                     │ 
  │           -> Core Netfilter Configuration                                                                                                      │ 
  │ (1)         -> Netfilter Xtables support (required for ip_tables) (NETFILTER_XTABLES [=y])                                                     │ 
  │   Defined at net/netfilter/Kconfig:835                                                                                                         │ 
  │   Depends on: NET [=y] && INET [=y] && NETFILTER [=y] && NETFILTER_XTABLES [=y] && NF_NAT [=m]                                                 │ 
  │   Selected by: IP_NF_NAT [=m] && NET [=y] && INET [=y] && NETFILTER [=y] && IP_NF_IPTABLES [=m] && NF_CONNTRACK_IPV4 [=m] || IP6_NF_NAT [=n] &
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 40809
Location: 56N 3W

PostPosted: Thu Feb 22, 2018 9:06 pm    Post subject: Reply with quote

noodles006,

What does
Code:
uname -a
say.
Maybe you are not using the kernel you think you are?

The date/time is the build date/time of the running kernel.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
noodles006
n00b
n00b


Joined: 18 Jan 2018
Posts: 19

PostPosted: Thu Feb 22, 2018 9:48 pm    Post subject: Reply with quote

You're right, I'm still using the older kernel. I have been runningn "make menuconfig", "make && make modules_install", and "make install", as root in /usr/src/linux. What do I need to do to make the system use the newer kernel build?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 40809
Location: 56N 3W

PostPosted: Thu Feb 22, 2018 10:09 pm    Post subject: Reply with quote

noodles006,

Code:
mount /boot
before the make install.
You will need to tell grub about the new kernel if the file name in boot has changed.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2309

PostPosted: Thu Feb 22, 2018 10:12 pm    Post subject: Reply with quote

noodles006 wrote:
You're right, I'm still using the older kernel. I have been runningn "make menuconfig", "make && make modules_install", and "make install", as root in /usr/src/linux. What do I need to do to make the system use the newer kernel build?


What boot loader are you using?

Is your /boot directory a partition?

Did you mount the /boot partition before you did make install?

If you're using grub AND your /boot partition was mounted when you did 'make install' then:

Code:

mount /boot
grub-mkconfig > /boot/grub/grub.cfg
reboot
Back to top
View user's profile Send private message
noodles006
n00b
n00b


Joined: 18 Jan 2018
Posts: 19

PostPosted: Thu Feb 22, 2018 10:33 pm    Post subject: Reply with quote

I'm using GRUB, and I had the /boot partition mounted before running make install. I ran
Code:
grub-mkconfig > /boot/grub/grub.cfg
before rebooting, but I still have the same output from "uname -a".
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 40809
Location: 56N 3W

PostPosted: Thu Feb 22, 2018 10:36 pm    Post subject: Reply with quote

noodles006,

Post the output of
Code:
ls -l /boot
and the content of grub.cfg
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
noodles006
n00b
n00b


Joined: 18 Jan 2018
Posts: 19

PostPosted: Thu Feb 22, 2018 10:39 pm    Post subject: Reply with quote

/boot:
Code:
total 63664
-rwxr-xr-x 1 root root   148137 Feb 22 16:28 config-4.9.76-gentoo-r1
-rwxr-xr-x 1 root root   148137 Feb 22 16:18 config-4.9.76-gentoo-r1.old
drwxr-xr-x 3 root root      512 Jan 18 15:50 EFI
drwxr-xr-x 6 root root      512 Jan 22 21:50 grub
-rwxr-xr-x 1 root root 39056740 Jan 18 06:00 initramfs-genkernel-x86_64-4.9.76-gentoo-r1
-rwxr-xr-x 1 root root  5403216 Jan 18 04:15 kernel-genkernel-x86_64-4.9.76-gentoo-r1
-rwxr-xr-x 1 root root  3208470 Feb 22 16:28 System.map-4.9.76-gentoo-r1
-rwxr-xr-x 1 root root  3208470 Feb 22 16:18 System.map-4.9.76-gentoo-r1.old
-rwxr-xr-x 1 root root  3208470 Jan 18 04:15 System.map-genkernel-x86_64-4.9.76-gentoo-r1
-rwxr-xr-x 1 root root  5403216 Feb 22 16:28 vmlinuz-4.9.76-gentoo-r1
-rwxr-xr-x 1 root root  5403216 Feb 22 16:18 vmlinuz-4.9.76-gentoo-r1.old


Grub.cfg:
Code:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}

function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt4'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  c4747800-c5ce-41f4-ad21-493cc776c002
else
  search --no-floppy --fs-uuid --set=root c4747800-c5ce-41f4-ad21-493cc776c002
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ x$feature_timeout_style = xy ] ; then
  set timeout_style=menu
  set timeout=5
# Fallback normal timeout code in case the timeout_style feature is
# unavailable.
else
  set timeout=5
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-c4747800-c5ce-41f4-ad21-493cc776c002' {
   load_video
   if [ "x$grub_platform" = xefi ]; then
      set gfxpayload=keep
   fi
   insmod gzio
   insmod part_gpt
   insmod fat
   set root='hd0,gpt2'
   if [ x$feature_platform_search_hint = xy ]; then
     search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  AB09-1E8D
   else
     search --no-floppy --fs-uuid --set=root AB09-1E8D
   fi
   echo   'Loading Linux x86_64-4.9.76-gentoo-r1 ...'
   linux   /kernel-genkernel-x86_64-4.9.76-gentoo-r1 root=UUID=c4747800-c5ce-41f4-ad21-493cc776c002 ro 
   echo   'Loading initial ramdisk ...'
   initrd   /initramfs-genkernel-x86_64-4.9.76-gentoo-r1
}
submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-c4747800-c5ce-41f4-ad21-493cc776c002' {
   menuentry 'Gentoo GNU/Linux, with Linux x86_64-4.9.76-gentoo-r1' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.9.76-gentoo-r1-advanced-c4747800-c5ce-41f4-ad21-493cc776c002' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  AB09-1E8D
      else
        search --no-floppy --fs-uuid --set=root AB09-1E8D
      fi
      echo   'Loading Linux x86_64-4.9.76-gentoo-r1 ...'
      linux   /kernel-genkernel-x86_64-4.9.76-gentoo-r1 root=UUID=c4747800-c5ce-41f4-ad21-493cc776c002 ro 
      echo   'Loading initial ramdisk ...'
      initrd   /initramfs-genkernel-x86_64-4.9.76-gentoo-r1
   }
   menuentry 'Gentoo GNU/Linux, with Linux x86_64-4.9.76-gentoo-r1 (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-x86_64-4.9.76-gentoo-r1-recovery-c4747800-c5ce-41f4-ad21-493cc776c002' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  AB09-1E8D
      else
        search --no-floppy --fs-uuid --set=root AB09-1E8D
      fi
      echo   'Loading Linux x86_64-4.9.76-gentoo-r1 ...'
      linux   /kernel-genkernel-x86_64-4.9.76-gentoo-r1 root=UUID=c4747800-c5ce-41f4-ad21-493cc776c002 ro single
      echo   'Loading initial ramdisk ...'
      initrd   /initramfs-genkernel-x86_64-4.9.76-gentoo-r1
   }
   menuentry 'Gentoo GNU/Linux, with Linux 4.9.76-gentoo-r1' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.76-gentoo-r1-advanced-c4747800-c5ce-41f4-ad21-493cc776c002' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  AB09-1E8D
      else
        search --no-floppy --fs-uuid --set=root AB09-1E8D
      fi
      echo   'Loading Linux 4.9.76-gentoo-r1 ...'
      linux   /vmlinuz-4.9.76-gentoo-r1 root=UUID=c4747800-c5ce-41f4-ad21-493cc776c002 ro 
      echo   'Loading initial ramdisk ...'
      initrd   /initramfs-genkernel-x86_64-4.9.76-gentoo-r1
   }
   menuentry 'Gentoo GNU/Linux, with Linux 4.9.76-gentoo-r1 (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.76-gentoo-r1-recovery-c4747800-c5ce-41f4-ad21-493cc776c002' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  AB09-1E8D
      else
        search --no-floppy --fs-uuid --set=root AB09-1E8D
      fi
      echo   'Loading Linux 4.9.76-gentoo-r1 ...'
      linux   /vmlinuz-4.9.76-gentoo-r1 root=UUID=c4747800-c5ce-41f4-ad21-493cc776c002 ro single
      echo   'Loading initial ramdisk ...'
      initrd   /initramfs-genkernel-x86_64-4.9.76-gentoo-r1
   }
   menuentry 'Gentoo GNU/Linux, with Linux 4.9.76-gentoo-r1.old' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.76-gentoo-r1.old-advanced-c4747800-c5ce-41f4-ad21-493cc776c002' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  AB09-1E8D
      else
        search --no-floppy --fs-uuid --set=root AB09-1E8D
      fi
      echo   'Loading Linux 4.9.76-gentoo-r1.old ...'
      linux   /vmlinuz-4.9.76-gentoo-r1.old root=UUID=c4747800-c5ce-41f4-ad21-493cc776c002 ro 
      echo   'Loading initial ramdisk ...'
      initrd   /initramfs-genkernel-x86_64-4.9.76-gentoo-r1
   }
   menuentry 'Gentoo GNU/Linux, with Linux 4.9.76-gentoo-r1.old (recovery mode)' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.76-gentoo-r1.old-recovery-c4747800-c5ce-41f4-ad21-493cc776c002' {
      load_video
      if [ "x$grub_platform" = xefi ]; then
         set gfxpayload=keep
      fi
      insmod gzio
      insmod part_gpt
      insmod fat
      set root='hd0,gpt2'
      if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  AB09-1E8D
      else
        search --no-floppy --fs-uuid --set=root AB09-1E8D
      fi
      echo   'Loading Linux 4.9.76-gentoo-r1.old ...'
      linux   /vmlinuz-4.9.76-gentoo-r1.old root=UUID=c4747800-c5ce-41f4-ad21-493cc776c002 ro single
      echo   'Loading initial ramdisk ...'
      initrd   /initramfs-genkernel-x86_64-4.9.76-gentoo-r1
   }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 40809
Location: 56N 3W

PostPosted: Thu Feb 22, 2018 10:49 pm    Post subject: Reply with quote

noodles006,

Its difficult to quote grub.cfg

Code:
menuentry 'Gentoo GNU/Linux'
...
   echo   'Loading Linux x86_64-4.9.76-gentoo-r1 ...'
   linux   /kernel-genkernel-x86_64-4.9.76-gentoo-r1 root=UUID=c4747800-c5ce-41f4-ad21-493cc776c002 ro
   echo   'Loading initial ramdisk ...'
   initrd   /initramfs-genkernel-x86_64-4.9.76-gentoo-r1
is your original Genkernel kernel.

You need to go into the
Code:
 submenu 'Advanced options for Gentoo GNU/Linux'


Then there is
Code:
menuentry 'Gentoo GNU/Linux, with Linux 4.9.76-gentoo-r1'
      echo   'Loading Linux 4.9.76-gentoo-r1 ...'
      linux   /vmlinuz-4.9.76-gentoo-r1 root=UUID=c4747800-c5ce-41f4-ad21-493cc776c002 ro
      echo   'Loading initial ramdisk ...'
      initrd   /initramfs-genkernel-x86_64-4.9.76-gentoo-r1

That loads your new kernel with the original initrd, which may or may not work because the old modules in the initrd may not match the new kernel.
You can read all about it in dmesg.

If you want to do it cleanly, have genkernel do it all and make a new initrd too, or make a kernel by hand that does not require an initrd.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
noodles006
n00b
n00b


Joined: 18 Jan 2018
Posts: 19

PostPosted: Thu Feb 22, 2018 11:28 pm    Post subject: Reply with quote

This seems to work, thank you very much! I will also look into making a kernel by hand.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum