View Issue Details

IDProjectCategoryView StatusLast Update
0000294NetworksHardwarepublic2023-08-28 23:48
ReporterDigitalMy 
PrioritynormalSeverityminorReproducibilityhave not tried
Status resolvedResolutionfixed 
Summary0000294: Set OpenWrt router as gateway to remote network
DescriptionConnect smartphone (Android) with USB cable to router (OpenWrt).

Make alternative internet source with automatic change:
1. Use smartphone as internet souce (not USB, hotspot way)
use for period of being nearby
have problem with automatic route switch back to default
2. Connect to WiFi hotspot (when available)
default way
3. USB modem device, mobile provider
used for another location as default
Steps To Reproduce> install like:
opkg install nano
opkg install mc
~6MB size
TagsNo tags attached.

Relationships

related to 0000302 progressDigitalMy Windows and other desktop OS Unified settings for OpenVpn clients site-to-site mode 
related to 0004364 assignedDigitalMy Networks Router Netgear WNDR4700 
related to 0000297 assignedDigitalMy Networks Unlock USB modem and set IMEI 
related to 0004363 resolvedDigitalMy Networks Set OpenWrt dual gateway switch 
related to 0005403 resolvedDigitalMy Networks Upgrade OpenWrt router to AC-type standard gateway to remote network with Linksys EA4500 

Activities

DigitalMy

2019-08-27 01:30

administrator   ~0000800

Got Netgear WNDR4700 Centria N900 dual band gigabit wireless router storage
Installed OpenWrt 18.06.4 firmware

DigitalMy

2019-08-27 01:35

administrator   ~0000801

Last edited: 2021-07-25 18:01

View 13 revisions

Install usbutils with lsusb tool:
opkg update && opkg install usbutils

connected FAT32 flash ,
lsusb -t
gives
Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc2/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 480M
This kind of driver dwc2

dmesg
xhci_hcd 0000:45:00.0: Direct firmware load for K2013080.mem failed with error -2
xhci_hcd 0000:45:00.0: firmware failed to load (-2)

found this issue
https://forum.openwrt.org/t/wndr4700-support-for-usb3/14809
https://forum.openwrt.org/t/fixed-usb-not-working/2071

need to put the following file: K2013080.mem into /lib/firmware like:
wget http://server.tk/pub/firmware/WNDR4700/USB3_FW/K2013080.mem
mv K2013080.mem /lib/firmware/K2013080.mem

and either reboot router, or just reload xhci-pci module
http://www.adapter.co.jp/Adapter/PP2U-jp.html

opkg install http://server.tk/pub/firmware/WNDR4700/uPD72020x-firmware_2_powerpc_464fp.ipk
issue fixed

DigitalMy

2019-09-17 02:39

administrator   ~0000813

Last edited: 2021-10-31 17:09

View 9 revisions

Now add LTE modem to openwrt

opkg install usb-modeswitch
opkg install kmod-mii
opkg install kmod-usb-net
opkg install kmod-usb-wdm
opkg install kmod-usb-net-qmi-wwan
opkg install uqmi

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

not used: kmod-usb-net-asix kmod-usb2 kmod-ath9k kmod-usb-ohci

NDIS interface (QMI Mode),
enable it on port 7 as follows

uqmi -d /dev/cdc-wdm0 --get-data-status
-> disconnected
uqmi -d /dev/cdc-wdm0 --get-signal-info
-> lte
uqmi -d /dev/cdc-wdm0 --start-network internet --autoconnect
uqmi -d /dev/cdc-wdm0 --get-data-status
-> connected

add new logic interface in OpenWrt web: dhcp client protocol type for wwan0 interface
set firewall "wan" zone for this interface
set firewall to allow forwarding from lan to wan

nano /etc/config/network
or
mcedit /etc/config/network

config interface 'wwan_lte'
        option proto 'dhcp'
        option ifname 'wwan0'




for 3G modem (other model):
opkg install kmod-usb-serial-wwan
opkg install kmod-usb-serial-option

DigitalMy

2019-09-18 00:36

administrator   ~0000816

Last edited: 2019-09-24 03:32

View 7 revisions

Add VPN L2TP client

