Auto-set hotspot?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help
Post Reply
Level 3
Level 3
Posts: 171
Joined: Tue Jul 29, 2014 11:21 pm

Auto-set hotspot?

Post by JusTertii »

Hi folks,

I'm a little bit stuck (completely bamboozled, if I'm honest) with a little project I'm working on, so I thought I'd pick your collective brains...

So, I'm wanting to use my laptop as a hotspot, but *only* when it's plugged into ethernet. When it's unplugged, I want it to connect to my existing WiFi in the default way.

I imagine that I'd be making a script, and using something akin to udev rules to call it.

So far, I know how to set my laptop as hotspot using the gui: start->networks->wifi->create hotspot. How could I do this in a script?

On the off chance it's useful, here's the output of inxi -Fxz:

Code: Select all

System:    Host: cameron-ThinkPad-X220 Kernel: 3.16.0-38-generic x86_64 (64 bit, gcc: 4.8.2) 
           Desktop: Cinnamon 2.6.13  Distro: Linux Mint 17.2 Rafaela
Machine:   System: LENOVO product: 4290CE3 version: ThinkPad X220
           Mobo: LENOVO model: 4290CE3 Bios: LENOVO version: 8DET69WW (1.39 ) date: 07/18/2013
CPU:       Dual core Intel Core i5-2540M CPU (-HT-MCP-) cache: 3072 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 10366.5 
           Clock Speeds: 1: 1148.875 MHz 2: 1195.898 MHz 3: 1227.382 MHz 4: 1482.812 MHz
Graphics:  Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller bus-ID: 00:02.0 
           X.Org: 1.15.1 drivers: intel (unloaded: fbdev,vesa) Resolution: 1366x768@60.0hz 
           GLX Renderer: Mesa DRI Intel Sandybridge Mobile GLX Version: 3.0 Mesa 10.1.3 Direct Rendering: Yes
Audio:     Card: Intel 6 Series/C200 Series Family High Definition Audio Controller driver: snd_hda_intel bus-ID: 00:1b.0 
           Sound: Advanced Linux Sound Architecture ver: k3.16.0-38-generic
Network:   Card-1: Intel 82579LM Gigabit Network Connection driver: e1000e ver: 2.3.2-k port: 5080 bus-ID: 00:19.0
           IF: eth0 state: down mac: <filter>
           Card-2: Intel Centrino Advanced-N 6205 [Taylor Peak] driver: iwlwifi ver: in-tree: bus-ID: 03:00.0
           IF: wlan0 state: up mac: <filter>
Drives:    HDD Total Size: 2480.5GB (32.7% used) 1: id: /dev/sda model: OCZ size: 480.1GB 
           2: USB id: /dev/sdb model: Elements_10B8 size: 2000.4GB 
Partition: ID: / size: 23G used: 11G (51%) fs: ext4 ID: /home size: 27G used: 20G (79%) fs: ext4 
RAID:      No RAID devices detected - /proc/mdstat and md_mod kernel raid module present
Sensors:   System Temperatures: cpu: 56.0C mobo: N/A 
           Fan Speeds (in rpm): cpu: 3424 
Info:      Processes: 206 Uptime: 3 days Memory: 2726.2/3729.6MB Runlevel: 2 Gcc sys: 4.8.5 
           Client: Shell (bash 4.3.11) inxi: 1.9.17 

Thanks in advance guys! I'm really stumped on this one, so even if you could just point me in the right direction I'd be thrilled. Let me know if there's any more info you need.


Level 3
Level 3
Posts: 171
Joined: Tue Jul 29, 2014 11:21 pm

Re: Auto-set hotspot?

Post by JusTertii »

Alright... So I've done a bit of googling around, and I thought I'd share my findings in case anyone else is struggling to set up hotspots via terminal.

Setting it up on your own is an absolute nightmare, but there's a handy piece of software out there called create_ap.
So you install it:

Code: Select all

git clone
cd create_ap
sudo make install
Then you use it to make your hotspot...

Code: Select all

sudo create_ap wlan0 eth0 test 123456789x
will create a hotspot called test with pwd 123456789x.

Then, sudo create_ap --stop wlan0 will kill the AP.

So, another step closer to a soluton... I'll keep you guys posted on my progress (or otherwise these notes will help if I need to re-create this setup).
Post Reply

Return to “Newbie Questions”