#!/bin/bash INT=eth0 EXT=wlan0 INT_IP=192.168.2.2 INT_RANGE=192.168.2.10,192.168.2.50 # Start ifconfig $INT $INT_IP sysctl net.ipv4.ip_forward=1 iptables -t nat -A POSTROUTING -o $EXT -j MASQUERADE dnsmasq -d -zi $INT -F $INT_RANGE -C /dev/null -l /tmp/dnsmasq.leases # Stop iptables -D POSTROUTING -t nat -o $EXT -j MASQUERADE sysctl net.ipv4.ip_forward=0