【OpenWrt】树莓派上使用 AX88179 USB 网卡

Posted by 西维蜀黍 on 2021-05-13, Last Modified on 2021-09-21

安装 AX88179 Driver

AX88189驱动

opkg update && opkg install kmod-usb-net-asix-ax88179 
reboot

After next reboot, you should see your USB Ethernet interface initialized:

1...
2[    7.159985] usbcore: registered new interface driver r8152
3[    7.370114] r8152 2-2:1.0 eth1: v1.10.11
4[   10.665622] IPv6: ADDRCONF(NETDEV_CHANGE): eth1: link becomes ready
5[   10.673312] r8152 2-2:1.0 eth1: carrier on
6...

这时候插入usb转RJ45网口转换器,路由器会自动读取到这个接口,然后点击lan口的修改,选择物理设置,修改为eth1.

cat /etc/config/network

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd6e:d5a5:03a3::/48'

config interface 'lan'
	option proto 'dhcp'
	option ifname 'eth1'

手工编译AX88179驱动

$ opkg install make

usb lsusb

$ opkg update
$ opkg install usbutils

安装USB driver

启动无线网卡

$ ifconfig wlan0 up
$ iwlist wlan0 scan

Misc

$ vim /etc/config/network
config interface 'wan'
	option ifname 'wan'
	option proto 'dhcp'

When OpenWrt is booted up on the RPi, it assigns the IPv4 address 192.168.1.1 to the RPi’s ethernet card as a static address. If you don’t have anything else in your network using that address and are on the same 192.168.1.0/24 network, then plug it into your network using the ethernet port and ignore these next steps. If you do, then it gets a bit more tricky. I did have something on 192.168.1.1, so I attached a keyboard and screen to the RPi (easy to do with the RPi, not so easy with general routers!).

Then either directly or via ssh, log in as user ‘admin’ and password ‘1234’ and edit the file /etc/config/network. Assuming your current router is handing out addresses locally using DHCP, change the ’lan’ interface from the default configuration

config interface 'lan'
    option type 'bridge'
    option ifname 'eth0'
    option proto 'static'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.0'
    option ip6assign '60'
      

to get values picked up from the current router using DHCP

config interface 'lan'
    option ifname 'eth0'
    option proto 'dhcp'

and reboot with a wired connection from eth0 to the current router. Then you should be on your existing network using a wired connection. The new router then appears as a new device on the existing network, with a DHCP IPv4 address of 192.168.1.48 (in my case). The network looks like Figure 2.

/etc/init.d/network restart

Ifconfig 看一下自己的IP,或者ping google.com

opkg update
opkg install luci

Reference