Tag Archives: GNU

Wireless in Powerbook G4 part 2

Below is a small script to configure the network interfaces in the Powerbook. It will probably work in other Linux systems too, maybe some modifications would need to be made. wlan0 is the wireless interface and eth0 the broadband interface.


#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

echo "Checking whether NetworkManager is running"
if [ -f /var/run/NetworkManager.pid ]; then
        echo "NetworkManager is running, stopping it"
        /etc/init.d/network-manager stop
else
        echo "NetworkManager is not running"
fi

Interface() {
echo "Choose the name of the interface you want to configure"
echo "1 = Interface ethernet eth0"
echo "2 = Interface wireless wlan0"
echo "0 = Quit the program"
echo
read INT

if [ $INT = 1 ]; then
ETH=eth0

elif [ $INT = 2 ]; then
ETH=wlan0 
echo "Choose the essid you want to connect to"
iwlist $ETH scan | grep -i essid
read ESSID
iwconfig $ETH "$ESSID"

elif [ $INT = 0 ]; then
echo "Quitting"
exit 0
fi
}

Interface

Configure() {
echo
echo " 1 = static "
echo " 2 = dhcp "
echo " 0 to quit the program "
echo
read CHOICE

static() {
echo "Write the IP of the interface"
read IP
echo "Write the network mask"
read NETMASK
echo "Write the default gateway"
read ROUTE
echo "Configuraning the interface"
ifconfig $ETH $IP netmask $NETMASK
echo "Configuraning the gateway"
route add default gw $ROUTE
echo "search" > /etc/resolv.conf
echo "Write the IP of the first DNS server"
read DNS_1
echo nameserver $DNS_1 >> /etc/resolv.conf
echo "Write the IP of your second DNS server"
read DNS_2
echo nameserver $DNS_2 >> /etc/resolv.conf
} 

dhcp() {
        dhclient $ETH
        }

if [ $CHOICE = 1 ]; then
static

elif [ $CHOICE = 2 ]; then
dhcp

elif [ $CHOICE = 0 ]; then
echo "Quitting the program."
exit 0
fi
}

Configure

exit 0

Suggestions are always welcome. 🙂

Wireless in Powerbook G4

I have an old Powerbook G4 12 inch running Debian. I had issues connecting to the wireless if I was not using Gnome. I found out it was because of Network Manager. While Network Manager is running I can not connect to the wireless network from command line. Currently I am using OpenBox so it doesn’t connect automatically to the wireless. Here is a small howto.

First we check module b43 is installed.

[19:16:50] xavi@NewYork:/tmp $ sudo modinfo b43
filename:       /lib/modules/2.6.30-2-powerpc/kernel/drivers/net/wireless/b43/b43.ko
firmware:       FW13
license:        GPL
author:         Michael Buesch
author:         Stefano Brivio
author:         Martin Langer
description:    Broadcom B43 wireless driver
alias:          pcmcia:m02D0c0448f*fn*pfn*pa*pb*pc*pd*
alias:          ssb:v4243id0812rev10*
alias:          ssb:v4243id0812rev0F*
alias:          ssb:v4243id0812rev0D*
alias:          ssb:v4243id0812rev0B*
alias:          ssb:v4243id0812rev0A*
alias:          ssb:v4243id0812rev09*
alias:          ssb:v4243id0812rev07*
alias:          ssb:v4243id0812rev06*
alias:          ssb:v4243id0812rev05*
depends:        pcmcia,mac80211,ssb,input-polldev,pcmcia_core,rfkill,rng-core,cfg80211
vermagic:       2.6.30-2-powerpc mod_unload modversions 
parm:           bad_frames_preempt:enable(1) / disable(0) Bad Frames Preemption (int)
parm:           fwpostfix:Postfix for the .fw files to load. (string)
parm:           hwpctl:Enable hardware-side power control (default off) (int)
parm:           nohwcrypt:Disable hardware encryption. (int)
parm:           qos:Enable QOS support (default on) (int)
parm:           btcoex:Enable Bluetooth coexistance (default on) (int)
parm:           verbose:Log message verbosity: 0=error, 1=warn, 2=info(default), 3=debug (int)
[19:16:54] xavi@NewYork:/tmp $ lsmod | grep -i b43
b43                   138992  0 
rfkill                 15184  3 rfkill_input,b43
rng_core                7952  1 b43
mac80211              178904  1 b43
cfg80211               72376  2 b43,mac80211
input_polldev           7836  2 b43,ams
ssb                    51292  1 b43
pcmcia                 32336  2 b43,ssb
pcmcia_core            40868  3 b43,ssb,pcmcia
[19:17:09] xavi@NewYork:/tmp $ 

