dnsmasq.conf
# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
dhcp-range=192.168.1.50,192.168.1.150,12h
dhcp-range=192.168.2.50,192.168.2.150,12hh
net.sh
#!/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
killall hostapd
/etc/init.d/dnsmasq stop
### iface down
ifconfig eth0 down
ifconfig wlan0 down
sleep 3
### iface up
ifconfig eth0 192.168.1.1/24 up
ifconfig wlan0 192.168.2.1/24 up
sleep 3
/etc/init.d/dnsmasq start
### Enable routing
echo 1 > /proc/sys/net/ipv4/ip_forward
### reset iptables
iptables -P INPUT DROP
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
iptables -F -t nat
iptables -F -t mangle
iptables -X
iptables -X -t nat
iptables -X -t mangle
### lo
iptables -A INPUT -i lo -j ACCEPT
### For fixing problem
iptables -I FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
### MASQUERADE
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
### ppp0
iptables -A INPUT -i ppp0 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
### eth0
iptables -A INPUT -p ALL -i eth0 -j ACCEPT
### wlan0
iptables -A INPUT -p ALL -i wlan0 -j ACCEPT
hostapd -B /etc/hostapd.conf
exit 0