How to create a static iptables executable
Nov 22, 2021
podman run -v /tmp:/tmp -it docker.io/gentoo/stage3:musl /bin/bashwget https://www.netfilter.org/projects/libnftnl/files/libnftnl-1.2.1.tar.bz2wget https://www.netfilter.org/projects/libmnl/files/libmnl-1.0.4.tar.bz2wget https://www.netfilter.org/projects/iptables/files/iptables-1.8.7.tar.bz2for f in $(ls *.tar.bz2); do tar -xvf $f; donecd libmnl-1.0.4
./configure --enable-static --disable-shared --prefix=/usr
make LDFLAGS="--static"
make install
cd ..cd libnftnl-1.2.1
./configure --enable-static --disable-shared --prefix=/usr
make LDFLAGS="--static"
make install
cd ..cd iptables-1.8.7
./configure --enable-static --disable-shared
make LDFLAGS="--static"
make install
cd ..cp /usr/local/sbin/xtables* /tmp/