LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Linux Answers > Networking
User Name
Password

Notices


By spurious at 2003-09-30 01:50
Installing HomePNA 2.0 Home Phoneline Network for Knoppix and Slackware

My modest home network consists of a Slackware 9.0 box functioning as an Internet gateway and a Knoppix 3.3 box acting as a workstation. Both boxes are connected with a D-Link HomePNA 2.0 (also known as "hpna2" or "iLine") 10 Mbps home phoneline network. This article will deal with compiling and installing the hpna2 linux module for Knoppix and Slackware. Please note that I use static IP addresses on my two-box network; you will have to adapt this article for DHCP.

For more information about HomePNA 2.0, see the AnandTech review: http://anandtech.com/IT/showdoc.html?i=1568.

I adapted the instructions on http://www.homepna.org. Note that the instructions on www.homepna.org apply to Red Hat 7.x and Mandrake 8.x; later versions of these distros apparently refuse to load the hpna2 linux module. Also, the module is intended for the 2.2.x and 2.4.x series of kernels; I have not tried the new 2.6 test kernel.

Unfortunately, HomePNA 2.0 is not open source, unlike the prior HomePNA 1.0 technology. Broadcom owns HomePNA 2.0, and licenses it to other vendors such as D-Link, Linksys, Diamond etc. A binary-only HomePNA 2.0 module does exist for Linux, however, and is available by as an unsupported driver from Linksys. While this driver is provided by Linksys, it will work on all HomePNA 2.0 devices, as they are all based on the Broadcom spec.

As root, verify that the HomePNA 2.0 pci card is properly installed and detected by your system. At bash prompt, execute:

bash# lspci

There will be several lines of output and one should be similar to:

01:0d.0 Ethernet controller: BROADCOM Corporation: Unknown device 4210

Download the hpna2 driver from ftp://ftp.linksys.com/beta/linux_hpna2_0_v2_34_0_2.exe.

You will note that, ironically, the driver is a Windows executable archive; you must open it up under Windows (or WINE, I suppose). The archive will unpack with three directories filled with both source and object files; we will be dealing with the one called "iL_hybrid".

Assume for the sake of this article that you save iL_hybrid to /home/iL_hybrid. You will need to compile the hpna2 module "il.o" from the source and object files therein.

You will also need the linux kernel source headers, which are usually found in a sub-directory under /usr/src/linux-2.4.xx where 2.4.xx is your distro's kernel version. You can determine your kernel version with the bash command:

root# uname -r
2.4.20

The command uname -r outputs the version number of your linux kernel. In the example above, the kernel version for Slackware 9.0 is 2.4.20; therefore the kernel headers should be in /usr/src/linux-2.4.20. For Knoppix 3.2-2003-07-26, the kernel version is 2.4.21-xfs and the kernel headers are in /usr/src/linux-2.4.21-xfs. For Knoppix 3.3-2003-09-24, however, the kernel version is 2.4.22-xfs, but the kernel headers are in /usr/src/linux-2.4.22 (NOT linux-2.4.22-xfs). This seems to be an mistake in the latest Knoppix, which has consequences for my Knoppix make.hpna2 script, below (more on this later).


KNOPPIX

I like to reinstall Knoppix whenever a new version comes out (I keep separate partitions for /home and /usr/local for convenience). I wrote a simple script to compile and install the hpna2 module automatically. Here it is for your own use (I am a newbie bash scripter, so please be kind):

<!----Begin Script----->
#!/bin/sh

# /home/make.hpna2;
# hpna2 is the HomePNA 2.0 home phoneline network module
# build and install hpna2 modules in Knoppix/Debian;

# needs hpna2 source and object files in /home/iL_hybrid

###### declare variables
# source path for hpna2 build files
SRCPTH=/home/iL_hybrid

# destination path for il.o;
#`uname -r` returns the kernel version
ILD=/lib/modules/`uname -r`/kernel/net

# path for Knoppix network files
ETCNET=/etc/network

# path for Knoppix module files
ETCMOD=/etc/modutils

# your hpna2 network card
ETH=eth1

# the following assumes static IP addresses, not DHCP

# IP address for your Knoppix box
IPADDR=192.168.0.3

# IP address for your network gateway
GATEADDR=192.168.0.1

# Network address
NETADDR=192.168.0.0

# Broadcast address
BRDADDR=192.168.0.255

# your ISP's DNS Nameserver address
NAMESERVER=123.456.789.254

###### end variable declarations

echo 'Building il.o module'

cd $SRCPTH

