Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
fuss:openwrt [2017/02/22 18:30] – external edit 127.0.0.1fuss:openwrt [2019/03/01 18:35] – [Fixing Terminal Compatibility Issues with Cygwin] office
Line 16: Line 16:
 ipkg-build -o root -g root soft ipkg-build -o root -g root soft
 </code> </code>
 +
 +====== Create TAP Interface on Boot ======
 +
 +OpenWrt scripts can add a TAP interface to a bridge on boot, however tap interfaces are usually created on demand rather than persisting across reboots. To make sure that the TAP interface is brought up on boot, create a script at ''/etc/init.d/createtap'' with the following contents:
 +<code bash>
 +#!/bin/sh /etc/rc.common
 +
 +START=30
 +SERVICE_USE_PID=0
 +
 +TAP=`ifconfig -a | grep tap0 | wc -l
 +
 +start() {
 +    if [ $TAP -eq 0 ]; then
 +        ip tuntap add mode tap tap0
 +    fi
 +}
 +
 +stop() {
 +    if [ $TAP -eq 1 ]; then
 +        ip tuntap del mode tap tap0
 +    fi
 +}
 +</code>
 +and possibly change ''tap0'' to a desired interface name.
 +
 +In order to activate the script, issue:
 +<code bash>
 +/etc/init.d/createtap enable
 +</code>
 +
 +The interface should now be created on reboot.
 +
 +Once TAP interfaces are created the MAC address is randomly generated such that unless you are sending a DHCP client ID, the interface will be difficult to track. To set a permanent MAC address for the TAP interface, edit ''/etc/config/network'' and add a MAC address for the TAP interface.
 +
 +For example, the snippet:
 +<code>
 +config interface 'tap'
 +        option ifname 'tap0'
 +        option proto 'dhcp'
 +        option macaddr 'ca:36:40:4a:79:5e'
 +</code>
 +
 +configures a TAP interface ''tap0'' that will retrieve its address via DHCP by sending the MAC address ''ca:36:40:4a:79:5e''.
 +
 +The configuration combined with the script above work perfectly well together: the script takes care to create the interface and the OpenWrt network configuration will set the MAC address when the interface is brought up.
 +
 +====== Fixing Terminal Compatibility Issues with Cygwin ======
 +
 +If you access OpenWrt from a cygwin shell, you will notice that running ncurses-based programs (for instance, ''joe'', ''pico'' or ''nano'' editors) will mess up the lines. This is due to cygwin setting the terminal type to ''cygwin'' which is not contained in the ''terminfo'' OpenWrt package.
 +
 +To resolve the issue, the ''cygwin'' terminal information from ''C:\cygwin64\usr\share\terminfo\63\cygwin'' (assuming the cygwin install root is at ''C:\cygwin64'') should be copied over to ''/usr/share/terminfo/c/cygwin''. Note that the ''terminfo'' OpenWrt package does not contain the ''c'' directory under ''/usr/share/terminfo'' such that it will have to be created before copying over the file.
 +
 +====== Making Samba Bind to Interfaces ======
 +
 +On OpenWrt version ''18.06.1'', the Samba template files contains a variable that should be interpolated:
 +<code>
 +interfaces = |INTERFACES|
 +</code>
 +
 +unfortunately, the interfaces do not seem to be configurable via LuCi and even using ''uci'' to set the variable ''samba.@samba[0].interfaces'' to some value will only make OpenWrt interpolate an empty string instead of the configured value.
 +
 +Seeing that the interfaces to listen on cannot be configured via LuCi, removing the ''interfaces = |INTERFACES|'' line and hardcoding the interfaces to listen on seems to be the best option.

fuss/openwrt.txt · Last modified: 2022/06/17 19:08 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.