How to set up an Ad-Hoc wireless?
I'm a college student living in a dorm, and I am trying to connect my laptop and my wii to my PC with an Ad-hoc network. I couldn't get it to work under windows, so hopefully I can get it to work with linux.
My PC has an ethernet connection and a wifi card (using madwifi drivers, i.e. Wireless is Ath0) Would an Ad-hoc wireless network need a program to be installed or does Slackware already have something like this? |
I think you need only wireless tools installed to have ad-hoc network, here is my simple script to setup ad-hoc when needed (eth1 is my wireless device name):
#!/bin/sh /sbin/ifconfig eth1 down /sbin/iwconfig eth1 mode ad-hoc /sbin/iwconfig eth1 channel 3 /sbin/iwconfig eth1 enc off /sbin/iwconfig eth1 essid kite_ad-hoc /sbin/ifconfig eth1 169.254.114.100 netmask 255.255.0.0 /sbin/route add default gw 169.254.114.101 |
Thank you for your help, but I would rather like to know what I'm doing rather than executing a random bash script on my PC. Perhaps if you could explain it better?
/sbin/ifconfig eth1 down Do I need to do `ifconfig eth1 up` at any point? /sbin/iwconfig eth1 mode ad-hoc /sbin/iwconfig eth1 channel 3 Does it need to be channel 3, does it matter that much? /sbin/iwconfig eth1 enc off I don't think in a college campus an unencrypted ad-hoc network will work for me. If I use `eth1 key 1234567890`, will that be the key I need for the other computers? Can I set it to use WEP? /sbin/iwconfig eth1 essid kite_ad-hoc /sbin/ifconfig eth1 169.254.114.100 netmask 255.255.0.0 Ok, so this is where I get really lost. My PC ethernet is set to the school's dhcp server, I have no ability to change the IP adress, is that first number the PC's ip addr? Or do I just make one up? /sbin/route add default gw 169.254.114.101 Again, do I just come up with this number, or do I find it from somewhere? |
Quote:
I would expect that the campus is providing wireless access in which case at least one of your computers should have access to it. Ad-hoc as I understand it is between two computers and not between you and and an existing wireless network Just out of curiosity, Is the PC already accessing your campus network? or maybe its the other way around If this is the case, are you then trying to accessing the campus network from your laptop via the PC?. If so then the PC and the laptop are to be set up ad-hoc, a.k.a peer/peer, on their own network with the PC set up as a router with IP forwarding and in effect it becomes the gateway to the campus network. The static IP's for your ad-hoc network shouldn't be within the same range (is that the right word??) as the IP's assigned by the campus network. Everything you need should already be on board with your Slack install. |
My PC is connected to Ethernet through the School, as I understand it...
Code:
#ifconfig ath0 192.167.99.101 netmask 255.255.0.0 #route add default gw 192.167.99.100 On my laptop should I do the same thing? The netmask and default gateway need to be the same, correct? And I need different IP's? I think they are both connected, I try to ping one from the other, and it gives me a "destination host unreachable" error, which means it's not working, but at least it knows that the other computer exists. Right now, I'm just trying to get these two to ping eachother. |
Sorry for the confusion. That is the script I run in my laptop (with ip 169.254.114.100), so that I could use my iphone (with ip 169.254.114.101) as gateway to the internet (tethering). You have different situation, but I think that should give you some hints.
I do not have real experience on IP forwarding setting, but I think you should enable IP forwarding on the pc side, so that it could act as internet gateway/router to your laptop via WiFi. check out slackbook guide and /etc/rc.d/rc.ip_forward |
I think you have the basic idea. You are doing something like this:
School <---DNCP---> eth0 PC ath0 <--Static IP--> Laptop I assume that eth0 is a wired NIC and ath0 is a wireless card or usb dongle. Eth0 and ath0 should be two separate devices on the PC. The ad hoc connection should have an entirely different range from the dhcp network but the two adhoc wireless devices should be in the same range. For example if dhcp network was 192.168.1-128 then your ad hoc IP's could be, say, 192.168.2.1 and 192.168.2.2 Get the ad hoc connection between the PC and laptop set up first. Worry about the gateway later. when you can ping between the PC and the laptop then set up for accessing the school network in which case if the PC is 192.168.2.1 and the laptop is 192.168.2.2: 1) 192.168.2.1 will have to have to be set up for ip forwarding on a slackware box you would make the script /etc/rc.d/rc.ip_forward executable to enable ip forwarding. 192.168.2.1 is the router forwarding packets to/from your laptop and the school network 2) 192.168.2.2 will have to be set up to use 192.168.2.1 as the gateway. It doesn't need to know anything about the school network. It just needs to know it is 192.168.2.2 and that 192.168.2.1 is the gateway HTH |
maybe this link help get those things out:
http://hxr99.blogspot.com/2011/10/ho...-in-linux.html it's just work for me, I hope it will work for you either.. :) |
See the date of that thread!
|
Hi,
Welcome to LQ & Slackware! For you these two are good references SlackwareŽ Essentials & SlackwareŽ Basics. Another useful resource would be 'Slackware-Links'. More than just SlackwareŽ links! Quote:
'hxr99', please get in the habit of looking at the Thread/post(s) date. That way you will know if you should resurrect a Old thread to add relative content. Please look at the following 'FYI' to aid you in the future; FYI: How to Answer a Linux Question is 'Simon Bridge's excellent composition to aid us in good informational exchanges.' FYI: I suggest that you look at 'How to Ask Questions the Smart Way' so in the future your queries provide information that will aid us in diagnosis of the problem or query. FYI: Netiquette is a set of social conventions that facilitate interaction over networks, ranging from Usenet and mailing lists to blogs and forums. HTH! |
All times are GMT -5. The time now is 05:49 AM. |