OpenWRT: dukungan USB tethering

From OnnoWiki
Jump to navigation Jump to search

sumber: https://wiki.openwrt.org/doc/howto/usb.tethering


USB tethering is used to connect your OpenWrt-Router over your Smartphone with the Internet. Another scenario is the connection over a USB-Ethernet-Adapter like the TP-Link UE300. Follow:
   https://forum.openwrt.org/viewtopic.php?pid=173399#p173399
   if not clear enough, please read usb.essentials in this wiki
!: This can also be completly done by using the LuCI web UI.

Installation

USB Basic Support

Install USB Basic Support if not already installed by default on your OpenWrt router.

Install tethering packages

After you finished with USB Basic Support you have to install some Kernel packages to get USB tethering support.

opkg update
opkg install kmod-usb-net kmod-usb-net-cdc-ether kmod-usb-net-rndis


opkg install kmod-usb-net kmod-usb-net-rndis kmod-usb-net-cdc-ether usbutils udev \
kmod-usb-net-cdc-ncm kmod-usb-serial kmod-usb-serial-option kmod-usb-serial-wwan kmod-usb2 block-mount udev usb-modeswitch usbutils

usbutils and udev packages may be required to reconnect the phone correctly to the router. These are fairly large packages, and at least the Nexus 5 connects fine without them. Actually, kmod-usb-net-rndis would be sufficient since it depends on kmod-usb-net and kmod-usb-net-cdc-ether.

Configuration

On the Smartphone

Enable USB Tethering on your Smartphone and connect it with the USB cable to your routers USB port.

On the router

Use the new usb0 (or for some cases eth1) network device as WAN connection and set the protocol to DHCP client mode.

uci del network.wan
uci set network.wan=interface
uci set network.wan.ifname=usb0
uci set network.wan.proto=dhcp
uci commit network

After commiting the changes to the network configuration bring up the WAN interface to obtain an IP, gateway and DNS address from your Smartphones DHCP server.

ifup wan

Testing the connection

Login to the OpenWrt router with SSH at 192.168.1.1. With logread

logread

With ifconfig

ifconfig $(uci get network.wan.ifname)

With ping

ping -c 4 www.google.com


Referensi