把笔记本变路由器

包含网卡/无线网的网络问题和ADSL/校园网/宽带拨号支持及代理/共享等网络使用问题
回复
头像
Rothsdad
帖子: 396
注册时间: 2009-04-18 11:41

把笔记本变路由器

#1

帖子 Rothsdad » 2009-10-12 18:10

操作平台:GNU/Linux(推荐Archlinux)
硬件要求:PC or Mac + 无线网卡
知识要求:会按键盘 + 不断尝试

先确定自己的无线网卡,我的是eth1

代码: 全选

iwconfig
在root权限下,输入一下代码会将无限网卡切换到广播模式(有些网卡不支持,可以上网查一查)

代码: 全选

iwconfig eth1 mode ad-hoc
然后设定广播频道,我设定的是4 (1~11均可,根据不同的网卡会有不同)

代码: 全选

iwconfig eht1 channel 4
接着设定无线名称,我的是633

代码: 全选

iwconfig eth1 essid 633
最后设定wep密码(wpa,wpa2及混合加密留给大家完成吧)

代码: 全选

iwconfig eth1 key abcde12345
其他设置自己动手实践一下吧!

完毕!现在你拥有一台自制路由啦!
上次由 Rothsdad 在 2009-10-14 10:12,总共编辑 3 次。
重温经典,回归MUD
viewtopic.php?f=34&t=235277

我的博客,一些心得,欢迎分享哦
http://hi.baidu.com/rothsdad/home
aprilus
帖子: 184
注册时间: 2008-10-21 23:33

Re: 把笔记本变路由器

#2

帖子 aprilus » 2009-10-12 18:52

标记下,有机会试试……不过eth开头的默认是有线网卡吧?无线的是wlan0这样的呀。
fuckingtheworld
帖子: 6
注册时间: 2009-10-13 0:00

Re: 把笔记本变路由器

#3

帖子 fuckingtheworld » 2009-10-13 19:00

如何限制MAC?

还有别的设置吗 给个文档撒 :em11
头像
john.wu
帖子: 1006
注册时间: 2007-10-18 17:40

Re: 把笔记本变路由器

#4

帖子 john.wu » 2009-10-13 21:46

Rothsdad 写了:操作平台:GNU/Linux(推荐Archlinux)
硬件要求:PC or Mac + 无线网卡
知识要求:会按键盘 + 不断尝试

先确定自己的无线网卡,我的是eth1

代码: 全选

iwconfig
在root权限下,输入一下代码会将无限网卡切换到广播模式(有些网卡不支持,可以上网查一查)

代码: 全选

iwconfig eth1 mode ad-hoc
然后设定广播频道,我设定的是4 (1~11均可,根据不同的网卡会有不同)

代码: 全选

iwconfig eht1 channel 4
接着设定无线名称,我的是633

代码: 全选

iwconfig eth1 essid 633
最后设定wep密码(wpa,wpa2及混合加密留给大家完成吧)

代码: 全选

iwconfig eth1 key abcde12345
设定接入点ip

代码: 全选

ifconfig 169.254.xxx.xxx
完毕!现在你拥有一台自制路由啦!
没看到转发方面的设置,特别是最后一句,ifconfig什么设备都没指定,楼主有没有实践过?

ifconfig [interface]
ifconfig interface [aftype] options | address ...

千帖户,享有论坛特权!
头像
Rothsdad
帖子: 396
注册时间: 2009-04-18 11:41

Re: 把笔记本变路由器

#5

帖子 Rothsdad » 2009-10-14 10:10

只是个引子,这不是新手指南,自己动手,丰衣足食哦 :em04
重温经典,回归MUD
viewtopic.php?f=34&t=235277

我的博客,一些心得,欢迎分享哦
http://hi.baidu.com/rothsdad/home
chpn
帖子: 415
注册时间: 2007-02-28 11:33

Re: 把笔记本变路由器

#6

帖子 chpn » 2009-10-14 10:33

lsj@x-laptop:~$ iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wmaster0 no wireless extensions.