Stop Network Manager

bash$ sudo /etc/init.d/network-manager stop

Bring up wireless interface. Wlan0 in my case.

bash$ sudo ifconfig wlan0 up

Scan the available wireless networks.

bash$ sudo iwconfig wlan0 scanning

Connect to the ESSID

bash$ sudo iwconfig wlan0 essid

Get an IP from the wireless access point.

bash$ sudo dhclient wlan0 

Ping an external address to see you are connected to the internet.

[19:31:57] xavi@NewYork:/tmp $ !ping
ping -c 3 debian.org
PING debian.org (194.109.137.218) 56(84) bytes of data.
64 bytes from klecker.debian.org (194.109.137.218): icmp_req=1 ttl=50 time=119 ms
64 bytes from klecker.debian.org (194.109.137.218): icmp_req=2 ttl=50 time=116 ms
64 bytes from klecker.debian.org (194.109.137.218): icmp_req=3 ttl=50 time=101 ms

--- debian.org ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 101.768/112.858/119.928/7.940 ms
[19:32:02] xavi@NewYork:/tmp $ 

You should now be ready to go. I will write more on this later on.

Tomcat installation on GNU/Linux

Today I’m going to explain how to install Apache Tomcat on a Linux box. We should have a JDK already installed on the box. If that is not the case it can be downloaded from Sun website.

Now we download Tomcat from the website. Once downloaded we will download and install it into the /opt directory. We have to create the tomcat user.

$ sudo useradd -g tomcat -d /home/tomcat tomcat
$ sudo passwd tomcat

Now we have to define the $JAVA_HOME and $CATALINA_HOME variables. In /home/tomcat/.bashrc add the following:

export JAVA_HOME=/opt/java
export CATALINA_HOME=/opt/tomcat

Now change the ownership of /opt/tomcat directory, which is where we downloaded tomcat previously.

$ sudo chown -R tomcat:tomcat /opt/tomcat

We are now ready to start Tomcat. As tomcat user type:

$ /opt/tomcat/bin/startup.sh

If everything went well you shall now see tomcat process running.

tomcat@debian: /opt/tomcat/bin $ ps auxwww | grep -i java | grep -v grep
tomcat 6618 0.3 1.3 1064972 48260 pts/0 Sl 15:51 0:03 /opt/java/bin/java -Djava.util.logging.config.file=/opt/tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/opt/tomcat/endorsed -classpath /opt/tomcat/bin/bootstrap.jar -Dcatalina.base=/opt/tomcat -Dcatalina.home=/opt/tomcat -Djava.io.tmpdir=/opt/tomcat/temp org.apache.catalina.startup.Bootstrap start
tomcat@debian: /opt/tomcat/bin $

Now let’s see Tomcat on a browser. Hit http://localhost:8080/ and you shall see a page as the one below.

Configuring VPN client under Linux

Due to my work I sometimes have to VPN to my job from home. But I use a Linux PowerPC laptop and have to log in to a Cisco box. Cisco doesn’t provides support for Linux on PowerPC. So where is the solution? The solution is VPNC. How do we install it? Easy:

shell$ sudo aptitude install vpnc

Now we need to configure the config file. We are going to modify /etc/vpnc/example.conf.

shell$ sudo cp /etc/vpnc/example.conf /etc/vpnc/connect.conf
shell$ cat /etc/vpnc/connect.conf
#IPSec gateway
#IPSec ID
#IPSec secret
#IKE Authmode hybrid
#Xauth username

We need to replace the gateway entry with the IP/hostname of the server we want to connect to, the ID with the group you belong to, the secret with the password for the group you belong to and the username with your username. Once configured you just have to fire up vpnc.

shell$ sudo vpnc /etc/vpnc/connect.conf
Enter password for username@server:
Connect Banner:
| Connecting to VPN.

VPNC started in background (pid: 4566)…
shell$

Now you should be able to see a tun interface when executing /sbin/ifconfig.

shell$ /sbin/ifconfig tun0
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:192.168.20.22 P-t-P:192.168.20.22 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1412 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:290 (290.0 B) TX bytes:154 (154.0 B)
shell$

Enjoy your VPN connection. More info here and here.

Google to stop using Windows

I just woke up today and find out in the Financial Times that Google is going to stop using Windows due to security concerns.

Here is the link to the article. Think about the effect this has. It is true Google and Microsoft are competing in the Internet search and mobile phone market among other things. Microsoft tried to buy Yahoo in 2008 but negotiations failed. The fact that Google will no longer use Windows is like slapping Microsoft in the face and telling them their OS is a piece of crap even when they have 90% of the market. Could this be the start of Microsoft decline in the OS market? Time will tell, but I’ve heard this before.