dev-vm/scripts/forwardports.sh

11 lines
253 B
Bash

#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -t nat -F
iptables -X
iptables -t nat -A PREROUTING -p tcp --dport 80 -j DNAT --to 192.168.56.11:80
iptables -t nat -A POSTROUTING -p tcp -d 192.168.56.11 --dport 80 -j MASQUERADE