2 LuCI - Lua Configuration Interface
4 Copyright 2009 Steven Barth <steven@midlink.org>
5 Copyright 2009 Jo-Philipp Wich <xm@subsignal.org>
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
11 http://www.apache.org/licenses/LICENSE-2.0
16 local niulib = require "luci.niulib"
17 local fs = require "nixio.fs"
18 local has_ipv6 = fs.access("/proc/net/ipv6_route")
20 m = Map("network", "Configure Local Network", "These settings affect the devices in your local network. "..
21 "Usually you do not need to change anything here for your router to work correctly.")
23 s = m:section(NamedSection, "lan", "interface", "Network Settings")
26 s:tab("general", translate("General Settings"))
28 ipaddr = s:taboption("general", Value, "ipaddr", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Address"))
29 ipaddr.default = "192.168.0.1"
30 ipaddr:depends("proto", "static")
32 nm = s:taboption("general", Value, "netmask", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Netmask"))
33 nm.default = "255.255.255.0"
34 nm:value("255.255.255.0")
35 nm:value("255.255.0.0")
37 nm:depends("proto", "static")
41 s:tab("expert", translate("Expert Settings"))
43 p = s:taboption("expert", ListValue, "proto", translate("Connection Protocol"))
45 p:value("static", translate("Static Ethernet"))
46 p:value("dhcp", "DHCP")
48 mac = s:taboption("expert", Value, "macaddr", translate("<abbr title=\"Media Access Control\">MAC</abbr>-Address"))
50 mtu = s:taboption("expert", Value, "mtu", "MTU")
53 dns = s:taboption("expert", Value, "dns", translate("<abbr title=\"Domain Name System\">DNS</abbr>-Server"))
54 dns:depends("peerdns", "")
57 gw = s:taboption("expert", Value, "gateway", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Gateway"))
58 gw:depends("proto", "static")
60 bcast = s:taboption("expert", Value, "bcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast"))
61 bcast:depends("proto", "static")
65 ip6addr = s:taboption("expert", Value, "ip6addr", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Address"), translate("<abbr title=\"Classless Inter-Domain Routing\">CIDR</abbr>-Notation: address/prefix"))
66 ip6addr:depends("proto", "static")
67 ip6gw = s:taboption("expert", Value, "ip6gw", translate("<abbr title=\"Internet Protocol Version 6\">IPv6</abbr>-Gateway"))
68 ip6gw:depends("proto", "static")
71 emerg = s:taboption("expert", Value, "_emergv4", translate("Emergency Access Address"))
72 emerg:depends("proto", "dhcp")
73 emerg.default = "169.254.255.169"
76 stp = s:taboption("expert", Flag, "stp", translate("Enable <abbr title=\"Spanning Tree Protocol\">STP</abbr>"),
77 translate("Enables the Spanning Tree Protocol on this bridge"))
79 ifname_multi = s:taboption("expert", MultiValue, "ifname", translate("Interface"))
80 ifname_multi.widget = "checkbox"
81 for _, eth in ipairs(niulib.eth_get_available("lan")) do
82 ifname_multi:value(eth, translate("Ethernet-Adapter (%s)") % eth)
89 s = m2:section(TypedSection, "dhcp", "DHCP")
94 s:tab("general", translate("General Settings"))
96 s:depends("interface", "lan")
98 enable = s:taboption("general", ListValue, "ignore", "Automatic address assignment for network devices", "")
99 enable:value(0, translate("enable"), {["network.lan.proto"] = "static"})
100 enable:value(1, translate("disable"))
103 s:tab("expert", translate("Expert Settings"))
104 start = s:taboption("expert", Value, "start", translate("First leased address"))
105 start:depends("ignore", "0")
107 limit = s:taboption("expert", Value, "limit", translate("Number of leased addresses"), "")
108 limit:depends("ignore", "0")
110 time = s:taboption("expert", Value, "leasetime", "Lease Time")
111 time:depends("ignore", "0")
113 local dd = s:taboption("expert", Flag, "dynamicdhcp", "Also generate addresses for unknown devices")
116 dd:depends("ignore", "0")