You are not logged in.

#1 2009-02-26 12:54:35

synthead
Member
From: Seattle
Registered: 2006-05-09
Posts: 1,328

Using netcfg for an Ad-Hoc network

I have an app on my phone that allows me to tether via an Ad-Hoc network.  So I want to set up a netcfg profile.  I'm using what lcpci refers to as "Intel Corporation PRO/Wireless 3945ABG [Golan] Network Connection (rev 02)" and I'm using the iwl3945 module.  Here's what I wrote:

CONNECTION="wireless"
DESCRIPTION="A simple WEP encrypted wireless connection"
INTERFACE=wlan0
SCAN="yes"
SECURITY="none"
ESSID="G1Tether "
IP="dhcp"
IWOPTS="mode Ad-Hoc essid $ESSID"

But ... it doesn't work.  This is what netcfg reports:

[root@pwn network.d]# netcfg tether
:: tether up  - Wireless association failed.                             [FAIL]

Interestingly enough, iwconfig states that it is in Managed mode, even though I used iwopts to set it to ad-hoc:

[max@pwn ~]$ iwconfig
lo        no wireless extensions.

wmaster0  no wireless extensions.

wlan0     IEEE 802.11abg  ESSID:"G1Tether "  
          Mode:Managed  Frequency:2.422 GHz  Access Point: Not-Associated   
          Tx-Power=14 dBm   
          Retry min limit:7   RTS thr:off   Fragment thr=2352 B   
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

eth0      no wireless extensions.

Something else that is interesting: if I try to switch modes while the interface is up, it will fail:

[root@pwn network.d]# iwconfig wlan0 mode Ad-Hoc
Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Device or resource busy.

I have to manually bring the interface down with ifconfig, set it to ad-hoc, then bring it up.  Perhaps this has something to do with it, I'm not entirely sure.

What should I try to make this work?  If I use iwconfig, I can associate with my phone just fine.  It gets an IP and I'm able to go online, so it works.  And also, is there a way to use netcfg to set ad-hoc mode without using IWOPTS=()?

edit - Yes, I know there's a space in the essid, it's supposed to be that way smile

Last edited by synthead (2009-02-26 12:55:25)


Touch my kernel

Offline

#2 2009-02-26 13:06:38

buttons
Member
From: NJ, USA
Registered: 2007-08-04
Posts: 620

Re: Using netcfg for an Ad-Hoc network

I'd be very interested if you could get this to work.  I haven't been able to use ad-hoc with my G1 without making an iwconfig script.


Cthulhu For President!

Offline

#3 2009-03-05 11:08:25

synthead
Member
From: Seattle
Registered: 2006-05-09
Posts: 1,328

Re: Using netcfg for an Ad-Hoc network

Any thoughts?  I'm stumped.


Touch my kernel

Offline

#4 2009-03-05 11:43:27

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Using netcfg for an Ad-Hoc network

IWOPTS is not and never was a supported option.

Correct option is WEP_OPTS, though I've made that redundant, replacing it with IWCONFIG=""

Last edited by iphitus (2009-03-05 11:44:17)

Offline

#5 2009-03-05 12:16:48

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: Using netcfg for an Ad-Hoc network

In that case you should update /etc/network.d/examples/complete.example.


1000

Offline

#6 2009-03-06 09:05:29

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Using netcfg for an Ad-Hoc network

byte wrote:

In that case you should update /etc/network.d/examples/complete.example.

Yeah, i've removed it in git already... There's a lot of fixes waiting in git, I just need to stabilise it and deal with the regressions.

Offline

#7 2009-12-23 17:50:19

flammenwurfer
Member
Registered: 2009-02-04
Posts: 118

Re: Using netcfg for an Ad-Hoc network

I've been wrestling with the same thing with my Hero.  I was able to get it working by putting all the manual config options in the netcfg profile PRE_UP="" section.  Seems kind of unnecessary but that's the only way I was able to get it to work.

like so...

PRE_UP="ifconfig wlan0 down; iwconfig wlan0 mode ad-hoc; iwconfig wlan0 essid HeroTether; ifconfig wlan0 up; dhcpcd wlan0"

Offline

#8 2009-12-23 19:42:16

Gusar
Member
Registered: 2009-08-25
Posts: 3,604

Re: Using netcfg for an Ad-Hoc network

Here's my config:

CONNECTION="wireless"
INTERFACE="wlan0"
PRE_UP="ifconfig wlan0 down; iwconfig wlan0 mode ad-hoc"
QUIRKS=(prescan predown)
SECURITY="wep-old"
ESSID="essidhere"
KEY="s:keyhere"
IP="dhcp"

It's having both quirks in there that makes it work. Prescan used to be enough, but not anymore. Without the quirks, a new network is created (same essid, but different bssid) instead of a connection being made to an existing network.

Offline

#9 2010-01-10 03:53:46

Draje
Member
Registered: 2007-06-21
Posts: 102
Website

Re: Using netcfg for an Ad-Hoc network

flammenwurfer wrote:

I've been wrestling with the same thing with my Hero.  I was able to get it working by putting all the manual config options in the netcfg profile PRE_UP="" section.  Seems kind of unnecessary but that's the only way I was able to get it to work.

like so...

PRE_UP="ifconfig wlan0 down; iwconfig wlan0 mode ad-hoc; iwconfig wlan0 essid HeroTether; ifconfig wlan0 up; dhcpcd wlan0"

Mind posting your entire config?

Offline

#10 2010-01-11 03:06:21

flammenwurfer
Member
Registered: 2009-02-04
Posts: 118

Re: Using netcfg for an Ad-Hoc network

Here it is.

CONNECTION="wireless"
DESCRIPTION="Automatically generated profile"
INTERFACE=wlan0
HOSTNAME=kellen-wind
IP="dhcp"
DHCP_TIMEOUT=10
ESSID="HeroTether"
SECURITY="NONE"
KEY=""
SCAN="NO"
TIMEOUT=15
PRE_UP="ifconfig wlan0 down; iwconfig wlan0 mode ad-hoc; iwconfig wlan0 essid HeroTether; ifconfig wlan0 up; dhcpcd wlan0"

Offline

#11 2010-01-27 13:51:57

samsom
Member
Registered: 2009-07-17
Posts: 88

Re: Using netcfg for an Ad-Hoc network

flammenwurfer wrote:

Here it is.

CONNECTION="wireless"
DESCRIPTION="Automatically generated profile"
INTERFACE=wlan0
HOSTNAME=kellen-wind
IP="dhcp"
DHCP_TIMEOUT=10
ESSID="HeroTether"
SECURITY="NONE"
KEY=""
SCAN="NO"
TIMEOUT=15
PRE_UP="ifconfig wlan0 down; iwconfig wlan0 mode ad-hoc; iwconfig wlan0 essid HeroTether; ifconfig wlan0 up; dhcpcd wlan0"

Hi,
That was briliant. I have always booted my windows partition to log onto wifi tether or connect via the usb for Linux.
Whereabouts in /etc/network.d/    do I make this configuration file? Do I have to create a new file?
Cheers
Samsom


Samsom

Offline

#12 2010-01-27 14:54:17

flammenwurfer
Member
Registered: 2009-02-04
Posts: 118

Re: Using netcfg for an Ad-Hoc network

Just create a file in the /etc/network.d folder named whatever you want the connection to be called.  Then you can either copy the contents of one of the template files in /etc/network.d/examples or one of your already working configs or the one that I posted and change all the parts that need changing for your specific use. 

The one I posted works great for me and you should only have to change your HOSTNAME and ESSID(don't forget to change it in the PRE_UP section as well) to whatever you have yours set as.

If you have any problems let me know.  I'm no expert but I'll try to help.

Offline

#13 2010-01-27 16:28:01

samsom
Member
Registered: 2009-07-17
Posts: 88

Re: Using netcfg for an Ad-Hoc network

Hi,
Thanks for that. I tried out those commands in sequence and I managed to latch on to the tether network. I made the netcfg file like you said and now dhcpcd just broadcasts for a lease and times out. I have tried the sequential commands again , but no luck this time. Initially dhcpcd tries to rebind the lease with my router (I have got fixed ip addresses for my laptops ) and then broadcasts and times out. Not sure why, considering that I had managed to do it once with no problems.
I use Wicd for my normal wireless stuff. Would having both wicd and netcfg daemons running simultaneously cause problems?
Cheers
Samsom


Samsom

Offline

#14 2010-01-27 17:05:12

flammenwurfer
Member
Registered: 2009-02-04
Posts: 118

Re: Using netcfg for an Ad-Hoc network

Hmm...it's possible.  I don't use wicd, I just use netcfg. 

Try disconnecting from all networks and closing wicd.  Then use netcfg to try and connect.  Also, you might try and setup a normal netcfg config for you home router and see if that works.

Offline

#15 2010-01-27 17:34:03

samsom
Member
Registered: 2009-07-17
Posts: 88

Re: Using netcfg for an Ad-Hoc network

Hi,
Thanks again for your time.
This is what happens when I try to run netcfg.

  
[sam@sony ~]$ sudo netcfg g2
:: g2 up                                                                                                              [BUSY] dhcpcd: version 5.1.4 starting
dhcpcd: wlan0: waiting for carrier
dhcpcd: timed out

This is my configuration file

[sam@sony ~]$ cat /etc/network.d/g2                                                                                          
CONNECTION="wireless"                                                                                                        
DESCRIPTION="Automatically generated profile"                                                                                
INTERFACE=wlan0                                                                                                              
HOSTNAME=sony                                                                                                                
IP="dhcp"                                                                                                                    
DHCP_TIMEOUT=10                                                                                                              
ESSID="g2"                                                                                                                   
SECURITY="NONE"                                                                                                              
KEY=""                                                                                                                       
SCAN="NO"                                                                                                                    
TIMEOUT=15                                                                                                                   
PRE_UP="ifconfig wlan0 down; iwconfig wlan0 mode ad-hoc; iwconfig wlan0 essid g2; ifconfig wlan0 up; dhcpcd wlan0"

I even stopped the wicd daemon. No difference. It keeps trying to connect to the home network even with the router switched off.
Not sure where to go from here.
Samsom


Samsom

Offline

#16 2010-01-27 17:37:17

flammenwurfer
Member
Registered: 2009-02-04
Posts: 118

Re: Using netcfg for an Ad-Hoc network

Can you connect to your router using netcfg?  Try commenting out wicd in your rc.conf and rebooting and trying it.

Offline

#17 2010-01-27 17:43:47

samsom
Member
Registered: 2009-07-17
Posts: 88

Re: Using netcfg for an Ad-Hoc network

Yup. I can connect to the router with netcfg. I did not have to reboot to do that.


Samsom

Offline

#18 2010-01-27 17:46:31

flammenwurfer
Member
Registered: 2009-02-04
Posts: 118

Re: Using netcfg for an Ad-Hoc network

ok, and you've tried manually entering "ifconfig wlan0 down; iwconfig wlan0 mode ad-hoc; iwconfig wlan0 essid g2; ifconfig wlan0 up; dhcpcd wlan0" these commands again?

Offline

#19 2010-01-27 17:52:37

samsom
Member
Registered: 2009-07-17
Posts: 88

Re: Using netcfg for an Ad-Hoc network

flammenwurfer wrote:

ok, and you've tried manually entering "ifconfig wlan0 down; iwconfig wlan0 mode ad-hoc; iwconfig wlan0 essid g2; ifconfig wlan0 up; dhcpcd wlan0" these commands again?

Sorry , I wa a bit stupid. I did now and it works. Hurrah....

Does that mean that I will have to switch over to netcfg for my home network as well? I suppose so.
Thanks a lot, dude.
Is there a GUI applet for netcfg as for wicd. It just made it a lot easier to scan and latch onto wireless networks.
Cheers


Samsom

Offline

#20 2010-01-27 18:02:38

flammenwurfer
Member
Registered: 2009-02-04
Posts: 118

Re: Using netcfg for an Ad-Hoc network

Hey, no problem.  Yes there is a gui for netcfg.  It's called wait for it....netcfgGUI!  haha 

Are you saying that you got it working running "netcfg g2" ? or running the commands manually?

You might experiment a little with disabling/disconnecting from wicd and trying to connect to your g2 with netcfg to see if you can get them to work together.  But if you can't get it, netcfgGUI will work.  Does wicd not have an option to connect in Ad-hoc mode?  I haven't used it for a long time.

Offline

#21 2010-01-27 20:33:53

samsom
Member
Registered: 2009-07-17
Posts: 88

Re: Using netcfg for an Ad-Hoc network

It only seems to work when the router is switched off. If the routers signal is being broadcast, then dhcp keeps trying to connect to that and gives up. Which should not be a problem as I dont plan to use the ad-hoc network when I am home. 
There is an option in the wicd gui to start an ad-hoc network , but it does not connect to the phone network despite "seeing" it. I have never used wicd from the command line, so am unsure of what it is capable of.
Like you say, I need to experiment a bit to see what works best.
Cheers


Samsom

Offline

#22 2010-01-27 21:14:22

flammenwurfer
Member
Registered: 2009-02-04
Posts: 118

Re: Using netcfg for an Ad-Hoc network

I don't there you can really use wicd from the command line, that I know of.  How do you know it's trying to connect to your router and not your phone?  Have you checked what channel your phone and router are on?

Or are you saying that wicd tries to auto-connect if your router is on?

Offline

#23 2010-01-27 21:51:06

samsom
Member
Registered: 2009-07-17
Posts: 88

Re: Using netcfg for an Ad-Hoc network

You hit the nail on the head again, mate. Both the networks were on the same channel. Thats why when they were both on, netcfg was confused. Changed the channel of the ad-hoc network and viola....back in business. I can choose which network I wanna join. Your configuration file works a treat as well.
Thanks dude. I am gonna sleep happy tonight smile


Samsom

Offline

#24 2010-01-27 21:55:44

flammenwurfer
Member
Registered: 2009-02-04
Posts: 118

Re: Using netcfg for an Ad-Hoc network

Glad I could help!  I haven't used Wifi Tether much, but it sure is handy when you need it.  What phone do you have?  I see that your ssid is G2, but I didn't think there was a phone called the G2. 

Got any cool app recommendations for me?  I'm on a CDMA HTC Hero.

Offline

#25 2010-01-29 04:29:35

supper1213
Member
From: HongKong
Registered: 2010-01-29
Posts: 2

Re: Using netcfg for an Ad-Hoc network

That is the plan for T-Mobile UK. Right now T-Mobile USA is focused on launching the MyTouch 3G and there currently aren't any plans to bring the HTC Hero to the American lineup but that could change.
As far as the G2 Touch goes, I like the name much better than G1 Touch as it more clearly separates the G1 and G2. But if you change it to G2 why do you even need the "Touch" at the end? Did Apple call it the iPhone Touch? Nope… it is pointless if you ask me. Hopefully they take this naming fetish thing seriously and make it the T-Mobile G2.
Anyone else agree?

Offline

Board footer

Powered by FluxBB