Hello, The following is an attempt to rectify some problems I have with mwan3, all credits for this tool goes to it's creator.
Anyway I'm trying to solve a problem in the script and need some advice how
to fetch all IPv4 addresses assigned to the interfaces (this is for nat
reflection).
One could do something like:
ip route | awk '{print $1}' | egrep '[0-9]{1,3}(\.[0-9]{1,3}){3}'
As you can notice from the above command,
>default via 213.16.246.6 dev pppoe-wan proto static metric 10
>default dev dslite-wan2 proto static scope link metric 20
>10.xx.xx.0/24 dev br-lan proto kernel scope link src 10.xx.xx.1
>10.xx.xx.0/24 dev eth0.3 proto static scope link metric 1
>192.0.0.1 dev dslite-wan2 proto kernel scope link src 192.0.0.2
>192.0.0.2 dev dslite-wan2 proto static scope link metric 20
>192.168.1.0/24 dev eth0.2 proto static scope link metric 30
>213.16.246.6 dev pppoe-wan proto kernel scope link src 193.92.xx.xx
That's all fine, but the last line would add the ISP's bbras to the nat
reflection table. Which of course isn't so helpful. :)
I could use awk '{print $5}' instead, to get my wan address put properly
in place for the nat reflection. But that would break the others.
Making an exception for the pppoe-links and pulling out the 5th column
with awk is also an option of course..
But I'm thinking, isnt there some better way to fetch and parse all
these IP's and have them neatly added to an array for working with them
from a bash script? Does OpenWRT/UCI have any functions for this that I
have overlooked?
My mind is a bit hazy this early in the morning so I also might have
missed something totally obvious here..
Many thanks in advance, and a merry christmas and a happy new year to to
you all!
pgpfDmhlJGX6g.pgp
Description: PGP signature
_______________________________________________ openwrt-users mailing list [email protected] https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-users
