4
TR 181 components configuration
Raphaël Mélotte edited this page 2023-04-03 14:33:50 +00:00

[[TOC]]

In recent prplOS versions (depending on the version different components are available - see the prplOS release page) TR-181 components replace their OpenWrt counterpart.

This page lists example configurations that a user might want to apply, and how to do so using the TR-181 components (using ubus as an example).

Disabling the DHCP server on the LAN network| uci set dhcp.lan.ignore="1"

UCI

uci set dhcp.lan.ignore="1"

TR-181

Remove DHCP server pools with name "lan"

ubus call "DHCPv4.Server.Pool" _del '{ "rel_path": ".[Alias == \"lan\"]."}'
ubus call "DHCPv6.Server.Pool" _del '{ "rel_path": ".[Alias == \"lan\"]."}'

#also guests:
ubus call "DHCPv4.Server.Pool" _del '{ "rel_path": ".[Alias == \"guest\"]."}'
ubus call "DHCPv6.Server.Pool" _del '{ "rel_path": ".[Alias == \"guest\"]."}'

Enable the DHCP client for a network

UCI

uci set network.lan.proto=dhcp

TR-181

Set LAN interface as interface name.

ubus call DHCPv4.Client.1 _set   '{ "parameters": { "Interface": "IP.Interface.3." } }'
ubus call DHCPv6.Client.1 _set   '{ "parameters": { "Interface": "IP.Interface.3." } }'

Note: this might not work on interfaces other than the WAN interface (see 212609b67a/src/dhcpv4c_config.c (L177)).

Set a static IP for a network

UCI

uci set network.lan.proto=static
uci set network.lan.ipaddr=192.168.1.2

TR-181

ubus call "IP.Interface" _set '{ "rel_path": ".[Name == \"br-lan\"].IPv4Address.[Alias == \"lan\"].", "parameters": { "IPAddress": "192.168.1.2" } }'

Moving the WAN interface to the LAN bridge

UCI

Assuming eth0 is by default the LAN interface and eth1 is WAN:

uci del network.wan
uci set network.lan.ifname="eth0 eth1"

TR-181

?

Removing a lan interface from the bridge

UCI

Remove the interface from network.lan.ifname using uci set network.lan.ifname.

TR-181

?

Creating a VLAN interface

Assuming eth0 is the parent interface to use:

UCI

set network.UCC=interface
set network.UCC.ifname='eth0.200'
set network.UCC.proto='static'
set network.UCC.netmask='255.255.255.0'
set network.UCC.ipaddr='192.168.200.130'
EOF

TR-181

?

Allow SSH on the WAN network

UCI

# Create a hole for SSH on WAN:
uci add firewall rule
uci batch << 'EOF'
set firewall.@rule[-1].name='SSH'
set firewall.@rule[-1].src='wan'
set firewall.@rule[-1].dest_port='22'
set firewall.@rule[-1].target='ACCEPT'
set firewall.@rule[-1].proto='tcp'
set firewall.@rule[-1].enabled='yes'
EOF

TR-181

?

Remove the guest network

UCI

uci del network.guest

TR-181

ubus call Bridging.Bridge _del '{ "rel_path": ".[Alias ==  \"guest\"]." }'

Is anything else needed?