How to set up Atheros AR8161 Ethernet controller.

(11/11/2013;)
Kernel 3.10+ supports Atheros AR1861 ethernet card.

OS: Debian GNU/Linux Wheezy
Kernel: 3.4.0-10.dmz.1-liquorix-amd64

I installed a PCI ethernet card for networking because Linux kernel fails to recognize load the kernel module.

$ lspci | grep Ethernet
02:00.0 Ethernet controller: Atheros Communications Inc. AR8161 Gigabit Ethernet (rev 10)
03:05.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

How do I install drivers for the Atheros AR8161 Ethernet controller?
sudo apt-get install build-essential linux-headers-generic linux-headers-`uname -r`
wget -O- http://linuxwireless.org/download/compat-wireless-2.6/compat-wireless-2012-07-03-pc.tar.bz2 | tar -xj
cd compat-wireless-2012-07-03-pc
./scripts/driver-select alx
make
sudo make install

I had this error.
$ sudo modprobe alx
ERROR: could not insert 'alx': Exec format error

Found the same case here http://forums.archlinux.fr/topic11360.html.
Does the person suggest earlier version works? Or Kernel 3.4.x is not supported yet?

I downloaded compat-wireless-2012-03-12-p.tar.bz2 from

http://www.orbit-lab.org/kernel/compat-wireless/2012/03/.

Kernel build procedure was identical to previous version. After the kernel module installation, ‘modprobe alx’ loaded the kernel module. eth2 is AR8161 Ethernet card.

ifconfig -a
eth1 Link encap:Ethernet HWaddr 00:0e:e8:de:d2:e9
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20e:e8ff:fede:d2e9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:74415 errors:0 dropped:0 overruns:0 frame:0
TX packets:61364 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:86011384 (82.0 MiB) TX bytes:7384748 (7.0 MiB)
Interrupt:20 Base address:0xcc00

eth2 Link encap:Ethernet HWaddr 50:46:5d:03:17:29
BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:16

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
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)

I wanted to use AR8161 as default ethernet card. To swap ethernet cards, change names in /etc/udev/rules.d/70-persistent-net.rules. This file is generated by udev when system starts.

When I opened the file, I found a ghost device called sky2. Where it came from? I plugged in the hard disk to new rig without deleting the file. If udev detects it during boot, it adds device. Old dual core system has two ethernet cards. I took a Realtek ethernet card from the old system and installed in new one to access Internet.

udev find Realtek and AR8161 in new system so it registers those address but fails to register sky2 because it does not exist anymore. I deleted this rule file and restarted system.
/etc/udev/rules.d/70-persistent-net.rules
# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x11ab:0x436b (sky2)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="00:1f:e2:03:60:53", ATTR{dev_id}=="0x0", ATTR{type}=="1",
KERNEL=="eth*", NAME="eth0"

# PCI device 0x10ec:0x8139 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="00:0e:e8:de:d2:e9", ATTR{dev_id}=="0x0", ATTR{type}=="1",
KERNEL=="eth*", NAME="eth1"

# PCI device 0x1969:/sys/devices/pci0000:00/0000:00:04.0/0000:02:00.0 (alx)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="50:46:5d:03:17:29", ATTR{dev_id}=="0x0", ATTR{type}=="1",
KERNEL=="eth*", NAME="eth2"

New rule file showed only two ethernet cards as I expected. I swapped two lines and NAME flags so that next boot AR8161 would be assigned as eth0, default ethernet card for system. Below is the final file.

# This file was automatically generated by the /lib/udev/write_net_rules
# program, run by the persistent-net-generator.rules rules file.
#
# You can modify it, as long as you keep each rule on a single
# line, and change only the value of the NAME= key.

# PCI device 0x1969:/sys/devices/pci0000:00/0000:00:04.0/0000:02:00.0 (alx)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="50:46:5d:03:17:29", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x10ec:/sys/devices/pci0000:00/0000:00:14.4/0000:03:05.0 (8139too)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0e:e8:de:d2:e9", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Kernel loaded modules for two cards.
$ dmesg | grep -i Eth
8139cp: 8139cp: 10/100 PCI Ethernet driver v1.3 (Mar 22, 2004)
8139too: 8139too Fast Ethernet driver 0.9.28
8139too 0000:03:05.0: eth0: RealTek RTL8139 at 0xffffc9001197cc00, 00:0e:e8:de:d2:e9, IRQ 20
udevd[893]: renamed network interface eth0 to eth1
Qualcomm Atheros(R) AR813x/AR815x/AR816x PCI-E Ethernet Network Driver
eth0: no IPv6 routers present

Kernel modules for Atheros Communications Inc. AR8161 Gigabit Ethernet

alx 68274 0
compat 1907 1 alx

Kernel modules for Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+

8139too 21945 0
8139cp 20285 0
mii 5142 2 8139cp,8139too

The system has correct orders I made.
eth0 – Atheros Communications Inc. AR8161 Gigabit Ethernet
eth1 – Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+
ifconfig -a
eth0 Link encap:Ethernet HWaddr 50:46:5d:03:17:29
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::5246:5dff:fe03:1729/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:11475 errors:0 dropped:0 overruns:0 frame:0
TX packets:12485 errors:0 dropped:0 overruns:0 carrier:1
collisions:0 txqueuelen:1000
RX bytes:1894079 (1.8 MiB) TX bytes:1793385 (1.7 MiB)
Interrupt:16

eth1 Link encap:Ethernet HWaddr 00:0e:e8:de:d2:e9
BROADCAST MULTICAST MTU:1500 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:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:20 Base address:0xcc00

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
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)

About these ads

About janpenguin

Free Energy technologies, Permaculture Email: janpenguin [at] riseup [dot] net Every content on the blog is made by Free and Open Source Software in Debian GNU/Linux.
This entry was posted in GNU/Linux and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s