#/bin/bash
iptables -t nat -v -L -n --line-number
echo -n "IP VM who want to exposed (x.x.x.x:port): "
read ip_vm
echo $ip_vm
echo -n "Enter Port Access: "
read port
echo $port
echo "Will be accessible on port $port"
iptables -t nat -A PREROUTING -p tcp --dport $port -d 1.2.3.4 -j DNAT --to-destination $ip_vm
iptables -t nat -v -L -n --line-number
echo "VM with IP $ip_vm will be publicly on 1.2.3.4:$port"
echo "Escalation Succesfully"
#/bin/bash
iptables -t nat -v -L -n --line-number
echo -n "Please enter type IP Tables (PREROUTING/POSTROUTING): "
read TYPE
#echo $TYPE
echo -n "Please enter line number who want you to delete: "
read number
#echo $number
iptables -t nat --delete $TYPE $number
iptables -t nat -v -L -n --line-number
echo "IP Tables with Line number $number & $TYPE type has been deleted"