wlan0 IEEE 802.11abgn ESSID:"NETGEAR"
Mode:Managed Frequency:2.462 GHz Access Point: 00:1B:2F:5F:C6:58
Bit Rate=54 Mb/s Tx-Power=15 dBm
Retry min limit:7 RTS thr:off Fragment thr=2352 B
Power Management:off
Link Quality=67/100 Signal level:-61 dBm Noise level=-88 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

vboxnet0 no wireless extensions.

pan0 no wireless extensions.

lsj@x-laptop:~$ sudo -s
[sudo] password for lsj:
root@x-laptop:~# iwconfig wlan0 ad-hoc
iwconfig: unknown command "ad-hoc"
root@x-laptop:~# iwconfig wlan0 mode ad-hoc
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Device or resource busy.
root@x-laptop:~# ifconfig wlan0 down
root@x-laptop:~# iwconfig wlan0 mode ad-hoc
root@x-laptop:~# iwconfig wlan0 channel 4
root@x-laptop:~# iwconfig wlan0 essid 633
Error for wireless request "Set ESSID" (8B1A) :
SET failed on device wlan0 ; Input/output error.
root@x-laptop:~# iwconfig wlan0 essid xxx
Error for wireless request "Set ESSID" (8B1A) :
SET failed on device wlan0 ; Input/output error.
root@x-laptop:~# iwconfig wlan0 key aaaaaa
Error for wireless request "Set Encode" (8B2A) :
SET failed on device wlan0 ; Invalid argument.
root@x-laptop:~# ifconfig wlan0 up
root@x-laptop:~# iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wmaster0 no wireless extensions.

wlan0 IEEE 802.11abgn ESSID:"NETGEAR"
Mode:Managed Frequency:2.462 GHz Access Point: 00:1B:2F:5F:C6:58
Bit Rate=54 Mb/s Tx-Power=15 dBm
Retry min limit:7 RTS thr:off Fragment thr=2352 B
Encryption key:8FFF-F698-A496-AE33-B1C4-D3C2-4602-C073-A18E-1A1D-21D7-EA92-9680-C69A-045A-52A3 [3] Security mode:open
Power Management:off
Link Quality=67/100 Signal level:-59 dBm Noise level=-86 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

vboxnet0 no wireless extensions.

pan0 no wireless extensions.

root@x-laptop:~#
头像
bbeikke
帖子: 880
注册时间: 2008-10-14 21:54

Re: 把笔记本变路由器

#7

帖子 bbeikke » 2009-10-16 10:00

楼主可不可以再详细些。。。
给个文档也好啊。。。
地狱可以想象,天堂却无法描述。
头像
Rothsdad
帖子: 396
注册时间: 2009-04-18 11:41

Re: 把笔记本变路由器

#8

帖子 Rothsdad » 2009-10-16 11:31

重温经典,回归MUD
viewtopic.php?f=34&t=235277

我的博客,一些心得,欢迎分享哦
http://hi.baidu.com/rothsdad/home
sailershen
帖子: 225
注册时间: 2008-04-08 13:24

Re: 把笔记本变路由器

#10

帖子 sailershen » 2009-10-16 13:14

我的本本是HP mini 2410,在ubuntu 9.10下无线网卡是eth2,我用的命令如下:

代码: 全选

sudo iwconfig eth2 mode ad-hoc
sudo iwconfig eth2 channel 11
sudo iwconfig eth2 essid sailershen
sudo iwconfig eth2 key abcdef
再用iptables做一个nat:

代码: 全选

#!/bin/sh
echo 1 > /proc/sys/net/ipv4/ip_forward
modprobe iptable_nat
modprobe ip_conntrack
modprobe ip_conntrack_ftp
iptables -F INPUT
iptables -F FORWARD
iptables -F POSTROUTING -t nat
iptables -t nat -F
iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.1.0/16 -o ppp0 -j MASQUERADE
我的本本IP是192.168.1.1,只要其它人连到我这个无线ap,再手工设置192.168.1网段的IP,网关指向192.168.1.1,dns设置好,不知道哪里的问题,客户端ping不通192.168.1.1,也不能通过这个网关上网。
头像
Rothsdad
帖子: 396
注册时间: 2009-04-18 11:41