make LINUXVER=`uname -r`
# make uses variable LINUXVER to find the kernel headers under /usr/src
# You will see some gcc output at this point.
# Ignore the error message about malloc.h being deprecated; or
# you can edit il_linux.c and replace 'malloc.h' with 'slab.h'.
# When make is done, then 3 object (binary) files are created:
# il.o (the actual hpna2 module),
# il_linux.o and linux_osl.o (which seem to be intermediate object files)

mv il.o $ILD
rm il_linux.o
rm linux_osl.o
# now iL_hybrid is cleared for future re-use^M

cd /

echo 'Appending il to /etc/modules'
echo 'HomePNA 2.0 network' >> /etc/modules
echo 'il' >> /etc/modules

# Debian distros prefer that you don't manually edit modules.conf
# you edit the /etc/modutils/aliases file, then run update-modules

echo 'Appending il to /etc/modutils/aliases'
echo 'HomePNA 2.0 network' >> $ETCMOD/aliases
echo 'alias' $ETH 'il' >> $ETCMOD/aliases

echo 'update-modules with il'
update-modules

echo 'Temporarily bring up il.o module and enable networking'
insmod il

ifconfig $ETH1 $IPADDR
route add default gw $GATEADDR
# or if you have DHCP, replace above two lines with dhcpcd $ETH

echo 'Editing /etc/network/interfaces'
echo 'to bring up HomePNA 2.0 network interface'

echo 'HomePNA 2.0 NIC' >> $ETCNET/interfaces
echo 'auto' $ETH >> $ETCNET/interfaces
echo 'iface' $ETH 'inet static' >> $ETCNET/interfaces
echo ' address' $IPADDR >> $ETCNET/interfaces
echo ' netmask 255.255.255.0' >> $ETCNET/interfaces
echo ' network' $NETADDR >> $ETCNET/interfaces
echo ' broadcast' $BRDADDR >> $ETCNET/interfaces
echo ' gateway' $GATEADDR >> $ETCNET/interfaces

echo $ETH'='$ETH >> $ETCNET/ifstate

echo 'Bring up HomePNA 2.0 network'
ifup $ETH

echo 'Editing /etc/resolv.conf to include ISP DNS nameserver'
echo 'nameserver' $NAMESERVER >> /etc/resolv.conf^M

<!----End Script----->


Save the above script to make.hpna2, and as root:

root# chmod +x make.hpna2
root# ./make.hpna2


Try pinging your gateway:

root# ping -c4 192.168.0.1

If that works, fire up your web browser.

If you have to manually bring up your network, then do:

root# ifconfig eth1 192.168.0.3
root# route add default gw 192.168.0.1

or if you have DHCP: root# dhcpcd eth1


WARNING for Knoppix 3.3-2003-09-24: you will note the use of the `uname -r` command (note the ` apostrophes, located on the top left of your keyboard, under the ESC key) to obtain the linux kernel version for your Knoppix system.

In Knoppix 3.3-2003-09-24, the destination path for the kernel network modules is under /lib/modules/2.4.22-xfs/kernel/net, which is what is correctly assigned to the variable $ILD. However, the kernel headers for Knoppix 3.3-2003-09-24 is located under /usr/src/linux-2.4.22, not /usr/src/linux-2.4.22-xfs as expected.

To work around this error, either edit the script above with 'make LINUXVER=2.4.22' or create a symlink: ln -s /usr/src/linux-2.4.22 /usr/src/linux-2.4.22-xfs


SLACKWARE

Compiling and installing hpna2 for Slackware 9.0 is a lot easier, so I won't bother scripting it. It looks relatively simple without the variables and comments:

root# cd /home/iL_hybrid
root# make LINUXVER=`uname -r`
root# rm il_linux.o
root# rm linux_osl.o^M root# mv il.o /lib/modules/`uname -r`/kernel/net
root# echo 'HomePNA 2.0 network module' >> /etc/rc.d/rc.modules
root# echo -e 'insmod -f /lib/modules/'`uname -r`'/kernel/net/il.o' >> etc/rc.d/rc.modules
root# echo 'HomePNA 2.0 network interface' >> /etc/rc.d/rc.inet1
root# echo -e 'ifconfig eth1 192.168.0.1' >> /etc/rc.d/rc.inet1
root# echo 'My ISP dns nameserver' >> /etc/resolv.conf
root# echo 'nameserver 123.345.678.254' >> /etc/resolv.conf


To manually bring up the module and start the network connection:

root# insmod -f /lib/modules/`uname -r`/kernel/net/il.o
root# ifconfig eth1 192.168.0.1

Remember, I use my Slackware box as the internet gateway; if you are using it as a workstation instead, then you need a 'route add default g
w' command or a 'dhcpcd eth1' command.

Note that in Slackware, the hpna2 il.o module requires the use of the '-f' force option for insmod, and the entire path for the il.o module must be specified.


  



All times are GMT -5. The time now is 06:45 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration