Skip to content

Instantly share code, notes, and snippets.

@AzimsTech
Last active February 22, 2023 12:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AzimsTech/0404429cc82f8b7c8e7373bde4db1bef to your computer and use it in GitHub Desktop.
Save AzimsTech/0404429cc82f8b7c8e7373bde4db1bef to your computer and use it in GitHub Desktop.
OpenWrt 22.03.x TMNet UniFi Configurations | D-Link DIR-842 (swconfig)

OpenWrt 22.03.x TMNet UniFi Configurations | D-Link DIR-842 (swconfig)

                               _______                     ________        __
                              |       |.-----.-----.-----.|  |  |  |.----.|  |_
                              |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
                              |_______||   __|_____|__|__||________||__|  |____|
                                       |__| W I R E L E S S   F R E E D O M
                              -----------------------------------------------------

Switch configuration

Software vs hardware ports in OpenWrt

chrome_4XUVrB9Udt

VLAN tagging

/etc/config/network
...

config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option vid '1'
    option ports '0t 4 3 2'
    option description 'LAN'

config switch_vlan
    option device 'switch0'
    option vlan '2'
    option ports '0t 5t'
    option vid '500'
    option description 'Internet'


config switch_vlan
    option device 'switch0'
    option vlan '3'
    option ports '1 5t'
    option vid '600'
    option description 'IPTV'

VLAN tagging in LuCi

chrome_rlCmofEUHp

Example full network configuration

/etc/config/network
config interface 'loopback'
    option device 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config globals 'globals'

config device
    option name 'br-lan'
    option type 'bridge'
    list ports 'eth0.1'

config device
    option name 'eth0.1'
    option macaddr 'XX:XX:XX:XX:XX:XX' # LAN mac address

config interface 'lan'
    option device 'br-lan'
    option proto 'static'
    option netmask '255.255.255.0' # Netmask
    option ip6assign '64'
    option ipaddr '192.168.0.1' # Gateway IP

config interface 'wan'
    option proto 'pppoe'   
    option device 'eth0.500'
    option username 'username@unifi'    #  The PPPoE username provided by TM
    option password 'password'  #    The PPPoE password
    option peerdns '0'
    list dns '8.8.8.8'
    list dns '1.1.1.1'
    option ipv6 '1'

config interface 'wan6'
    option proto 'dhcpv6'
    option device '@wan'
    option reqaddress 'try'
    option peerdns '0'
    list dns '2001:4860:4860::8888'
    list dns '2606:4700:4700::1111'
    option reqprefix 'auto'

config switch
    option name 'switch0'
    option reset '1'
    option enable_vlan '1'

config switch_vlan
    option device 'switch0'
    option vlan '1'
    option vid '1'
    option ports '0t 4 3 2'

config switch_vlan
    option device 'switch0'
    option vlan '2'
    option ports '0t 5t'
    option vid '500'
    option description 'Internet'


config switch_vlan
    option device 'switch0'
    option vlan '3'
    option ports '1 5t'
    option vid '600'
    option description 'IPTV'
@AzimsTech
Copy link
Author

chrome_4XUVrB9Udt

@AzimsTech
Copy link
Author

chrome_rlCmofEUHp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment