LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-06-2008, 01:58 AM   #1
Romanus81
Member
 
Registered: Feb 2008
Posts: 201

Rep: Reputation: 31
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?
 
Old 10-06-2008, 02:14 AM   #2
kite
Member
 
Registered: Aug 2003
Location: Shenzhen, China
Distribution: Slackware
Posts: 306

Rep: Reputation: 47
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
 
Old 10-06-2008, 10:44 AM   #3
Romanus81
Member
 
Registered: Feb 2008
Posts: 201

Original Poster
Rep: Reputation: 31
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?
 
Old 10-07-2008, 05:08 AM   #4
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackwarearm
Posts: 878

Rep: Reputation: 120Reputation: 120
Quote:
I am trying to connect my laptop and my wii to my PC with an Ad-hoc network.
I believe I have been looking at something similar (ad-hoc garage pc to nfs/printer/scanner server on the house network) and have had some input from the MLUG. Most of this is googlible

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.

Last edited by justwantin; 10-07-2008 at 05:43 AM. Reason: tyops
 
Old 10-07-2008, 11:52 AM   #5
Romanus81
Member
 
Registered: Feb 2008
Posts: 201

Original Poster
Rep: Reputation: 31
My PC is connected to Ethernet through the School, as I understand it...

Code:
|School |               |     Dorm PC    |               |laptop  |
|Network| -[Ethernet]-> |[eth0] -> [ath0]| -[wireless]-> | wlan0  |
|(DHCP) |               |(DHCP)  (static)|      |        |(static)|
                                                |
                                                --> [Wii] (possibly}
I managed to get ath0 ad-hoc, gave it a WEP key, and typed in this into my PC:

#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.
 
Old 10-07-2008, 12:24 PM   #6
kite
Member
 
Registered: Aug 2003
Location: Shenzhen, China
Distribution: Slackware
Posts: 306

Rep: Reputation: 47
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
 
Old 10-07-2008, 02:28 PM   #7
justwantin
Member
 
Registered: Aug 2003
Location: Melbourne, Australia
Distribution: Slackware, Slackwarearm
Posts: 878

Rep: Reputation: 120Reputation: 120
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
 
Old 10-07-2011, 12:03 PM   #8
hxr99
LQ Newbie
 
Registered: Oct 2011
Posts: 3

Rep: Reputation: Disabled
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..
 
Old 10-08-2011, 02:53 AM   #9
Intel_
Member
 
Registered: Mar 2009
Location: Bulgaria
Distribution: Slackware
Posts: 103
Blog Entries: 5

Rep: Reputation: 20
See the date of that thread!
 
1 members found this post helpful.
Old 10-08-2011, 09:42 AM   #10
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
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:
Originally Posted by hxr99 View Post
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..
OP(Romanus81) has not logged in since 2009. Your referenced link is beneficial to the thread in general.

'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!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Samba Wireless Ad-Hoc Jansport_Kiefer Linux - Wireless Networking 3 12-13-2007 03:58 AM
How can I make a wireless ad-hoc connection? dhanar_10 Linux - Wireless Networking 15 10-25-2007 03:32 PM
My wireless card connects but only into ad-hoc Uh-Oh...Problems Linux - Wireless Networking 7 08-21-2006 02:50 PM
Multiple PC Ad-hoc wireless issues jholl Linux - Wireless Networking 1 01-31-2006 01:56 PM
essid cannot be set in Managed but can in Ad-hoc kidoido Linux - Wireless Networking 30 04-01-2004 10:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 08:34 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration