Skip to content

Instantly share code, notes, and snippets.

@odevodyssey
Created June 17, 2022 18:48
Show Gist options
  • Save odevodyssey/37d4bdaa89a29d40f760ea44c6a12e59 to your computer and use it in GitHub Desktop.
Save odevodyssey/37d4bdaa89a29d40f760ea44c6a12e59 to your computer and use it in GitHub Desktop.
OpenWrt USB OTG Ethernet Setup
################################################################################
# Bootloader configuration - config.txt
################################################################################
################################################################################
# For overclocking and various other settings, see:
# https://www.raspberrypi.org/documentation/configuration/config-txt/README.md
################################################################################
# OpenWrt config
include distroconfig.txt
[all]
# Place your custom settings here.
dtoverlay=dwc2
config dnsmasq
option domainneeded '1'
option boguspriv '1'
option filterwin2k '0'
option localise_queries '1'
option rebind_protection '1'
option rebind_localhost '1'
option local '/lan/'
option domain 'lan'
option expandhosts '1'
option nonegcache '0'
option authoritative '1'
option readethers '1'
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto'
option nonwildcard '1'
option localservice '1'
option ednspacket_max '1232'
config dhcp 'lan'
option interface 'lan'
option start '100'
option limit '150'
option leasetime '12h'
option dhcpv4 'server'
option dhcpv6 'server'
option ra 'server'
option ra_slaac '1'
list ra_flags 'managed-config'
list ra_flags 'other-config'
config dhcp 'wan'
option interface 'wan'
option ignore '1'
config odhcpd 'odhcpd'
option maindhcp '0'
option leasefile '/tmp/hosts/odhcpd'
option leasetrigger '/usr/sbin/odhcpd-update'
option loglevel '4'
config dhcp 'otg'
option interface 'otg'
option start '100'
option limit '150'
option leasetime '12h'
list ra_flags 'none'
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fdce:c9e5:9451::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'
config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'
config interface 'wwan'
option proto 'dhcp'
config interface 'otg'
option proto 'static'
option device 'usb0'
option auto '0'
option ipaddr '192.168.2.1'
option netmask '255.255.255.0'
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
modprobe g_ether
sleep 5
ifup otg
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment