Monday, January 29, 2018

RaspBerry Pi - The Audio Engine - Part 8 - Network Dongle

Now I'll explain how to install an external ethernet dongle to our Audio Engine. 

First you should read the general article  I wrote some time ago. 
There I'm outlining why this exercise could be of interest for you. 
On PI Zeros that'd be a must-do exercise anyhow.




As discussed over in the dongle article, my USB dongle is based on the well supported "Realtek RTL8153" chip.  I'd say it's a much better choice then the RPI ethernet chip. 
Look for a dongle with such a chip too!

The usb-net kernel-module "r8152" is required. That also covers the RTL8153

First the kernel module package has to be download and installed.
Then we need to make pCP loading it at boot.

As usual login via ssh. Und copy/paste below commands.

#######################################################
tce-load -wi net-usb-$(uname -r).tcz
echo "net-usb-$(uname -r).tcz" >> /mnt/mmcblk0p2/tce/onboot.lst
sync 
halt


#######################################################

Now you can plugin the dongle and attach the ethernet cable.
Power the whole thing up. And you'll end up with this:





As you can see the IP address is now assigned to eth1.


Yep. It's that easy.


Usually the IP address will change after attaching a new ethernet port!
ssh to the PI using your old IP address wouldn't work anymore!
You need to find the new address on your router again.
We've done that exercise earlier on the standard ethernet port! 

Now you're all set.

However. We can do a little more.

We can bring down the non-active eth interface. We do it with our tuning script
which starts 3 minutes after boot.

As usual ssh login. And copy paste below

#############################
cat <<'EOF' >>/mnt/mmcblk0p2/tce/tune.sh
ls /sys/class/net | grep "eth1" && {
  ifconfig eth0 | grep -i 'inet addr' || ifdown eth1
  ifconfig eth1 | grep -i 'inet addr' || ifdown eth0

}
EOF
sync
sudo reboot


##############################

What this does: 

1. we look if there is a 2nd interface, if so
2. we look for the one that is connected to the router and shut the other one down.



Enjoy.



















2 comments:

  1. Hi,
    any way to disable the unused eth.port then?

    ReplyDelete
    Replies
    1. A good catch. ;)
      I have a setup working on my own installation that does it. I even do more. I'll come to that later.

      For now I added a small tweak that'll do.

      Good luck.

      SC

      Delete