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 [2022/01/31 10:31] – add LAN interface example. @wulfy23 mercygroundabyss | docs:guide-developer:network-scripting [2023/07/19 09:34] (current) – [Get WAN gateway for unmanaged default route] add vgaetera | ||
|---|---|---|---|
| Line 210: | Line 210: | ||
| Replace automatic WAN detection with explicit interface definition if necessary. | Replace automatic WAN detection with explicit interface definition if necessary. | ||
| - | ==== Get LAN interface | + | ==== Get LAN address |
| <code bash> | <code bash> | ||
| + | # Runtime configuration | ||
| + | NET_IF=" | ||
| . / | . / | ||
| network_flush_cache | network_flush_cache | ||
| - | network_get_ipaddr | + | network_get_ipaddr |
| - | network_get_ipaddrs6 addrs6 | + | network_get_ipaddr6 NET_ADDR6 |
| - | echo "ipv4:$addr" | + | echo "${NET_ADDR}" |
| - | echo "ipv6:$addrs6" | + | echo "${NET_ADDR6}" |
| </ | </ | ||
| ==== Get WAN interface ==== | ==== Get WAN interface ==== | ||
| <code bash> | <code bash> | ||
| + | # Runtime configuration | ||
| . / | . / | ||
| network_flush_cache | network_flush_cache | ||
| Line 305: | 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 " | ||
| + | [' | ||
| </ | </ | ||