博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Ubuntu 11.04 as Wifi Router
阅读量:2234 次
发布时间:2019-05-09

本文共 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).

Step 2

sudo apt-get install isc-dhcp-server hostapd

Step 3

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

Step 4

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;}

Step 5

sudo pico /etc/default/isc-dhcp-server

INTERFACES="wlan0"

Step 6

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

Step 7

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

Step 8

Auto start DHCP Server and hostapd (AccessPoint)

sudo pico /etc/rc.local

service isc-dhcp-server starthostapd -dd /etc/hostapd/hostapd.conf

Reference

  • https://exain.wordpress.com/tag/rt2800usb/
  • https://help.ubuntu.com/community/IptablesHowTo

===============================================================================================================================

我自己的脚本[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/

你可能感兴趣的文章
如何理解MVC模型
查看>>
SpringMVC中乱码解决方案
查看>>
SpringMVC中时间格式转换的解决方案
查看>>
post和get请求相关知识点
查看>>
关于try finally 中的return语句的问题
查看>>
RequestBody/ResponseBody处理Json数据
查看>>
springmvc请求参数获取的几种方法
查看>>
在eclipse中创建和myeclipse一样的包结构
查看>>
Java中的IO流
查看>>
java中的关键字
查看>>
如果某个方法是静态的,它的行为就不具有多态性
查看>>
优化Hibernate所鼓励的7大措施
查看>>
Java 8系列之重新认识HashMap
查看>>
HashMap 、 ArrayList、String 重写了equals方法 而Object类(比如User)没有重写
查看>>
Servlet的生命周期
查看>>
Object中的getClass()返回的是当前运行的类
查看>>
加载驱动程序的方法
查看>>
深入理解java异常处理机制
查看>>
object类的基本方法
查看>>
回答阿里社招面试如何准备,顺便谈谈对于Java程序猿学习当中各个阶段的建议
查看>>