Ethernet

From wikiPodLinux

Table of contents

Introduction

(Note: This does not yet work on 4G/Photo/Mini, but only on 1G, 2G and 3G models)

It is possible to have the iPod running iPodLinux connect to a TCP/IP network using IP over FireWire technology.

This page is a bit out of date. See the iPod to iPod article for a more recent (partial) solution.

Enabling IP over FireWire on your iPod

When the iPod boots the Linux kernel it will automatically configure its local ethernet device (ethernet over firewire/IEEE1394) and then, after init(/etc/rc) is finished executing, starts inetd so that network connections via telnet may be made. Keep in mind, if init(/etc/rc) doesnt return, inetd will not be executed. This means if you have podzilla or a shell in /etc/rc you will not be able to telnet in.

The default configuration is for the iPod to use 192.168.222.2, but podzilla prevents inetd and telnetd from starting. The default config may be changed by editing the /etc/rc script.

Update: That used to be the default configuration, but the most recent version of the Userland files for some reason lack the commands in /etc/rc needed to set up the ethernet interface; however, recent kernels appear to still support networking. The specific commands to add to the end of /etc/rc are:
modprobe tsb43aa82
modprobe eth1394
ifconfig eth0 192.168.222.2 mtu 170
this will start the network interface after you exit Podzilla. You must also add this line to /etc/inittab on the ipod to start inetd:
::respawn:/sbin/inetd

Alternately, you can grab the "obsolete" versions of these files from the CVS repository.

Enabling IP over FireWire on your Windows PC or Mac OS X computer

Warning: This is only the theory how it should work. Actual testing shows that this does NOT work, unfortunately. Only ip-over-firewire connection that is known to work (in some cases at least, from hearsay) requires a Linux system as host, as explained further below.

In order for the iPod to connect to a network, it still needs to be plugged into something with its FireWire cable. That would be your PC.

If you have a Windows XP or Mac OS X system, its network setup should provide you with an easy way to enable IP over FireWire, even allow you to share that FireWire connection with the internet so that the iPod could talk to the world wide web when plugged into your PC this way. See your computer's help pages on networking an IP over FireWire for learning how to set it up.

Note: If you set up the FireWire network interface, do not use automatic settings but specify these values manually:

  • IP Address: 192.168.222.1
  • Subnet Mask: 255.255.255.0
  • Gateway/Router: 192.168.222.1 (or leave blank)
  • DNS: may leave blank

Enabling IP over FireWire on your Linux PC

If you are using Linux, you may have to take some additional steps to add and enable IP over FireWire in your kernel.

Please note, the required ethernet driver is from the 2.4.20 kernel only. The newer driver in 2.4.21+ and 2.5.xx will not work as it uses an incompatible protocol for ARP (which unfortunately the iPod cannot support). If you have a 2.6.x kernel you can compile the ipodeth1394 module instead.

Patching your Linux Kernel

To connect to your iPod, first you will need to configure ethernet over firewire on your host(the computer you are connecting to the iPod). Unfortunately due to a bug in the iPod ethernet driver it is necessary to use a special version of the ethernet driver on the host. At present this is only possible on Linux hosts running a 2.4.20 (or possibly earlier) kernel. The following patch should be applied to the eth1394.c file in the drivers/ieee1394 directory of your kernel tree.

--- eth1394.c.orig	2003-03-12 16:35:47.000000000 +0100
+++ eth1394.c	2003-03-12 16:38:27.000000000 +0100
@@ -680,6 +680,11 @@
 	}
 
 	ptask->skb = skb;
+	/* hack to address broadcast packets to the "other" node */
+	if ( (dest_node & NODE_MASK) == NODE_MASK ) {
+		dest_node = priv->host->node_id ^ 0x1;
+		addr = ETHER1394_REGION_ADDR;
+	}
 	ptask->addr = addr;
 	ptask->dest_node = dest_node;
 	INIT_TQUEUE(&ptask->tq, hpsb_write_sched, ptask);

Once you have built your modified ethernet driver you can then load that module and configure the new device.

Firstly to create the new ethernet interface you need to load the module:

modprobe eth1394

Compiling the ipodeth1394 module for a 2.6 kernel

First step is to get the sources:

% cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ipodlinux login
[ press enter for "CVS password:" ]
% cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/ipodlinux co tools/ipodeth1394
% cd tools/ipodeth1394/2.6/

If your kernel is newer than 2.6.9, you will need to apply the following patch to the CVS module sources:

--- ipodeth1394.c       29 Feb 2004 15:32:59 -0000      1.1
+++ ipodeth1394.c       29 Jan 2005 18:43:03 -0000
@@ -453,7 +453,7 @@

        skb->mac.raw = skb->data;
        skb_pull (skb, ETH_HLEN);
-       eth = skb->mac.ethernet;
+       eth =  (struct eth1394hdr *)skb->mac.raw;
 #if 0
        if(*eth->h_dest & 1) {
                if(memcmp(eth->h_dest, dev->broadcast, dev->addr_len)==0)
@@ -728,7 +728,7 @@

 static int __init ether1394_init_module (void)
 {
-       packet_task_cache = kmem_cache_create("packet_task", sizeof(struct packet_task),
+       packet_task_cache = kmem_cache_create("packet_task2", sizeof(struct packet_task),
                                              0, 0, NULL, NULL);

        /* Register ourselves as a highlevel driver */

Second step, compile it:

% make KDIR=PATH_TO_YOUR_KERNEL

Where usualy PATH_TO_YOUR_KERNEL is /usr/src/linux

Last, install the new module:

# cp ipodeth1394.ko /lib/modules/`uname -r`/kernel/drivers/ieee1394/
# update-modules
# depmod

Depending on your distribution, the last two commands can be a little different. Now you can go on with the above steps Configuring eth1 and Connecting to the iPod exept that for loading the module the command changes to:

# modprobe ipodeth1394

Beware that there are some stability issues with ipodeth1394; Make sure to bring your ipodeth1394 device down before unloading the modules. It also has some problems with SMP and Preemptible kernels.

iPod Network Configuration

Once your ethernet over firewire module is loaded, a new ethernet interface should be available. This new interface will normally be eth1 however if you already have a number of ethernet interfaces it may be different. As root, type "ifconfig -a" to show all available interfaces, the last unconfigured one will likely be your firewire interface.

To configure the network simply run the command:

ifconfig eth1 192.168.222.1 mtu 170

Where eth1 is the ethernet interface you have determined above. The IP address of 192.168.222.1 will work correctly with the default configuration of the iPod. If this address is not appropriate with your local network configuration or you want to use telnet you will have to modify the configuration on the iPod (edit the /etc/rc script) as appropriate (see the Finishing up section in the Installation Manual for more information).

Connecting to your iPod with Telnet

Assuming you have both your iPod and your PC set up to use IP over FireWire and successfully connected them over the FireWire cable, you can now try talking to your iPod from your PC (the following assumes you use a command line interface. If you are on Windows, that would mean to use CygWin or alike):

Once configured you should be able to ping the iPod with the following command:

ping 192.168.222.2

If it shows problems connecting or failures, your setup if most likely wrong. Try again, search the internet for help.

If you configured your iPod for telnet you should now be able to connect with:

telnet 192.168.222.2

Now you should see a login prompt. To login, specify "root" as the username and "default" as the password.

The iPod kernel also includes NFS client support which has been used with some success. If you export file systems from your host PC, you can mount them on your iPod.