Wireless Ad-Hoc connection
These commands were useful
http://iptables-tutorial.frozentux.net/iptables-tutorial.html
nmap -v mordor Starting nmap 3.50 ( http://www.insecure.org/nmap/ ) at 2004-09-21 16:03 EDT Host mordor.localdomain (192.168.1.1) appears to be up ... good. Initiating SYN Stealth Scan against mordor.localdomain (192.168.1.1) at 16:03 Adding open port 5000/tcp Adding open port 139/tcp Adding open port 135/tcp The SYN Stealth Scan took 2 seconds to scan 1659 ports. Interesting ports on mordor.localdomain (192.168.1.1): (The 1656 ports scanned but not shown below are in state: closed) PORT STATE SERVICE 135/tcp open msrpc 139/tcp open netbios-ssn 5000/tcp open UPnP Nmap run completed -- 1 IP address (1 host up) scanned in 72.847 seconds
tcpdump -i eth1 cat /etc/rc.d/init.d/iptables cat /proc/sys/net/ipv4/ip_forward echo 1 > /proc/sys/net/ipv4/ip_forward /sbin/iptables -t nat -A PREROUTING -s 192.168.1.0/255.255.255.0 -d 10.0.4./16 -i eth1 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128 iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE kedit /etc/dhcpd.conf.sample kedit /etc/dhcpd.conf dhcpcd -i eth1 & dhcpcd eth1 watch -n 1 iwconfig eth1 ping -c 4 localhost netstat netstat -r traceroute mordor
nslookup > mordor Server: 192.168.1.1 Address: 192.168.1.1#53 Non-authoritative answer: Name: mordor.mshome.net Address: 192.168.0.3
ping -c 4 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=6.48 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=3.19 ms 64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=3.23 ms 64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=3.75 ms
Why are you editing them? What are you adding to them?
kedit /etc/sysconfig/network kedit /etc/pcmcia/config kedit /etc/wlan/wlancfg-DEFAULT kedit /etc/wlan/wlancfg-deb1 chmod 777 /etc/wlan/wlancfg-deb1 kedit /etc/wlan/wlan.conf kedit /etc/hosts You should see a line 127.0.0.1 localhost we need to add a host on a new line 192.168.0.1 mordor.localdomain mordor 192.168.1.1 mordor.localdomain mordor kedit /etc/host.conf kwrite /etc/sysconfig/network kwrite /etc/sysconfig/network-scripts/ifcfg-eth1 kwrite /etc/sysconfig/networking/default/ifcfg-eth1 kwrite /etc/sysconfig/network-scripts/ifcfg-eth0 kwrite /etc/sysconfig/networking/default/ifcfg-eth0 kedit /etc/resolv.conf search mshome.net nameserver 192.168.1.1
Setup Windows PC using manual IP on Wifi TCP 192.168.1.1 mask 255.255.255.0
wifi mode Ad-Hoc essid deb1 channel 6
Run USB Wifi
add 192.168.1.1 range to Windows firewall
Linux Machine as SU (root) Again, what are you doing in these files?
kedit /etc/wlan/wlancfg-deb1 kedit /etc/modules.conf alias eth1 prism54 kedit /etc/wlan/wlancfg-deb1 ifdown eth1 kedit /etc/dhcpd.conf dhcpcd -i eth1 & dhcpcd eth1 iwconfig eth1 mode Ad-Hoc essid "deb1" channel 6 ifconfig eth1 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255 ping -c 4 192.168.1.1 /etc/pcmcia/network start eth1 route -n ifconfig eth1 up ifup eth1 iwlist eth1 scanning samba status hostname
route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.0.0.3 0.0.0.0 255.255.255.255 UH 1 0 0 sl0 192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth1 0.0.0.0 0.0.0.0 0.0.0.0 U 1 0 0 sl0
Windows Wifi is Zyair B220 looks like only 802b LAN is 192.168.0.1 Wlan is 192.168.1.1
Almost humming!
Wireless Ad-Hoc PC to Notepad
Usng PC Windows ME Zyxel USB Wlan Dell Notepad; The wifi card's a Netgear WG511. www.netgear.com I have a Dell Notepad Inspiron 2650 Intel Chip running Mandrake 10 KDE 3.2 Kernel 2.6.3-7mdk
Results
Windows machine netstat shows TCP to Notepad ping 192.168.1.1 excellent
Linux machine apradar result
eth1 Scan completed : NEW AP from accesspoint scan essid.length 4 ESSID:"deb1" Mode:Ad-Hoc 1 Encryption key:off Frequency:2.437GHz quality: -56
ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. [1]+ Stopped ping 192.168.0.1
Hangs!
iwlist eth1 scanning eth1 Scan completed : Cell 01 - Address: 42:F5:A8:9E:54:CF ESSID:"deb1" Mode:Ad-Hoc Encryption key:off Frequency:2.437GHz Quality:190/0 Signal level:-55 dBm Noise level:-245 dBm
iwspy eth1 eth1 Statistics collected: 00:00:00:00:28:C2 : Quality:0 Signal level:0 Noise level:0 Link/Cell/AP : Quality:188/0 Signal level:-53 dBm Noise level:-5 dBm (updated) Typical/Reference : Quality:0/0 Signal level:-80 dBm Noise level:-256 dBm
iwconfig lo no wireless extensions. eth0 no wireless extensions. eth1 IEEE 802.11b/g ESSID:"deb1" Nickname:"mordor" Mode:Ad-Hoc Channel:6 Cell: 42:F5:A8:9E:54:CF Bit Rate:11Mb/s Tx-Power=31 dBm Sensitivity=20/200 Retry min limit:8 RTS thr:2347 B Fragment thr:2346 B Encryption key:off Link Quality:177/0 Signal level:-53 dBm Noise level:-32 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0 sl0 ESSID:off/any Nickname:"" NWID:8 Channel:80 Access Point: FF:BF:21:00:00:00 Bit Rate=-1.07375e+06kb/s Tx-Power=-1073746380 dBm Sensitivity=8/0 Retry:on RTS thr=-1073746380 B Fragment thr=-1073746380 B Encryption key:0000-0000-0000-0000-0000-0000-0000-0000-0000-0000-0000-0000-0000-0000-0000-0000 Power Management:on
NB sl0 is my Modem
cat /proc/net/dev Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 36700 511 0 0 0 0 0 0 36700 511 0 0 0 0 0 0 eth0: 0 0 0 0 0 0 0 0 5476 18 0 0 0 0 18 0 eth1: 985616 12647 0 0 0 0 0 0 111013 868 0 0 0 0 0 0 sl0: 0 0 0 0 0 0 0 0 68564 819 0 0 0 0 0 0 sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
iwconfig eth1 eth1 IEEE 802.11b/g ESSID:"deb1" Nickname:"mordor" Mode:Ad-Hoc Channel:6 Cell: 9E:05:A8:9E:54:CF Bit Rate:11Mb/s Tx-Power=31 dBm Sensitivity=20/200 Retry min limit:8 RTS thr:2347 B Fragment thr:2346 B Encryption key:off Link Quality:196/0 Signal level:-55 dBm Noise level:-245 dBm Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 10.0.0.3 0.0.0.0 255.255.255.255 UH 1 0 0 sl0 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo 0.0.0.0 0.0.0.0 0.0.0.0 U 1 0 0 sl0
ifconfig eth1 eth1 Link encap:Ethernet HWaddr 00:09:5B:C2:C7:1A inet addr:192.168.0.5 Bcast:192.168.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:48 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:5316 (5.1 Kb) Interrupt:10
If I remove WLAN and insert LAN I get
ping 192.168.0.1 PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data. 64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.549 ms 64 bytes from 192.168.0.1: icmp_seq=2 ttl=64 time=0.328 ms 64 bytes from 192.168.0.1: icmp_seq=3 ttl=64 time=0.322 ms
NOTE: It's important that you setup the interface in the following steps 1) Make sure the interface (eth1) is down 2) Execute the iwconfig commands 3) Execute the ifconfig command (will Add IP and bring interface up) 4) Perform tests
This order is crucial because the new network settings are not written to the wireless card until you bring the interface up (via the ifconfig command).
Now the Internet!
Bill
3 pages link to AdHoc: