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/07/23 14:45] – [Get WAN L3 device] someothertime | 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 ==== | ||
| + | <code bash> | ||
| + | # Runtime configuration | ||
| + | . / | ||
| + | network_flush_cache | ||
| + | network_find_wan NET_IF | ||
| + | network_find_wan6 NET_IF6 | ||
| + | echo " | ||
| + | echo " | ||
| + | </ | ||
| ==== Get WAN L2 device ==== | ==== Get WAN L2 device ==== | ||
| Line 224: | Line 247: | ||
| ==== Get WAN L3 device ==== | ==== Get WAN L3 device ==== | ||
| - | |||
| - | {{section> | ||
| - | |||
| <code bash> | <code bash> | ||
| # Runtime configuration | # Runtime configuration | ||
| Line 239: | 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 |
| </ | </ | ||
| - | ==== Get WAN IP address ==== | + | ==== Get WAN address ==== |
| <code bash> | <code bash> | ||
| # Runtime configuration | # Runtime configuration | ||
| Line 275: | Line 295: | ||
| uci get network.wan.gateway | uci get network.wan.gateway | ||
| uci get network.wan6.ip6gw | uci get network.wan6.ip6gw | ||
| + | </ | ||
| + | |||
| + | ==== Get WAN prefix ==== | ||
| + | <code bash> | ||
| + | # Runtime configuration | ||
| + | . / | ||
| + | network_flush_cache | ||
| + | network_find_wan6 NET_IF6 | ||
| + | network_get_prefix6 NET_PFX6 " | ||
| + | echo " | ||
| + | |||
| + | # Persistent static configuration | ||
| + | uci get network.wan6.ip6prefix | ||
| + | </ | ||
| + | |||
| + | ==== Get WAN gateway for unmanaged default route ==== | ||
| + | <code bash> | ||
| + | # Runtime configuration | ||
| + | ubus call network.interface dump \ | ||
| + | | jsonfilter -e " | ||
| + | [' | ||
| </ | </ | ||