Wifiの簡易Hotspotを作る

#!/bin/bash
sysctl net.ipv4.ip_forward=1

iwconfig wlan0 mode Ad-Hoc
iwconfig wlan0 essid SSID_NAME_HERE
iwconfig wlan0 channel 3
iwconfig wlan0 key s:WEPKEY_HERE
ifconfig wlan0 192.168.222.1 up

iptables -tnat -A POSTROUTING -s 192.168.222.0/24 -o tun0 -j MASQUERADE
iptables -tnat -A POSTROUTING -s 192.168.222.0/24 -o eth0 -j MASQUERADE

クライアント側を静的IPアドレスで適当に設定。
192.168.222.2 / 255.255.255.0 / gw 192.168.222.2 / DNS 8.8.8.8