IPsec PSK type (L2TP secret - not used, IPsec identifier - not used, IPSec pre-shared key - used) is server default

> install:
ipsec-tools
xl2tpd

> set:
nano /etc/xl2tpd/xl2tpd.conf
nano /etc/ppp/options.xl2tpd
nano /etc/ipsec.secrets for the preshared key
nano /etc/ipsec.conf for the configuration of the tunnel

> start demon
 /etc/init.d/xl2tpd

> restart
/etc/init.d/xl2tpd restart
/etc/init.d/ipsec restart

daemon.debug xl2tpd[1589]: No such tunnel 'l2tp-vpn'
daemon.notice netifd: vpn (1588): xl2tpd-control: Remove l2tp-vpn failed



need to configure name "sstp" connection

DigitalMy

2019-09-20 16:27

administrator   ~0000817

Last edited: 2021-12-07 01:44

View 12 revisions

Add video camera USB
+ 1.8TB 2.5 HDD storage for video surveillance

gdisk -> make partition sdb1

mkdir -p /tmp/introot
mkdir -p /tmp/extroot
mount --bind / /tmp/introot
mount /dev/sdb1 /tmp/extroot
tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf -
umount /tmp/introot
umount /tmp/extroot




install video camera:
opkg install kmod-video-core kmod-video-uvc





test (mjpg-streamer):
opkg install mjpg-streamer

connect device to USB port:
     uvcvideo: Found UVC 1.00 device VF0520 Live! Cam Sync
ls /dev/v*
         /dev/video0
Run:
  mjpg_streamer -i "input_uvc.so -d /dev/video0 -y" -o "output_http.so"
And connect to web:
   http://10.2.1.1:8080/?action=stream and http://10.2.1.1:8080/?action=snapshot

tested fine, but found it useless
opkg remove mjpg-streamer

DigitalMy

2019-09-20 18:21

administrator   ~0000818

Last edited: 2021-12-10 00:22

View 5 revisions

Add user for share and share SMB
opkg install luci-app-samba

nano /etc/passwd
    
testuser:x:501:501:testuser:/home/user:/bin/ash

passwd testuser

Use web interface and add share

mkdir /home/testuser
chown testuser /home/testuser
chmod -R 777 /share

/etc/init.d/samba enable
/etc/init.d/samba start
/etc/init.d/samba restart


will run SMB server as /usr/sbin/smbd
/etc/samba/smb.conf could be created from to the uci configuration file and /etc/samba/smb.conf.template will be overwritten with /etc/config/samba on restart



in case removal this luci-app-samba
got error Failed to execute cbi dispatcher target for entry '/admin/services/samba'. /usr/lib/lua/luci/cbi.lua:53: Model 'samba' not found!
do
rm /tmp/luci-indexcache

DigitalMy

2019-09-23 17:36

administrator   ~0000820

Last edited: 2021-07-25 18:03

View 7 revisions

SSTP protocol (single TCP port) try VPN:
> add missing proto from github:
wget http://server.tk/pub/firmware/WNDR4700/sstp/sstp.sh
mv sstp.sh /lib/netifd/proto/sstp.sh

> it seems that plugin was installed to wrong folder.... fix:
cp /usr/lib/sstp-pppd-plugin.so /usr/lib/pppd/2.4.7/sstp-pppd-plugin.so

> set up simple SSTP client:
nano "/etc/ppp/chap-secrets"
> add or edit line with password (user password here, this is not PSK) on third position and * on fourth position

> set
nano /etc/ppp/peers/sstp
> use in command line:
--cert-warn
--save-server-route (send all traffic to tunnel)
--ipparam sstp
--nolaunchpppd
> and params:
name vpn (server username, same as in chap-secrets)

DigitalMy

2019-09-25 22:00

administrator   ~0000822

Last edited: 2020-09-29 17:56

View 10 revisions

try OpenVPN
> installed and tested Windows server (tun) side

> installed OpenWrt Luci plugin to remote router:
opkg install luci-app-openvpn

> set "OpenVPN" plugin as client, tun, upload certificates
nano /etc/config/openvpn
disable "comp-lzo" on server side

> from web interface button, it will run as :
/usr/sbin/openvpn --syslog openvpn(ovpn) --status /var/run/openvpn.ovpn.status --cd /var/etc --config openvpn-ovpn.conf

This will set local hosts in remote network to route all traffic using VPN, not WAN:
> on router device add routing table as new line "10 vpn" to:
nano /etc/iproute2/rt_tables
> add hosts which need routing to VPN :
ip rule add from 10.2.1.10 table vpn
>check
ip rule list
> specify (enable) "vpn" table for "tun0" interface:
ip route add default dev tun0 table vpn

>copy certificates from server (3 files as set in .conf) like:
wget -P /etc/openvpn/ http://server/exchange/client.key
key must have no challenge pasword

this works fine, except site-to-site access to "client" network...
> Official manual https://openvpn.net/vpn-server-resources/site-to-site-routing-explained-in-detail/ offered enable IP forwarding:
nano /etc/sysctl.conf
net.ipv4.ip_forward=1

use
tcpdump -eni any icmp
for ping monitoring run this on remote client network host, send ping to this client network host from server network host ,
ICMP packet arrived, but no reply generated by this host... it was lunux one.

Tested windows host on the same network - it is "routable".
OpenVpn finally works as expected.

chmod 777 /etc/luci-uploads
optional step

DigitalMy

2019-09-29 23:22

administrator   ~0000826

Last edited: 2021-12-07 02:21

View 3 revisions

> Remove test and faulty apps:
opkg remove luci-app-ocserv
opkg remove ocserv
opkg remove openconnect
opkg remove strongswan
> Reboot router for web site reload (delete menu from LuCi)

DigitalMy

2019-10-06 15:45

administrator   ~0000838

Last edited: 2019-10-19 13:01

View 5 revisions

> in system log of OpenWrt LuCi : dmesg :
kern.warn kernel: xhci_hcd 0000:45:00.0: WARN Successful completion on short TX for slot 1 ep 2: needs XHCI_TRUST_TX_LENGTH quirk?

uname -mrs
Linux 4.14.131 ppc
cat /proc/version
Linux version 4.14.131 (buildbot@2ccc8102e0c3) (gcc version 7.3.0 (OpenWrt GCC 7.3.0 r7808-ef686b7292))

>possible insttall kmod-usb-dwc3 (now kmod-usb-dwc2)

opkg install usbutils
lsusb -v | grep -E '\<(Bus|iProduct|bDeviceClass|bDeviceProtocol)' 2>/dev/null

opkg install pciutils
lspci -nn
45:00.0 USB controller [0c03]: Renesas Technology Corp. uPD720202 USB 3.0 Host Controller [1912:0015] (rev 02)

Decided not to connect this USB-camera to router...

DigitalMy

2019-10-13 11:54

administrator   ~0000840

opkg install ipset
 /etc/init.d/firewall restart
Warning: Section @zone[1] (wan) cannot resolve device of network 'wwan_h'
nano /etc/config/firewall
>removed from "config zone" this device
Warning: Section @rule[10] (RDP3389) does not specify a protocol, assuming TCP+UDP
> specified TCP protocol in /cgi-bin/luci/admin/network/firewall/rules

DigitalMy

2019-10-24 13:20

administrator   ~0000851

Last edited: 2023-08-28 23:48

View 2 revisions

Set same OpenVPN configuration for logs and status file, applied on each OpenWrt host.
/tmp/log/ folder used to save logs:
status /tmp/log/openvpn-status.log 60
log /tmp/log/openvpn-log.log

DigitalMy

2020-06-01 18:05

administrator   ~0002910

Last edited: 2020-06-02 21:41

View 2 revisions

Tested D-link DIR-685 storage router as alternative
using original web interface uploaded OpenWrt as specified in https://openwrt.org/toh/d-link/dir-685 , but it stops on boot now...
need to flash chip inside now

DigitalMy

2021-06-21 21:22

administrator   ~0007039

Last edited: 2021-09-02 22:20

View 5 revisions

Record video from USB camera
 /dev/video0
And connect to web:
get video: http://10.2.1.1:8082
settings: http://10.2.1.1:8083


install motion
> opkg install motion
edit settings:
      /etc/motion.conf
