Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
replace centos 6.x iptables
# compile iptables from source and install to /usr/local
mkdir -p /tmp/iptables
wget "http://www.netfilter.org/projects/iptables/files/iptables-1.4.21.tar.bz2" -qO- | tar --strip-components=1 -C /tmp/iptables -xvj
cd /tmp/iptables
./configure
make
make install
# set alternatives
sudo alternatives --install /sbin/iptables iptables.x86_64 /usr/local/sbin/iptables 100 \
--slave /bin/iptables-xml bin-iptables-xml.x86_64 /usr/local/bin/iptables-xml \
--slave /sbin/iptables-multi sbin-iptables-multi.x86_64 /usr/local/sbin/iptables-multi \
--slave /sbin/iptables-restore sbin-iptables-restore.x86_64 /usr/local/sbin/iptables-restore \
--slave /sbin/iptables-save sbin-iptables-save.x86_64 /usr/local/sbin/iptables-save \
--slave /usr/share/man/man8/iptables-restore.8.gz man-iptables-restore.x86_64 /usr/local/share/man/man8/iptables-restore.8.gz \
--slave /usr/share/man/man8/iptables-save.8.gz man-iptables-save.x86_64 /usr/share/man/man8/iptables-save.8.gz \
--slave /usr/share/man/man8/iptables-xml.8.gz man-iptables-xml.x86_64 /usr/share/man/man8/iptables-xml.8.gz \
--slave /usr/share/man/man8/iptables.8.gz man-iptables.x86_64 /usr/share/man/man8/iptables.8.gz
sudo alternatives --set iptables.x86_64 /usr/local/sbin/iptables
sudo alternatives --install /sbin/ip6tables ip6tables.x86_64 /usr/local/sbin/ip6tables 100 \
--slave /sbin/ip6tables-multi sbin-ip6tables-multi.x86_64 /usr/local/sbin/ip6tables-multi \
--slave /sbin/ip6tables-restore sbin-ip6tables-restore.x86_64 /usr/localsbin/ip6tables-restore \
--slave /sbin/ip6tables-save sbin-ip6tables-save.x86_64 /usr/local/sbin/ip6tables-save \
--slave /usr/share/man/man8/ip6tables-restore.8.gz man-ip6tables-restore.x86_64 /usr/local/share/man/man8/ip6tables-restore.8.gz \
--slave /usr/share/man/man8/ip6tables-save.8.gz man-ip6tables-save.x86_64 /usr/local/share/man/man8/ip6tables-save.8.gz \
--slave /usr/share/man/man8/ip6tables.8.gz man-ip6tables.x86_64 /usr/local/share/man/man8/ip6tables.8.gz
sudo alternatives --set ip6tables.x86_64 /usr/local/sbin/ip6tables
@tuannh99

This comment has been minimized.

Copy link

@tuannh99 tuannh99 commented Oct 19, 2015

Thank you very much. This saved my day!

@krisla

This comment has been minimized.

Copy link

@krisla krisla commented Mar 18, 2017

Thanks for this man!

@quicktrick

This comment has been minimized.

Copy link

@quicktrick quicktrick commented Feb 16, 2018

It works great! Thanks a lot!

@kamaok

This comment has been minimized.

Copy link

@kamaok kamaok commented Mar 14, 2018

Works like a charm! Thanks a million!

@jasonwee

This comment has been minimized.

Copy link

@jasonwee jasonwee commented May 10, 2019

--slave /sbin/iptables-multi sbin-iptables-multi.x86_64 /usr/local/sbin/iptables-multi
--slave /sbin/ip6tables-multi sbin-ip6tables-multi.x86_64 /usr/local/sbin/ip6tables-multi \

are you sure ip*tables-multi is available at version 1.4.21?

@jasonwee

This comment has been minimized.

Copy link

@jasonwee jasonwee commented May 11, 2019

I have rpm spec for centos 6, https://gist.github.com/jasonwee/68289a3192c8960d3df0692b81441dce please tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment