ZAURUS HOME PAGE        RASPBERRY PI PAGE        LINUX COMMANDS        LINUX SCRIPTING

Setting Up Ethernet

This is the technical companion page to my blog post about my plans for adding Ethernet capability to my Zaurus so it can connect to my Raspberry Pi via ssh over Ethernet.

This page was written specifically to assist Zaurus and Raspberry Pi owners with setting up Ethernet connections, so some parts will and some will not apply, depending on your particular situation, but I do hope it will be of some value to a wider audience of people who have either one of these devices and are needing a down to earth discussion of how to get their Ethernet connection up and running, when the Raspberry Pi is a totally headless server that has no display at all of it's own.

Since I use the command line for most of what I do in Linux, and do not know much about GUI ways to do things, this page assumes you will be using a console or terminal, and may be of only limited value to you if you are only use GUI applications to do everything, as I use the command line for most of what I do.

It also is written by me as a user of the Zaurus using Sharp ROMs, and using Arch Linux on the Raspberry Pi, and it will probably make more sense to users of those distributions than folks who use neither.

Now, to get on to the business at hand, here is what I think people need to do, to ssh into a Raspberry Pi over Ethernet from a Zaurus or another mobile device or PC. At this point, I keep discovering more steps to add, which sometimes magically happen on their own and sometimes do not, that need to appear to make this a more complete guide. So if you are having problems, do check back, as I will continue to add new information as time goes on.

Also, please, if you are having problems, do ask for help in the forums or IRC, but be sure to also post detailed output from both devices involved and to clearly indicate which device is associated with which commands and output. I am sure we can help you, but you will get the best assistance more quickly if your request for help is very clear and detailed.

ON THE ZAURUS OR PC SIDE

Install SSH Software

The first step for getting ssh running on your device is to make sure you have downloaded and installed OpenSSH for the Zaurus or other mobile device. Without that, you will not be able to use ssh. If you are using a PC instead, I cannot tell you which ssh client to use, but there are plenty of free ones out there whether or not you run Linux.

If you do not know whether you have SSH installed on your device, you can find out fairly quickly by simply entering the command without any arguments. If you do not have ssh on your system, the results will be as follows:

bash-2.05# ssh
bash: ssh: command not found
bash-2.05#

And if you do have ssh installed, it will complain about the absence of arguments or respond with a message about usage, such as the following, and you can skip to the next section about enabling ethernet:

bash-2.05# ssh
usage: ssh [-1246AaCfgKkMNnqsTtVvXxY] [-b bind_address] [-c cipher_spec]
           [-D [bind_address:]port] [-e escape_char] [-F configfile]
           [-i identity_file] [-L [bind_address:]port:host:hostport]
           [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
           [-R [bind_address:]port:host:hostport] [-S ctl_path]
           [-w local_tun[:remote_tun]] [user@]hostname [command]
bash-2.05#

In my case, I am using "OpenSSH_5.0p1, OpenSSL 0.9.7a Feb 19 2003" using Sharp's ROMs on both my Collie and Tosa. Places you can get a copies of various other versions of ssh for the Zaurus are:

http://www.oesf.org/howto/downloads/openssh_1.2.3_arm.ipk
 
http://www.ossh.com/zaurus/feed/openssh_1.2.3_arm.ipk
 
http://quickening.zapto.org/ZaurusFeed/openssh-client_3.6.1p1_arm.ipk

And the version I am using on both my Collie and Tosa with the original Sharp ROMs, with md5sum 9ff8b1d5ff0d29402d67581cfd32689c, is here:

http://quickening.zapto.org/ZaurusFeed/openssh_5.0p1_arm.ipk

The above are all known Zaurus Feeds, and I am not really sure what the differences are between all these versions, so am posting links to them all and you can pick which you want to get. I honestly do not recall where I first got the version I have or why I picked it, I just know that it works. Quickening agreed to put a copy of mine on his feed for me (listed above), since it does not seem to be anywhere else on the web.

If you need a step by step guide or refresher for installing IPKs, or have trouble installing an application package, see my IPK Installation Guide for troubleshooting suggestions. The guide was written with a focus on installing IPKs on the Zaurus, but it also outlines very basic principles of installing and debugging application packages, so may be of use to others needing to install or debug installation of application packages on other devices with other package managers.

Once your ssh client is installed, I am not sure if you need to do anything more to use it except to enter the correct parameters on the command line. If you want to automatically log in to a server every time you go there, then there will be more steps involving generating and installing authorization keys. Until I get around to adding how to do that to this writeup, you will have to use a search engine or ask at the forums.

Ethernet Hardware for the Zaurus

Note that neither Sharp's sl5500 nor their sl6000 have built-in hardware necessary to run Ethernet, that requires purchasing special adapters. I know there are both CF and USB Ethernet adapters, but cannot recommend which will work best. A major issue may be finding the right driver or drivers that will enable the Zaurus to use the adapter.

It will be absolutely essential that any Ethernet adapter you attach to your Zaurus have a chip that can be recognized by appropriate modules on your Zaurus or PC. You will need to examine the output of dmesg to make sure that the adapter has been linked to or claimed by an active driver.

The issue of finding and activating appropriate drivers is too complex for me to address on this page. So, if your Ethernet Adapter is not claimed by an active driver, please turn to your favorite Zaurus or PC forum for assistance if you really want to run ethernet. Before asking for help, be sure to run both "dmesg" and "lsusb -v" so you can post the technical details about your adapter.

If the output of lsusb -v shows errors when your ethernet adapter has been attached, do not be alarmed unless dmesg also shows errors. There seems to be a bug in "lsusb -v" on the Zaurus that can result in errors getting device descriptors, but that has not interfered with my ability to use ethernet as long as there are no errors in dmesg and an appropriate device driver is invoked when the ethernet adapter is attached.

Another option for the Zaurus is to connect to the Raspberry Pi over usb rather than over Ethernet. I am using Ethernet to connect my sl6000 to my Pi, now that I have an appropriate adapter, but I also can certify that the sl5500 is quite able to ssh in to my Pi over usb. If you want to use usb (or actually usbd on the sl5500) to make the connection, check out my posts about ssh over usb in the Raspberry Pi Arch forum.

Note that usbd is only a viable alternative to to ethernet for connecting mobile devices to the Raspberry Pi in some cases. usbd will not work to connect the sl6000 to the Raspberry Pi because of problems with the drivers on the Raspberry Pi end that have not been fixed by anyone, as far as I can tell, as of April 2013. If you find or make a viable patch, please PM me so I can let others reading this page know about it.

Enable Ethernet on the Zaurus or PC

Before you can use ssh, you have to connect your PC or Zaurus to the ssh server via a network. And, even when there are just two machines talking to each other, their connection is a network. This does not require any kind of router if the Raspberry Pi is one of those machines, although you can use one if you want to.

All or most Zaurus ROMs with built in Local Area Network (LAN) capabilities have some kind of networking GUI that will enable you to rather easily enable Ethernet. I know I said I prefer the command line, but for this one step, using Sharp's GUI utility is much easier than trying to find all the related Linux system and Sharp and Qtopia settings files and editing them to reflect the appropriate parameters.

The sl5500 ROM 2.38 does not have Ethernet capability programmed in, but all ROMs on the sl6000 do. For Sharp ROM on the SL6000, I suggest using the Network GUI to enable LAN Ethernet, by selecting LAN, autodetect for name servers, and No Proxy in the GUI. I do not know if "Obtain TCP/IP Information Automatically" will work if you are not using a router, I will post more information about that when I can do more testing. For the TCP/IP selection, I have been filling in the IP address of my Zaurus, a netmask of 255.255.255.0, and leaving Gateway blank as I have no Gateway, and this has been working on my Tosa.

For other ROMs and installations, you will need to consult appropriate user guides and forums if the setup is not obvious.

Anyhow, once you think you have enabled Ethernet on your Zaurus, PC or mobile device, run the ifconfig command to make sure that eth0 appears and has a line showing the "inet addr" of your Zaurus or other mobile device. I suggest running ifconfig without any arguments, in case your system has enabled eth1 or eth2 instead of eth0, just to make sure:

bash-2.05# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:50:DA:33:1E:4B
          inet addr:192.168.2.221  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1514  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
 
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
         RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

bash-2.05#

If you are positive that ethernet will be coming up on eth0, then you can limit your output to just eth0 with the following command:

bash-2.05# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:50:DA:33:1E:4B
          inet addr:192.168.2.221  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1514  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
bash-2.05#

If eth0 or a similar item does not appear in the output, there are a number of reasons that could occur, although the solutions may be distribution specific, so you may need to ask for help in the forums. If you are running a Sharp ROM, ethernet will not come up on the Zaurus unless the host box (the Raspberry Pi) has activated ethernet and the Zaurus ethernet hardware has been properly activated.

If the Ethernet LINK lights are on, on both the Raspberry Pi and the ethernet adapter for your Zaurus, then check lsmod to make sure that your ethernet driver has been loaded. If it has been, them do rmmod and insmod, and see if that works. If it has not been loaded, then insmod the driver. If neither of those options work, and rebooting does not resolve the situation either, ask for help in the forums or over IRC. Also note that you may need to give the full path to the module for insmod to identify and load it.

Note that sometimes a driver can claim a device but the driver itself can be buggey. That was my experience for the kaweth driver on the Zaurus, and a better version of the driver had to be recompiled to resolve my inability to get ethernet up and running on the Tosa. I will soon be putting a new blog post up about that, so check back here for a link to that post if you run into driver problems for your Zaurus ethernet adapter.

If eth0 appears, but the specific IP of your Zaurus, or other mobile device or PC does not appear in the ifconfig output, then run the following command, putting your Zaurus or PC ethernet IP in place of nnn.nnn.nnn.n:

ifconfig eth0 nnn.nnn.nnn.n netmask 255.255.255.0 up

Then rerun the ifconfig command to ensure that the correct IP appears:

ifconfig

After your desired IP appears in ifconfig, run the "route" command to make sure that ethernet is enabled there as well:

bash-2.05# route
Kernel IP routing table
Destination     Gateway         Genmask Flags Metric Ref    Use Iface
192.168.2.0   *               255.255.255.0 U     0      0        0 eth0
bash-2.05#

A successful ifconfig, shown after my Zaurus went to sleep and I issued ifconfig to bring ethernet back up, showed output as follows

bash-2.05# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:50:DA:33:1F:8C
          inet addr:192.168.2.225  Bcast:192.168.2.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1514  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:632 (632.0 b)  TX bytes:560 (560.0 b)
bash-2.05#

If eth0 appears, examine the output and make sure that the IP number that you assigned to your Raspberry Pi appears in the output. If it does not appear, then make sure you have connected both your Zaurus or PC and the Raspberry Pi, then enter one or both of the following two commands on your Zaurus or PC. Remember to preface the commands with sudo if you are not running as root:

route add default gw IP-OF-RASPBERRY-PI eth0
route add -host IP-OF-RASPBERRY-PI eth0

Then rerun the route command to ensure the desired entries appear:

route

And try running ifconfig again:

ifconfig eth0 nnn.nnn.nnn.n netmask 255.255.255.0 up

Once ssh and ethernet have both been enabled on your PC or Zaurus, you can actually proceed with attempting to test the connection or log in, assuming the host - in this case, the Raspberry Pi - also has both ssh and ethernet enabled.

Note that the above commands may not result in an interface until ethernet has been brought up on the Raspberry Pi or other host PC, so if the above commands do not bring up ethernet on your Zaurus, then work on bringing up ethernet on the Raspberry Pi or host box before you try again. Note that I have found I absolutely cannot successfully bring up ethernet on my sl6000 until after the Raspberry Pi has ethernet up and running. It seems that the daemons which keep ethernet up on the Raspberry Pi may sometimes take it down when no ethernet connection is detected, but it is easy to bring it back up, once you know which approach you want to use, as outlined below.

ON THE RASPBERRY PI SIDE

There are a number of ways to get your Raspberry Pi running Arch Linux Arm set up to run Ethernet. If you have a Model A, it does not have the hardware built in, so you will need to obtain a USB Ethernet adapter. If your Raspberry Pi is a Model B, then it already has an ethernet port built in.

Then, your options for how you go about setting up ethernet on the software side depend on quite a few factors. If you have installed the latest Raspberry Pi Arch Linux Arm image from May 2013 or a more recent one, and are set up with dhcp on your router or switch, ethernet will come up as part of the boot process, without requiring any tweaking on your part at all.

The main download page at raspberrypi.org does not yet have a link to the May 2013 image, so here is a direct link if you need it:

http://downloads.raspberrypi.org/images/archlinuxarm/archlinux-hf-2013-05-14/

If you are not using a router for your connection, or are working with an updated Arch Linux Arm image rather than a fresh install of the latest image, then your solution will depend, for one thing, on whether you are running a headless server, with no access to the Pi other than ethernet on it's initial boot, or can set things up using a keyboard and monitor on the Pi.

If Ethernet does not come up automatically, you have at least three or four choices in how to set up ethernet and how to tell the Raspberry Pi it's IP address, whether it is one you choose on your own, or one assigned by an router or switch: one is to edit a one line configuration file in the boot sector (which is vfat so it does not have to be done by a Linux computer), another is to use netctl, the third is to set up systemd networking files, and a fourth is to simply use ifconfig to bring ethernet up.

Other possible choices, which I am not discussing here, are GUI network manager applications such as NetworkManager.

I have been told in the forums that sysctl is by far the easiest and best way to set up ethernet, if you are able to edit files in the root file system. And that might be true if you are knowledgeable about networking and have a standard networking setup. But if you get confused easily and do not have a standard networking setup, you may find it easier to simply use the first method below, which involves editing cmdline.txt.

I need to note that, of the following methods, the only two that have worked reliably for me thus far are Method 1 and Method 4. When I try using the other two methods, something always goes wrong, and I always end up reverting to Method 4, which is an option for me since I have other access to the command line on my Pi.

Method 1: Editing /boot/cmdline.txt
 
Method 2: Enable Netctl Service
 
Method 3: Use Systemd Service Files
 
Method 4: Starting Ethernet Manually

Method 1: Editing /boot/cmdline.txt

Assuming that you are not using a router or Ethernet switch, and that you do not have a way to edit any of the files in the root file system (i.e., partition 2) on your SD card, you will need to assign IP addresses by editing the settings in /boot/cmdline.txt. This can be done on another machine, by mounting the first partition of your SD card and then using a simple text editor. If you are running Windows, there is some disagreement as to the best text editor to use, make sure the one you are using does not add extra invisible or garbage characters to the file.
**Note that the discussion in this section is a "how to" that I wrote to help myself get Ethernet up and running. At this point, I have had many hardware issues and have not been able to test all the methods listed here, but I have successfully used this particular method to assign my Raspberry Pi an IP address for eth0, which shows in the output of the ifconfig command when I am running Arch on that particular SD card.

For another, alternative discussion of how to assign IP addresses in cmdline.txt, see the following thread in the Arch Linux subforum at RaspberryPi.org:

http://www.raspberrypi.org/phpBB3/viewtopic.php?p=219123#p219123

and this post

http://raspberrypi.org/phpBB3/viewtopic.php?f=63&t=5974#p94693

The format of the line to add to cmdline.txt on the Raspberry Pi is:

ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>

And the example given there which assigns 192.168.2.223 to the client (e.g., your PC), 192.168.2.225 to the server (the Raspberry Pi), and 192.168.2.1 to the internet gateway, is as follows:

ip=192.168.2.223:192.168.2.225:192.168.2.1:255.255.255.0:rpi:eth0:off

However, my experience is that for this particular purpose, the Raspberry Pi is the client and the PC is the server. The first IP address you assign is the one for your Raspberry Pi, and the second one is the one your PC uses. The third IP is that of your Internet Gateway. You will want to add something like the following line to cmdline.txt in the Raspberry Pi's boot partition, if the IP for your Pi is 192.168.2.3 and the IP for your PC is 192.168.2.2:

ip=192.168.2.3:192.168.2.2:192.168.2.1:255.255.255.0:rpi:eth0:off
 
ip=RASPBERRYPI-IP-NUMBER:PC-IP-NUMBER:GATEWAY-IP-NUMBER:255.255.255.0:rpi:eth0:off

However, the above assigns an IP for an internet gateway, and I will not have a local gateway. So, a friend advised me to assign some kind of harmless local IP as the gateway number, and this is the information I have been adding on to cmdline.txt instead of the above:

ip=192.168.2.3:192.168.2.2:127.0.0.1:255.255.255.0:rpi:eth0:off

Note that everything appearing in /boot/cmdline.txt must be written on the same line. If you add your IP information to a second or third line, the information will be ignored. If you can access a console, you can make sure that everything is on one line by issuing the following command and making sure that your IP data appears on the same line with everything else.

grep IP /boot/cmdline.txt

If you are using different distributions of the Pi, or even are testing different versions of a single distribution, you will need to either assign a different IP to each distribution on each SD card, or do some heavy duty kung fu making sure that all your distributions share the same ssh key. Otherwise, you will have serious difficulties sshing in to your Pi. Each SD card really needs it's own IP because they are different computers when seen by the ssh client, and the fact that they are running on the same Raspberry Pi board is irrelevant.

So, to give a practical example, I am testing different versions of Arch on my Pi. The old version of Arch is getting assigned one IP (...223) and the new version is getting assigned another IP (...224), as follows in cmdline.txt:

OLD ARCH CARD: ip=192.168.2.223:192.168.2.221:127.0.0.1:255.255.255.0:rpi:eth0:off
 
NEW ARCH CARD: ip=192.168.2.224:192.168.2.221:127.0.0.1:255.255.255.0:rpi:eth0:off

If your Zaurus, router, switch or PC already has given an IP to your PC or Zaurus, you will use that as the first parameter, instead of the IP I used. And possibly also different server and gateway numbers.

However, I have been doing more research on the IP section in cmdline.txt, and am not at all sure that the above example is at all appropriate if you do not have an NSF server. In fact, once interesting page I found said that if you are setting the IP for the Pi by hand, all that is needed (in addition to the various other types of entries in cmdline.txt) is one simple parameter in the IP entry - namely, the IP address you wish to assign to your Raspberry Pi. Again, I have not been able to adequately test this yet due to hardware issues, but am sharing in case it might help.

ip=192.168.2.221

If you have already booted your Raspberry Pi, then I am not sure how you will find out what IP your Raspberry Pi will be using for Ethernet, but if you set up your Zaurus or PC to autodetect the IP, and do not have other computers on the network, you will not need to do anything. Otherwise, there are a lot of discussions about how to handle this at the Raspberry Pi Forums, and you had best check out the threads that apply to your particular distribution.

I need to emphasize that while this method of editing cmdline.txt definitely can successfully assign IP numbers, it may not actually get the network up and running unless the Pi is set up to recognize and act on the parameters you have added. As I mentioned above, the main discussion about this occurred in a thread about NSF servers. I will be doing further testing but, at this point, do not know if we can get a network up and running without some additional way to also input commands or modify configuration files or profiles on the Pi's root file system itself.

Please also note that the information in cmdline.txt cannot take effect until after you reboot your system. So, if you edited the file on an SD card which was in the Raspberry Pi, be sure to issue the sync and then reboot commands to get the IP addresses to be recognized or assigned.

Method 2: Enable Netctl Service

If you have a fresh install of the latest Arch Linux Arm image for the Raspberry Pi, netctl has been set up for standard dhcp ethernet and will work immediately on the initial boot, whether or not you have a keyboard or monitor. If it does not work on the initial boot, you most likely have a unique setup and will need to copy an appropriate example from /etc/netctl/examples to /etc/netctl and edit it to fit your situation.

If you have an older Arch Linux Arm image, you will need to update it with pacman, or at least install netctl. To find out whether you have netctl on your system, type the following command:

which netctl

If you are just starting out, and only intend to use one type of network connecting your Raspberry Pi to another computer, you may prefer to use the first method described above to assign IP addresses, if ethernet does not work immediately. And, if you are running your Raspberry Pi headless, without another Linux computer you can use to edit the files in partition 2, to begin with, until you are able to get into your Pi to edit files in the rootfs, you may have to use the above method of editing the cmdline.txt file, instead of using netctl.

Anyhow, if you have a way to edit files in the root file system, you will be able to use netctl with systemd. Arch Linux on the Raspberry Pi uses systemd, and for quite a number of months, the preferred method for setting up ethernet, was to use netcfg. However, the Arch Community has put a lot of work into preparing to replace netcfg with netctl. So, if you have not yet set up your system to use Ethernet, I suggest going ahead and installing netctl, which is due to replace netcfg very shortly, and is available in the online repositories.

Netctl has a lot of very interesting features, and to learn more about them, be sure to read the man page, which is fairly short and simple. I have installed netctl but not got it running quite yet on all my Arch SD cards, due to hardware issues on the PDA I am attaching to my Pi. So, I also am going to send you to the following excellent wiki page to learn how to set up ethernet using netctl. Note the page also has instructions for how to migrate from netcfg to netctl:

https://wiki.archlinux.org/index.php/Netctl

The basic idea in using netctl to set up ethernet, is you copy the appropriate example in /etc/netctl/examples to another file, giving the new file the name you want to call the interface. The names of the example files are self-explanatory, you pick the one that matches your interface.

Note that netctl only accepts profiles for specific types of connections. They are ethernet, wireless, bond, bridge, tunnel, tuntap, and vlan. For more details about this, read the man page for netctl.profile, especially the section "AVAILABLE CONNECTION TYPES". If you have an unsupported type of connection, you will need to use method 3 or method 4 below to start your network. Netctl does not support connections over usb, such as the usb0 connection supported by the zaurus driver.

Anyhow, in all of the examples, there are some commonalities, which I will try to explain here. This is not a complete list of the parameters, but I hope will be enough to get you started.

Interface: this will be something like eth0 or lan0 or wlan0. You can check the actual name by running the "ip link" command and examining the output. And it will be provided for you if you use an appropriate template from the netctl examples.
 
Connection: this will be the type of connection, such as ethernet, pppoe, tunnel, wireless. This also will be provided if you use an appropriate template from the netctl examples.
 
IP: this parameter indicates how your IP address is to be assigned or obtained. It will be either static or dhcp, and will be correct if you chose an appropriate template.
 
Address: this will be where you indicate the IP address of your Raspberry Pi. You can indicate a single address, or address range. (temporary explanation in the forum post linked to later in this section)

The rest of the parameters in the netctl example files are ones that may or may not apply to any given setup, and are not needed for a simple wired ethernet connection. When I can more fully understand all of this, I will try to post more step by step details here. The documentation available online at this point for setting up the various configuration files, is mostly written about netcfg. But the concepts are generally the same for netctl, and if you are going to have to learn something new anyhow, use netctl rather than netcfg to set up Ethernet on your Arch Linux computer or device, since netcfg will soon be disappearing.

You also could try reading the following forum post(s), where use of netctl is explained:

http://www.raspberrypi.org/phpBB3/viewtopic.php?p=334491#p334491

Then, once you have set up your personalized netctl file, all you have to do to get it permanently started is to type the following command, where you should substitute the name of your personalized netctl file for "myethernet". Note the word after "enable" must be the file name of the netctl profile you wish to enable:

netctl enable myethernet

Again, netctl is already set up to work out of the box with the latest Arch image for the Pi, and it does work quite well once you have the right profile set up. But, if your need to get ethernet going is urgent, and you are having difficulty getting netctl working on an older ArchLinux install, then Method 1 or Method 4 may be easier to use until you get an appropriate netctl profile installed.

Method 3: Use Systemd Service Files

A third alternative is one that takes advantage of systemd's multiuser system service files. It has been explained quite well on the following page:

http://bvanderveen.com/a/rpi-booted-static-ip-ssh/

Following the instructions provided on the above page, I was able to relatively easily create a systemd service file and get ethernet service enabled. However, after rebooting my system for other reasons, the files I created following this method are not getting ethernet started, and I have reverted to using Method 4 as outlined below.

Method 4: Starting Ethernet Manually

This is the method I used the first time I got ethernet going on my Raspberry Pi, and is the method that I use after rebooting the system on any SD card on which ethernet does not work automatically. After making sure that all the right cables are plugged in, I first use the ifconfig command to see whether ethernet is running yet or not.

ifconfig

If ethernet is not running yet, I bring it up with the following command:

ifconfig eth0 192.168.2.225 netmask 255.255.255.0 up

I then make sure that ethernet had been brought up by issuing the ifconfig command again, this time limiting my output to just eth0:

ifconfig eth0

Output of ifconfig after ethernet has been running a few minutes on my Pi is as follows. When you run ifconfig before any data has been transferred, there will not be significant bytes or packets on the lines for RX and TX as there are in the sample below after ethernet was running a while on my Pi:

[alarmpi ~] ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
        inet 192.168.2.225  netmask 255.255.255.0  broadcast 192.168.2.255
        inet6 fe80::ba26:edff:fef0:f734  prefixlen 64  scopeid 0x20<link>
        ether d8:29:ef:f0:f9:59  txqueuelen 1000  (Ethernet)
          RX packets 261  bytes 21254 (20.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 194  bytes 29085 (28.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0  
[alarmpi ~]

I am not sure whether I was able to get an ethernet connection running the first time until I also ran the following command, giving the IP address of the other computer that I wanted to attach to the Pi. It may not be necessary, but try running it if the above steps does not suffice in getting the ethernet connection going:

route add 192.168.2.221 eth0

Format would be as follows:

route add IP-OF-REMOTE-SYSTEM eth0

And that was all I had to do on the Raspberry Pi side. This connection is not durable, it will not last past the next reboot, but it is a quick and easy way to test whether your equipment and IP addresses are working properly if you have not yet got things set up more permanently with one of the other methods. After rebooting my Pi, all I had to do to get ethernet up and running again was to issue the following command, where the nnn entries should be replaced with the ethernet IP address for the raspberry pi:

ifconfig eth0 nnn.nnn.nn.nn netmask 255.255.255.0 up

Note that the third set of numbers in the first IP address defines the network, so you cannot use the same number that that is being used for another network. There has to be a unique network interface number assigned, which will be shared by all computers and devices using that particular interface.

Since I am typing without a monitor, in order to simplify things, I have created an alias which I put in my .bashrc file, so all I have to do is type the alias when I need to start ethernet manually. You may find this handy if you need to save typing or tend to forget the exact parameters that need to go in the ifconfig command to get ethernet up and running again. Change the IP addresses in the following to fit your setup. Note that the IP address should be that of the Pi, not that of an external device:

alias ethup="ifconfig eth0 nnn.nnn.nnn.nn netmask 255.255.255.0 up"

Then all I have to do to get ethernet started is to type "ethup". If there is no error, the command should work, and you can verify that by entering the following ifconfig command, and seeing that your ip appears on the line for "inet", as in the sample output provided below:

[ alarmpi ~]  ifconfig eth0 eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500         inet 192.168.2.5  netmask 255.255.255.0  broadcast 192.168.2.255         inet6 fe80::bc29:ebff:fgf0:a779  prefixlen 64  scopeid 0x20<link>         ether a6:37:eg:f0:a7:69  txqueuelen 1000  (Ethernet)         RX packets 102  bytes 5202 (5.0 KiB)         RX errors 0  dropped 0  overruns 0  frame 0         TX packets 3  bytes 250 (250.0 B)         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0 [ alarmpi ~]

The most common problems with getting ethernet up and running (at least until it gets automated, and assuming all the cables are plugged in) are often those of putting in the wrong IP address, or failing to enable ethernet on both devices. On the Raspberry Pi, an inadequate power supply can also be the culprit.

TWEAKING AT BOTH ENDS

Once you have everything set up as described in the above sections, make sure that both devices have IPs that are consistent with the task at hand. Remember that the PC or Zaurus is a client vis a vis the Raspberry Pi. So the Pi's IP will need to be recorded on your PC or Zaurus as the Host IP, and as the Server IP on the Pi.

And make sure all the hardware is turned on and is adequately powered, and that all required cables are plugged in securely. If you have an inadequate power supply for any of the devices, the system may not be able to handle the power required to run ethernet.

Try pinging the Raspberry Pi from your Zaurus or PC.

ping 192.168.xxx.xx [put your server IP numbers instead of x's]

If you are able to ping successfully, then you can move on to the next section about ssh. But if you are not able to ping, the ip command can be very helpful in diagnosing the situation. If you do not have the command on your system, then use pacman to install the iputils package.

To see the current status of your ethernet setup, you can run the following command. If you are using something other than eth0 for your connection, substitute that for "eth0" below.

ip link show eth0

If you are using netctl, you also can try running either of the following two diagnostic commands. Substitute the name you have assigned your ethernet connection for PROFILE below.

systemctl status netctl@PROFILE.service
 
journalctl -xn

You can also try using the "netstat" command, to see what the IPs are of all devices and services connected to your Zaurus or PC.

netstat -nr

Another thing to do which can help in diagnosing problems on either end on Linux systems, is to examine the output of the dmesg command. And on both your PC and Raspberry Pi, you also can examine the logs. On the Pi, they are in /var/log.

If you are new to linux, the command that you should know about which helps to examine output from dmesg as well as in long files, is the "less" command. You can send the output of dmesg to less as in the following example.

dmesg| less

Or you can open and read a log file using the less command.

less /var/log/everything.log

If all the appropriate lights are on or flashing, then go over all the prior steps to make sure your IP entries are correct, using the diagnostic commands mentioned above to help identify the problem or problems.

LOGGING IN OVER SSH

Once you know you have a good solid connection, you can finally ssh in to your Raspberry Pi.

To use ssh to access a server the first time, and any time you have not enabled automatic login, the format is

ssh USERNAME@SSHSERVERNAME

For example, if my username is sdjf and I want to log in to my Pi, where the x's need replacing with the IP of my Pi, I can do so with either of the following. In the second example, I am using the name I assigned to the Pi in both /etc/hosts on my Zaurus and /boot/cmdline.txt on the Raspberry Pi:

ssh sdjf@192.168.xxx.xxx [put your IP numbers instead of x's]
 
ssh sdjf@192.168.2.223 [example using IP]
 
ssh sdjf@rpi [example using server name]

The first time you log in to your Pi, your username will vary, depending on the Raspberry Pi distribution that you use. To find out the current initial user name and password for your particular distribution, check the Official Raspberry Pi Downloads page, or the home page or forums for other distributions.

Quite a few people have had problems logging in to their Raspberry Pi's because they have changed their logins to something they cannot remember or have mistyped. So, if you have not yet created a more secure login and password for your Raspberry Pi, make sure that when you do, you carefully write down what you have done somewhere safe, to make sure that you do not have to reflash a new image just because you have lost your login name or password.

Initial Login Information as of April 2013 is:

Arch USER: root PW: root
 
Debian "wheezy" USER: pi PW: raspberry
 
Raspbian "wheezy" USER: pi PW: raspberry

The Pi probably uses a standard port number initially. But if your server uses a non-standard port number, which is often done for security purposes, you will need to also include that when you enter the ssh command, Make sure you use a lower case "p":

ssh USERNAME@SSHSERVERNAME -p PORTNUMBER

One issue I have run into is that when I reflash a fresh image on an SD card and then try to ssh in to that system, ssh will not let me log in to the Pi because the old authorization key for the Pi is outdated. The way to resolve this is to edit out the line referring to the relevant Pi IP address in .ssh/known_hosts, as it is no longer valid. As soon as I do that, ssh enables me to approve the new host and then negotiate logging in to the host.

If you have trouble logging in, then go over all of the above steps to make sure you have followed them properly. If you cannot determine what is wrong, then try searching the internet or posting a query on a message board for your distribution. For the Zaurus, you can go to OESF. For lists of troubleshooting guides and forums for the Raspberry Pi, see my Raspberry Pi Help and Tutorials page.


 

Revised May 25, 2013