Script iptables 80to8080.sh
Jump to navigation
Jump to search
#!/bin/sh # # Network firewall config PATH=/sbin:/bin:/usr/sbin:/usr/bin; RET_CODE=0 case "$1" in start) iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080; ;; stop) iptables -t nat -D PREROUTING -p tcp -i eth0 --dport 80 -j REDIRECT --to-port 8080; ;; status) iptables -t nat -L -n -v; ;; restart|reload|force-reload) echo "Error: argument '$1' not supported" >&2; RET_CODE=1; ;; *) echo "Usage: $0 {start|stop|status}"; RET_CODE=1; ;; esac; exit "${RET_CODE}"; # End