Re: 把笔记本变路由器

#11

帖子 Rothsdad » 2009-10-16 15:59

共享上网必须将eth0和wlan0相关联哦~(对于有线上网,无线共享的情况)
重温经典,回归MUD
viewtopic.php?f=34&t=235277

我的博客,一些心得,欢迎分享哦
http://hi.baidu.com/rothsdad/home
头像
wangdu2002
帖子: 13284
注册时间: 2008-12-13 19:39
来自: 物华天宝人杰地灵

Re: 把笔记本变路由器

#12

帖子 wangdu2002 » 2009-10-16 16:01

没有无线条件的先标记备用之。 :em04
行到水穷处,坐看云起时。
海内生明月,天涯共此夕。
--------------------吾本独!
wkt
帖子: 849
注册时间: 2006-09-07 22:51
联系:

Re: 把笔记本变路由器

#13

帖子 wkt » 2009-10-16 16:11

chpn 写了:lsj@x-laptop:~$ iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wmaster0 no wireless extensions.

wlan0 IEEE 802.11abgn ESSID:"NETGEAR"
Mode:Managed Frequency:2.462 GHz Access Point: 00:1B:2F:5F:C6:58
Bit Rate=54 Mb/s Tx-Power=15 dBm
Retry min limit:7 RTS thr:off Fragment thr=2352 B
Power Management:off
Link Quality=67/100 Signal level:-61 dBm Noise level=-88 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

vboxnet0 no wireless extensions.

pan0 no wireless extensions.

lsj@x-laptop:~$ sudo -s
[sudo] password for lsj:
root@x-laptop:~# iwconfig wlan0 ad-hoc
iwconfig: unknown command "ad-hoc"
root@x-laptop:~# iwconfig wlan0 mode ad-hoc
Error for wireless request "Set Mode" (8B06) :
SET failed on device wlan0 ; Device or resource busy.
root@x-laptop:~# ifconfig wlan0 down
root@x-laptop:~# iwconfig wlan0 mode ad-hoc
root@x-laptop:~# iwconfig wlan0 channel 4
root@x-laptop:~# iwconfig wlan0 essid 633
Error for wireless request "Set ESSID" (8B1A) :
SET failed on device wlan0 ; Input/output error.
root@x-laptop:~# iwconfig wlan0 essid xxx
Error for wireless request "Set ESSID" (8B1A) :
SET failed on device wlan0 ; Input/output error.
root@x-laptop:~# iwconfig wlan0 key aaaaaa
Error for wireless request "Set Encode" (8B2A) :
SET failed on device wlan0 ; Invalid argument.
root@x-laptop:~# ifconfig wlan0 up
root@x-laptop:~# iwconfig
lo no wireless extensions.

eth0 no wireless extensions.

wmaster0 no wireless extensions.

wlan0 IEEE 802.11abgn ESSID:"NETGEAR"
Mode:Managed Frequency:2.462 GHz Access Point: 00:1B:2F:5F:C6:58
Bit Rate=54 Mb/s Tx-Power=15 dBm
Retry min limit:7 RTS thr:off Fragment thr=2352 B
Encryption key:8FFF-F698-A496-AE33-B1C4-D3C2-4602-C073-A18E-1A1D-21D7-EA92-9680-C69A-045A-52A3 [3] Security mode:open
Power Management:off
Link Quality=67/100 Signal level:-59 dBm Noise level=-86 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0

vboxnet0 no wireless extensions.

pan0 no wireless extensions.

root@x-laptop:~#
设置前:
ifconfig wlan0 down
设置完成后:
ifconfig wlan0 up
头像
Rothsdad
帖子: 396
注册时间: 2009-04-18 11:41

Re: 把笔记本变路由器

#14

帖子 Rothsdad » 2009-10-16 20:39

bbeikke 写了:楼主可不可以再详细些。。。
给个文档也好啊。。。
viewtopic.php?f=116&t=232620
重温经典,回归MUD
viewtopic.php?f=34&t=235277

我的博客,一些心得,欢迎分享哦
http://hi.baidu.com/rothsdad/home
回复