This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| ip_script [2020/08/20 09:20] – seanb | ip_script [2024/10/31 21:36] (current) – hogwild | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | This script will discover the WAN IP of each WAN interface in a MultiWAN | + | ====== Determine external |
| - | --------------------------------------------------------- | + | \\ |
| - | #!/bin/sh | + | This script will discover the WAN IP of all WAN interfaces in a MultiWAN configuration and log them in the file: "/tmp/WAN-IPs" |
| - | | + | |
| - | WAN2=" | + | |
| - | WAN3=" | + | |
| - | WAN4=" | + | |
| + | <code -> | ||
| + | #!/bin/sh | ||
| + | WAN=" | ||
| + | WAN2=" | ||
| + | WAN3=" | ||
| + | WAN4=" | ||
| if [ " | if [ " | ||
| Line 14: | Line 16: | ||
| if [ " | if [ " | ||
| then | then | ||
| - | echo "WAN IP address: $(curl -s --interface $WAN http:// | + | echo "WAN IP address: $(curl -s --interface $WAN http:// |
| else | else | ||
| - | echo "WAN IP address: DOWN" > / | + | echo "WAN IP address: DOWN"> |
| fi | fi | ||
| fi | fi | ||
| Line 24: | Line 26: | ||
| if [ " | if [ " | ||
| then | then | ||
| - | echo "WAN2 IP address: $(curl -s --interface $WAN2 http:// | + | echo "WAN2 IP address: $(curl -s --interface $WAN2 http:// |
| else | else | ||
| - | echo "WAN2 IP address: DOWN" >> / | + | echo "WAN2 IP address: DOWN">> |
| fi | fi | ||
| fi | fi | ||
| Line 34: | Line 36: | ||
| if [ " | if [ " | ||
| then | then | ||
| - | echo "WAN3 IP address: $(curl -s --interface $WAN3 http:// | + | echo "WAN3 IP address: $(curl -s --interface $WAN3 http:// |
| else | else | ||
| - | echo "WAN3 IP address: DOWN" >> / | + | echo "WAN3 IP address: DOWN">> |
| fi | fi | ||
| fi | fi | ||
| Line 44: | Line 46: | ||
| if [ " | if [ " | ||
| then | then | ||
| - | echo "WAN4 IP address: $(curl -s --interface $WAN4 http:// | + | echo "WAN4 IP address: $(curl -s --interface $WAN4 http:// |
| else | else | ||
| - | echo "WAN4 IP address: DOWN" >> / | + | echo "WAN4 IP address: DOWN">> |
| fi | fi | ||
| fi | fi | ||
| + | </ | ||
| + | |||
| + | \\ | ||
| + | |||
| + | \\ | ||
| + | |||
| + | \\ | ||
| + | |||
| + | ---- | ||
| + | |||
| - | --------------------------------------------------------- | ||