Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm pretty new to Linux; this project is me trying to learn more. I've done login scripts before but not boot scripts, so that's one of my questions. My other question is how to get an ad-hoc network working with just terminal commands, so that I can make a boot script to do it. I'm running Fedora 18 off of a flash drive for now, but when I'm done configuring I'll be copying everything to an old laptop's hard drive. (The goal of this project is to not have to buy a better wireless router)

The most luck I've had setting up an ad-hoc was by using Gnome's "Use as Hotspot..." button in my wireless network settings, and then changing the name and WEP code (Can I use other encryption methods?) using iwconfig in the terminal, but I want it all done with terminal commands so that I can just run a script to set it all up. I think I can figure out how to use iptables to set up my port forwarding and junk myself, but first I need to get this computer able to share its internet connection wirelessly.

share|improve this question
What card are you using ? Have you checked if it supports AP mode ? (post the output of iw phy to figure out ?). If AP mode is not supported, maybe IBSS-RSN (which is basically WPA2 in ad-hoc mode) is supported. – BatchyX May 29 '13 at 20:41
I ran "iw phy" on my newer laptop. I see a line under "Supported RX frame types:" that says "AP: 0x00 0x20 0x40 0xa0 0xb0 0xc0 0xd0" and immediately under is one that says "AP/VLAN: " and the same hex numbers. The laptop I'll eventually move this all onto is a Dell Latitude D630, but I don't have it with me at the moment. Its hinges are broken so I don't touch it if I don't have to. – Edward Alm May 30 '13 at 16:32
If there is no AP under Supported interface types, your card/driver does not support AP mode. What contains Supported RX frame types is a bit irrelevant. Check if there is a mention of IBSS-RSN anyway, in that case, you may still do WPA2 in ad-hoc mode... – BatchyX May 30 '13 at 19:01

This blogspot entry has a guide for configuring a wireless network in ad-hoc mode. On the first machine, run these commands (fill in your own network information):

 ifconfig wlan0 down
 iwconfig wlan0 channel 4
 iwconfig wlan0 mode ad-hoc
 iwconfig wlan0 essid 'fermilevel'
 iwconfig wlan0 key 1234567890
 ifconfig wlan0

On the second machine:

 ifconfig wlan0 down
 iwconfig  wlan0 channel 4
 iwconfig  wlan0 mode ad-hoc
 iwconfig  wlan0 essid 'fermilevel'
 iwconfig  wlan0 key 1234567890
 ifconfig  wlan0

The essid and key must be the same on both machines.

share|improve this answer
ifconfig and iwconfig are both deprecated, especially the latter which is completely obsolete. Use ip and iw instead. Using iw has the direct benefit that it gives you the option to use 802.11n in the iw ibss join command. – BatchyX May 29 '13 at 20:45
That blog post is trying to connect two Linux computers together; I'm just trying to set up one computer that shares its internet connection wirelessly with Windows PCs and my phone and junk. I can get the network to appear on my Windows PC by running one set of those commands on my laptop, but if I try to connect to it I get "Unidentified Network/No Internet Access". – Edward Alm May 30 '13 at 16:39
ad-hoc is a peer-to-peer connection. you can setup each device to connect to the box that is sharing the net. I am not sure if ad-hoc will provide simultaneously connection to all of your devices. – Raza May 30 '13 at 17:44
Please make sure to setup bridge or routing in order to avoid "Unidentified Network/No Internet Access" error. – Raza May 30 '13 at 17:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.