How to create an access point using your wifi adapter

Standard

Imagine you have only a ethernet cable and more than a laptop to connect to the Internet (i.e.: your mobile phone, the laptop of a friend and his mobile phone, etc). Imagine you’re in a undergroun Data Center, or in a hotel’s room where you don’t have wifi (for example, in Japan). If you had an Access Point, you could simply connect that cable to it and every device would go through it…

Well, if you have GNU/Linux, you can accomplish it very easily. We’ll see how.

  • [OPTIONAL] Blacklist the manufacturer module

I faced some troubles when I tried to create the ad-hoc connection, and I solved it by blacklisting the manufacturer wmi module, so to see if you have any loaded you can do:

lsmod | grep wmi
acer_wmi 20480 0
sparse_keymap 16384 1 acer_wmi
wmi_bmof 16384 0
rfkill 20480 7 bluetooth,acer_wmi,cfg80211
wmi 20480 2 wmi_bmof,acer_wmi
video 36864 2 acer_wmi,i915
i8042 24576 1 acer_wmi
led_class 16384 4 sdhci,input_leds,acer_wmi,ath9k

As my laptop is an acer, the module obviously is acer_wmi. Select what you guess is yours and blacklist with something like

echo "blacklist acer_wmi" > /etc/modprobe.d/acer.conf

And reboot to apply.

  • Creating it with NetworkManager

With NetworkManager, creating an Access Pointy connection is pretty straight forward. You need to:

  1. Create a Wi-Fi Connection (Shared)
  2. Put a name for the connection (like Access Point Connection)
  3. Put a name for the SSID (like LinuxAP)
  4. On “Wi-Fi Security” tab, select “WPA/WPA2 PSK” and set the password for your network
  5. Save
  6. On the same computer you just created the Access Point network, connect to that “LinuxAP” network with the provided credentials.

Ready, now take your mobile phone and browse the Wi-Fi networs, you’ll see a new one named “LinuxAP” and you will be able to connect to it with the password you’d provide.

To bring down the Access Point, simply use NetworkManager to disconnect from “LinuxAP”. Immediatly, all devices connected will be disconnected as well.

  • Creating an Access Point within the command line

The easiest way to create an access point without NetworkManager is using the script create_ap.

sudo pacman -S create_ap

Once installed, let’s create our Access Point with

# create_ap ap0 WIRELESS_INTERFACE LinuxAP WPA2_PASSWORD

And let it run on a terminal. It will create and adapter called “ap0” as long as the create_ap script runs.

ap0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
 link/ether b8:ee:65:1e:13:95 brd ff:ff:ff:ff:ff:ff
 inet 192.168.12.1/24 brd 192.168.12.255 scope global ap0
 valid_lft forever preferred_lft forever
 inet6 fe80::2257:61cf:b9ce:5873/64 scope link 
 valid_lft forever preferred_lft forever

You can grab your mobile phone and connecto to “LinuxAP” using the WPA2_PASSWORD. When you want to bring down the Access Point, just go to the terminal where create_ap is running and Ctrl+C to shut it down.

Note: If you use the create_ap approach, it will blacklist your wireless device in NetworkManager. If you plan to manage that device with NetworkManager, take in mind that you will need to modify /etc/NetworkManager/NetworkManager.conf and comment out or delete the line unmanaged-devices and restart NetworkManager.service.

 

Advertisements

qtDesigner does not start

Standard

I’m starting to playing with desktop interfaces, I use KDE and I like a lot Qt controls. Furthermore, are multiplatform, so combined with python I can do beautilful programs in a easy way.

So I’d installed Qt4 Designer on my work’s laptop. But when I clicked on the Qt4 Designet icon, nothing happened.

I opened a terminal and run designer-qt in order to see what happened. This is what I saw:

$ designer-qt4
designer-qt4: symbol lookup error: /usr/lib/qt4/plugins/designer/libqscintillaplugin.so: undefined symbol: _ZN13QsciScintillaC1EP7QWidget