> mkdir /etc/motion
> mv /etc/motion.conf /etc/motion/motion.conf

 prepare free space:
> mv /root/*.jpg /share/motion/
> rm /share/motion/*.jpg

checck log file
> touch /share/motion/motion.log

> nano /etc/default/motion

check running process
> ps | grep motion
> ps axu | grep -i motion | grep -v grep

DigitalMy

2021-07-24 13:39

administrator   ~0007053

SFTP-server will be installed to OpenWrt, after SSH enabled
>
opkg update
opkg install openssh-sftp-server

DigitalMy

2021-07-24 16:30

administrator   ~0007054

Add SD card support:
opkg install kmod-mmc
opkg install kmod-mmc-over-gpio
opkg install kmod-sdhci

connect SD card (insert) and check:
fdisk -l

mkdir -p /mnt/sda1
mount -t vfat /dev/sda1 /mnt/sda1

DigitalMy

2021-07-25 18:02

administrator   ~0007055

USB storage support:

check:
opkg list-installed | grep usb

install:
opkg update
opkg install kmod-usb-net-rndis

but it stopped USB storage detection after that...

kmod-usb-core -> preinstalled
kmod-usb-ohci -> done
kmod-usb-storage -> preinstalled
kmod-usb2 -> no need, because we had kmod-usb3
kmod-fs-ext4 -> preinstalled
kmod-fs-vfat -> preinstalled
block-mount -> preinstalled

opkg install kmod-usb-storage-uas

DigitalMy

2021-07-25 22:42

administrator   ~0007056

Last edited: 2021-07-27 02:46

View 3 revisions

Get HDD state
opkg install smartmontools
smartctl -a /dev/sda

Format SATA HDD
opkg install kmod-scsi-core
opkg install e2fsprogs
mkfs.ext4 /dev/sda1
mount -t ext4 /dev/sda1 /share

DigitalMy

2021-07-27 03:12

administrator   ~0007057

Add SMB share
opkg install samba36-server

DigitalMy

2022-11-03 00:38

administrator   ~0008192

Last edited: 2022-11-03 01:36

View 3 revisions

Tested router
installed OpenWRT as in https://openwrt.org/toh/xiaomi/miwifi_mini
Xiaomi Mi Wi-Fi mini (R1C) DC 12V 1A
CPU MT7620A 580MHz

Reset router and do initial setup with password 12345678
Upload firmware miwifi_r1cm_all_75496_2.8.91_ENG.bin using web page
Run commands after login to web page of version
http://192.168.31.1/cgi-bin/luci/;stok=d8a4aeaae9af4cbc8e259d0360a97c62/api/xqnetwork/set_wifi_ap?ssid=whatever&encryption=NONE&enctype=NONE&channel=1%3B%2Fusr%2Fsbin%2Ftelnetd
it will show {"msg":"Couldn't connect to this network(Probe timeout)","code":1616}
http://192.168.31.1/cgi-bin/luci/;stok=d8a4aeaae9af4cbc8e259d0360a97c62/api/xqsystem/set_name_password?oldPwd=12345678&newPwd=1
it will show {"code":0}
telnet 192.168.31.1 23
use root user and password 1 set before
wget http://192.168.31.175:8021/openwrt-22.03.2-ramips-mt7620-xiaomi_miwifi-mini-squashfs-sysupgrade.bin
cat /proc/mtd
check OS1 exists
mtd -r write openwrt-22.03.2-ramips-mt7620-xiaomi_miwifi-mini-squashfs-sysupgrade.bin OS1



R1C.jpg (62,425 bytes)
R1C.jpg (62,425 bytes)

DigitalMy

2022-11-13 20:23

administrator   ~0008197

Add NTP server

opkg update
opkg install ntpd
/etc/init.d/sysntpd disable
/etc/init.d/ntpd enable
/etc/init.d/ntpd start
netstat -l | grep ntp

DigitalMy

2022-12-18 02:15

administrator   ~0008202

Last edited: 2023-08-27 13:03

View 2 revisions

Set web interface ports in:
/etc/config/uhttpd

Apply, restart uhttpd service:
/etc/init.d/uhttpd restart