Share wired internet connection wireless

This was done with Atheros AR5001 (ath5k, Linux Mint 10, 2.6.35).

Install hostapd and DHCP-server.

apt-get install hostapd dhcp3-server

/etc/hostapd/hostapd.conf:

interface=wlan0
driver=nl80211
ssid=SSID
hw_mode=g
channel=7
wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
wpa_ptk_rekey=600

/etc/dhcp3/dhcpd.conf:

subnet 10.10.0.0 netmask 255.255.255.0 {
        range 10.10.0.25 10.10.0.100;
        option domain-name-servers 193.213.112.4, 130.67.15.198;
        option routers 10.10.0.1;
}

Add to /etc/default/hostapd:

RUN_DAEMON="yes"
DAEMON_CONF="/etc/hostapd/hostapd.conf"

/etc/default/dhcp3-server:

INTERFACES="wlan0"

/usr/local/bin/ics:

#!/bin/bash

case "${1}" in
  start)
	# stop gnome network manager
	service network-manager stop
	# configure wireless IP
	ifconfig wlan0 10.10.0.1 netmask 255.255.255.0 up
	# start AP and DHCP-server
	service hostapd start
	service dhcp3-server start
	# enable NAT
	echo "1" > /proc/sys/net/ipv4/ip_forward
	iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
  ;;
  stop)
	# disable NAT
	echo "0" > /proc/sys/net/ipv4/ip_forward
	iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
	# stop DHCP-server and AP
	service dhcp3-server stop
	service hostapd stop
	# start gnome network manager
	service network-manager start
	# wait 1 second and enable scanning on wireless
	sleep 1
	ifconfig wlan0 up
  ;;
esac

exit 0

Add with to sudoers(with visudo):

# Allow admin users to share internet connection
%admin ALL=NOPASSWD:/usr/local/bin/ics

Add shortcut to desktop with command “sudo /usr/local/bin/ics start” and “sudo /usr/local/bin/ics stop”.