本文共 1993 字,大约阅读时间需要 6 分钟。
Install Ubuntu 11.04 Server Edition on your netbook/old pc/thin client etc.. with default settings.
In my case I am using a thinclient (eth0 = wired ethernet adapter; wlan0 = wireless adapter).sudo apt-get install isc-dhcp-server hostapd
sudo pico /etc/hostapd/hostapd.conf
interface=wlan0 driver=nl80211 ssid=UbuntuAP hw_mode=g channel=11 wpa=1 wpa_passphrase=UbuntuAPPassPhrase wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP CCMP wpa_ptk_rekey=600
sudo pico /etc/dhcp/dhcpd.conf
default-lease-time 600;max-lease-time 7200;option subnet-mask 255.255.255.0;option broadcast-address 10.20.30.255;option domain-name "mydomain.example";subnet 10.20.30.0 netmask 255.255.255.0 { range 10.20.30.10 10.20.30.50; option domain-name-servers 8.8.4.4, 208.67.222.222; option routers 10.20.30.254;}
sudo pico /etc/default/isc-dhcp-server
INTERFACES="wlan0"
Enable IP Routing and save the IPtable rules.
sudo bash echo "1" > /proc/sys/net/ipv4/ip_forward iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables-save > /etc/iptables.rules
Assign static IP to Wireless adapter and auto load IPtable rules
sudo pico /etc/network/interfaces
auto wlan0iface wlan0 inet static address 10.20.30.254 netmask 255.255.255.0pre-up iptables-restore < /etc/iptables.rules
Auto start DHCP Server and hostapd (AccessPoint)
sudo pico /etc/rc.local
service isc-dhcp-server starthostapd -dd /etc/hostapd/hostapd.conf
===============================================================================================================================
我自己的脚本[ArchLinux]:
vpn-connectiptables -A FORWARD -s 10.42.0.0/24 -o ppp0 -j ACCEPTiptables -t nat -A POSTROUTING -s 10.42.0.0/24 -o ppp0 -j MASQUERADEecho 1 >/proc/sys/net/ipv4/ip_forwardip addr add 10.42.0.0/24 dev wlan0ip route add default via 10.42.0.1rc.d start dhcp4hostapd -B /etc/hostapd/hostapd.conf
转载地址:http://yanbb.baihongyu.com/