Pretty weird, it seems something wrong with scintilla. So after reinstalling qscintilla and see that not solved my issue, I tried to recompile from sources instead of reinstalled

$ yaourt -S qscintilla –build

(please note that there are two hyphen (-) before the buid parameter)

Once finished, designer-qt started smoothly 🙂

Enable bash completion after sudo command

Standard

If you usually work with the sudo command you will find yourself typing the entire command line after the first word: sudo. That’s pretty annoying and the solution, pretty straight forward.

First of all, we need to install bash-autocompletion package from extra repositories.

That’s all. 🙂

 

No sound at -each- boot!

Standard

Something very annoying began to happen on my work laptop. Every time I booted it, it was without sound.

The sound applet did not work, I could adjust the volume, and detected the sound card, but no sound came out of the speakers.

But the curious thing was I surely heard some youtube video before, so it stopped  from work suddenly…

After recheck my system detected de hardware with lspci, and the right modules were loaded with lsmod

# lspci | grep -i audio
00:1b.0 Audio device: Intel Corporation NM10/ICH7 Family High Definition Audio Controller (rev 02)
# lsmod | grep -i intel
snd_hda_intel          31351  6
snd_hda_codec         129274  3 snd_hda_codec_realtek,snd_hda_codec_si3054,snd_hda_intel
snd_pcm                63880  4 snd_hda_codec_si3054,snd_hda_codec,snd_hda_intel
snd_page_alloc          5978  2 snd_pcm,snd_hda_intel
snd                    44598  18 snd_hda_codec_realtek,snd_hda_codec_si3054,snd_hwdep,snd_timer,snd_pcm,snd_hda_codec,snd_hda_intel
intel_agp               8692  1 i915
intel_gtt              10204  3 i915,intel_agp
agpgart                22047  3 drm,intel_agp,intel_gtt

I openned a terminal and execute alsamixer and I saw this:

alsamixer muted device

Those “MM” between the bar and the “100<>100” means that is “Muted”. To toggle between muted and unmuted we must use the “M” key. Then, if you have something playing, it will sound. 🙂

Now we can exit alsamixer by pressing the “Esc” key.

Even if in each reboot, I was again muted, it was very easy open a terminal, unmute the sound card, and done. As that laptop is my job tool, and I did use it mainly to connect to remote servers, to document, or to code some scripts, and rarely to listen music or to watch a video tutorial or something with audio, that worked fine for me… but I admit its annoying.

So, digging a bit deeper, I found alsactl and only by typing

# alsactl store

The configuration will be saved through the reboots 😉

Netstat on Archlinux

Standard

Today a quick post to self-reference. I have lost 10 minutes searching on the web how to install netstat on arch linux. So if anyone of you fall in this post the answer is easy: on net-tools package.

In fact inside net-tools, we can find a very useful set of netwok tools:

[malevolent@malevolo ~]$ sudo pacman -Ql net-tools
net-tools /bin/
net-tools /bin/netstat
net-tools /sbin/
net-tools /sbin/arp
net-tools /sbin/ifconfig
net-tools /sbin/ipmaddr
net-tools /sbin/iptunnel
net-tools /sbin/mii-tool
net-tools /sbin/nameif
net-tools /sbin/plipconfig
net-tools /sbin/rarp
net-tools /sbin/route
net-tools /sbin/slattach
net-tools /usr/
net-tools /usr/share/
net-tools /usr/share/man/
net-tools /usr/share/man/man5/
net-tools /usr/share/man/man5/ethers.5.gz
net-tools /usr/share/man/man8/
net-tools /usr/share/man/man8/arp.8.gz
net-tools /usr/share/man/man8/ifconfig.8.gz
net-tools /usr/share/man/man8/mii-tool.8.gz
net-tools /usr/share/man/man8/nameif.8.gz
net-tools /usr/share/man/man8/netstat.8.gz
net-tools /usr/share/man/man8/plipconfig.8.gz
net-tools /usr/share/man/man8/rarp.8.gz
net-tools /usr/share/man/man8/route.8.gz
net-tools /usr/share/man/man8/slattach.8.gz