Wireless Ad-Hoc Network – Linux
来源:互联网 发布:霸王别姬 张国荣 知乎 编辑:程序博客网 时间:2024/05/04 16:37
转自
http://mohan43u.wordpress.com/2010/01/31/wireless-ad-hoc-network-linux/
Long time back, I actually did peer-to-peer with RJ232 connector using mine and my friend’s laptops. Its really simple and straight forward. Choose a local subnet( probably 192.168.2.0/24), assign 192.168.2.1 to one machine and assign 192.168.2.2 to another machine. Thats all, connection established and I used ‘nc’ to transfer files. This time, its the same old thing, but without RJ232 wire. Also I just configured my system as a gateway so that my friend can access Internet through my laptop. Before starting, I conformed that my wireless is working, First I announced a Wireless Ad-Hoc with a good name(ESSID “Dark”), here, there is something called WEP, but I’m still not able to set WEP passphrase through iwconfig. If someone had success through ‘iwconfig’ please help me to learn. The below ad-hoc network will not use WEP or any authentication. waited for 2 – 10 seconds, and then tried to connect to that “Dark” network. I tried the above command more than one time till I’m associated with a Cell. If you get a mac address in ‘Cell’, it means you are now connected to the ‘Dark’ Network. Now, my link-layer is configured, next is to configure the ip layer, Now I configured IP layer, the next part is to configure my debian to route packets, Note, that the above steps are just for current running kernel, if I want my changes to be permanent, I need to edit /etc/sysctl.conf and I need to save my current iptables using ‘iptables-save/iptables-restore’. Thats all from the gateway machine(that is, my laptop), now I need to add my friend’s laptop to this ‘Dark’ Network. Thats all from my friend’s machine, now he just opened firefox and happily browsed from the balcony. No more wires. Whenever my friends come to my room, they have some bit of tough time accessing internet, becuase most of the time, my laptop will be connected with internet through ADSL. Obviously they have shyness to ask me for stop my surfing. But now, I can happily share my internet connection with my friends. I don’t need to buy a wireless router. My laptop itself with the ADSL router doing what a wireless router can do. Thanks linux.$ su -c'iwconfig'lo no wireless extensions.eth1 no wireless extensions.eth3 IEEE 802.11bg ESSID:"" Mode:Managed Frequency:2.412 GHz Access Point: Not-Associated Bit Rate:54 Mb/s Tx-Power:off Retry min limit:7 RTS thr:off Fragment thr:off Power Managementmode:All packets received Link Quality=5/5 Signal level=0 dBm Noise level=0 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0pan0 no wireless extensions.eth0 no wireless extensions.
$ su -c'iwconfig eth3 essid "Dark" mode ad-hoc channel 1'
$ su -c'iwconfig eth3 essid "Dark" mode ad-hoc channel 1'
$ su -c'iwconfig eth3'eth3 IEEE 802.11bg ESSID:"Dark" Mode:Ad-Hoc Frequency:2.412 GHz Cell: F6:A5:B9:E6:37:E3 Bit Rate=54 Mb/s Tx-Power:32 dBm Retry min limit:7 RTS thr:off Fragment thr:off Power Managementmode:All packets received Link Quality=5/5 Signal level=-57 dBm Noise level=-96 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
$ su -c'ifconfig eth3 192.168.2.1 netmask 255.255.255.0'$ su -c'ifconfig eth3; route'eth3 Link encap:Ethernet HWaddr 00:1a:73:9f:d3:47 inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::21a:73ff:fe9f:d347/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:2 TX packets:0 errors:6 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:19 Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface192.168.2.0 * 255.255.255.0 U 0 0 0 eth3192.168.1.0 * 255.255.255.0 U 0 0 0 eth0link-local * 255.255.0.0 U 1000 0 0 eth0default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
$ su -c'sysctl -w net.ipv4.ip_forward=1'$ su -c'iptables --verbose --table filter --policy FORWARD ACCEPT'$ su -c'iptables --verbose --table nat --append POSTROUTING --jump MASQUERADE'
$ sudo iwconfig wlan0 essid "Dark" mode ad-hoc channel 1$ sudo ifconfig wlan0 192.168.2.2 netmask 255.255.255.0$ sudo route add default gw 192.168.2.1$ sudo echo "nameserver 192.168.1.1" >> /etc/resulv.conf
- Wireless Ad-Hoc Network – Linux
- linux wireless ad-hoc
- Vehicular ad-hoc network
- Security for Wireless Ad Hoc Networks
- Wireless Ad Hoc Distribution for iPhone Apps
- Policy-Driven Mobile Ad hoc Network Management
- Linux 搭建Ad hoc网络
- Wireless Ad hoc and Sensor Networks: Protocols, Performance, and Control
- Security and Quality of Service in Ad Hoc Wireless Networks
- Algorithms and Protocols for Wireless, Mobile Ad Hoc Networks
- Security in Wireless Ad Hoc and Sensor Networks
- Ad-hoc
- Ad hoc
- Ad hoc
- Ad hoc
- Ad-hoc Networks: Fundamental Properties and Network Topologies
- 纯科普--ad hoc, cellular network, 3g, utms
- Wireless Ad Hoc Networking: Personal-Area, Local-Area, and the Sensory-Area Networks
- java基础之:多线程实现/启动/状态+同步+线程池
- HDU 3038 How Many Answers Are Wrong
- 拼音筛选的实现
- spring多线程事务控制
- 非常好的一个SAP博客
- Wireless Ad-Hoc Network – Linux
- 把其他类型的DLL文件转换为C++的DLL文件
- linux/unix命令行终端的光标及字符控制快捷键
- Linux 内核的排队自旋锁(FIFO Ticket Spinlock)
- list Control实现单元格编辑与插入Combo Box
- 据说看完这21个故事的人,30岁前都成了亿万富翁
- rhel linux下mysql安装
- CENTOS启动方式设置
- encodeURI为什么要用两次