Centos – How to build and update iptables latest version for CentOS 7

centoscentos7iptablesmake

Due to a bug (similar to this one) i'm facing with iptables in Centos 7, I'd like to update the version of iptables.

# yum update iptables
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.coreix.net
 * epel: mirror.de.leaseweb.net
 * extras: mirrors.coreix.net
 * updates: mirrors.coreix.net
No packages marked for update
# iptables -V
iptables v1.4.21

So I figured I'd update to either the latest (from their git) or to the tagged 1.6.0.

I managed to add the libraries needed to get ./autogen.sh to run, then managed to ./configure --disable-nftables and make and make install.

Now i'm not sure how I can run this version to test it, and how to implement it if it works as the default iptables.

Best Answer

I've found an online article that was spot on.

If this helps anyone, the steps I took before this article were the following:

git clone git://git.netfilter.org/iptables.git
cd iptables
sudo yum install kernel-devel autoconf automake libtool

Then the online article I followed does:

./configure --prefix=/usr      \
            --sbindir=/sbin    \
            --disable-nftables \
            --enable-libipq    \
            --with-xtlibdir=/lib/xtables &&
make

sudo su

make install &&
ln -sfv ../../sbin/xtables-multi /usr/bin/iptables-xml &&

for file in ip4tc ip6tc ipq iptc xtables
do
  mv -v /usr/lib/lib${file}.so.* /lib &&
  ln -sfv ../../lib/$(readlink /usr/lib/lib${file}.so) /usr/lib/lib${file}.so
done