Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| docs:guide-developer:network-scripting [2021/08/30 11:01] – Get WAN interface vgaetera | docs:guide-developer:network-scripting [2023/07/19 09:34] (current) – [Get WAN gateway for unmanaged default route] add vgaetera | ||
|---|---|---|---|
| Line 208: | Line 208: | ||
| ===== Examples ===== | ===== Examples ===== | ||
| [[https:// | [[https:// | ||
| - | Replace automatic WAN detection with explicit interface definition if required. | + | Replace automatic WAN detection with explicit interface definition if necessary. |
| + | |||
| + | ==== Get LAN address ==== | ||
| + | <code bash> | ||
| + | # Runtime configuration | ||
| + | NET_IF=" | ||
| + | . / | ||
| + | network_flush_cache | ||
| + | network_get_ipaddr NET_ADDR " | ||
| + | network_get_ipaddr6 NET_ADDR6 " | ||
| + | echo " | ||
| + | echo " | ||
| + | </ | ||
| ==== Get WAN interface ==== | ==== Get WAN interface ==== | ||
| <code bash> | <code bash> | ||
| + | # Runtime configuration | ||
| . / | . / | ||
| network_flush_cache | network_flush_cache | ||
| Line 234: | Line 247: | ||
| ==== Get WAN L3 device ==== | ==== Get WAN L3 device ==== | ||
| - | {{section> | ||
| - | |||
| <code bash> | <code bash> | ||
| # Runtime configuration | # Runtime configuration | ||
| Line 248: | Line 259: | ||
| # Persistent configuration | # Persistent configuration | ||
| - | uci get network.wan.ifname | + | uci get network.wan.device |
| - | uci get network.wan6.ifname | + | uci get network.wan6.device |
| </ | </ | ||
| Line 297: | Line 308: | ||
| # Persistent static configuration | # Persistent static configuration | ||
| uci get network.wan6.ip6prefix | uci get network.wan6.ip6prefix | ||
| + | </ | ||
| + | |||
| + | ==== Get WAN gateway for unmanaged default route ==== | ||
| + | <code bash> | ||
| + | # Runtime configuration | ||
| + | ubus call network.interface dump \ | ||
| + | | jsonfilter -e " | ||
| + | [' | ||
| </ | </ | ||