Skip to content

Commit

Permalink
vpc-nat-gateway: use iptables-legacy for centos 7
Browse files Browse the repository at this point in the history
Signed-off-by: zhangzujian <[email protected]>
  • Loading branch information
zhangzujian committed Aug 22, 2024
1 parent 6bfbfe8 commit ab6b57c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dist/images/vpcnatgateway/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ RUN set -ex \
&& apk add --no-cache \
bash \
iproute2 \
iptables \
iptables iptables-legacy \
iputils \
tcpdump \
conntrack-tools
Expand Down
6 changes: 6 additions & 0 deletions dist/images/vpcnatgateway/nat-gateway.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/usr/bin/env bash

# use iptables-legacy for centos 7
if iptables-legacy -t nat -S INPUT 1 2>/dev/null; then
alias iptables=iptables-legacy
alias iptables-save=iptables-legacy-save
fi

function exec_cmd() {
cmd=${@:1:${#}}
$cmd
Expand Down

0 comments on commit ab6b57c

Please sign in to comment.