Skip to content

Instantly share code, notes, and snippets.

@odevodyssey
Last active June 17, 2022 18:46
Show Gist options
  • Save odevodyssey/5b14d3105dc20fbb55120ad2b3731937 to your computer and use it in GitHub Desktop.
Save odevodyssey/5b14d3105dc20fbb55120ad2b3731937 to your computer and use it in GitHub Desktop.
OpenWrt USB OTG Serial And 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'
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
::askconsole:/usr/libexec/login.sh
tty1::askfirst:/usr/libexec/login.sh
ttyGS0::askfirst:/usr/libexec/login.sh
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_cdc
sleep 5
ifup otg
exit 0
config system
option hostname 'OpenWrt'
option timezone 'UTC'
option ttylogin '1'
option log_size '64'
option urandom_seed '0'
config timeserver 'ntp'
option enabled '1'
option enable_server '0'
list server '0.openwrt.pool.ntp.org'
list server '1.openwrt.pool.ntp.org'
list server '2.openwrt.pool.ntp.org'
list server '3.openwrt.pool.ntp.org'
@odevodyssey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment