@@ -66,7 +66,7 @@ install () {
6666 apt-get update
6767
6868 echo " Installing essential packages..."
69- apt-get install -y curl gnupg2 ca-certificates lsb-release traceroute mtr iputils-ping screen jq bind9-dnsutils wget
69+ apt-get install -y curl gnupg2 ca-certificates lsb-release traceroute mtr iputils-ping screen jq bind9-dnsutils wget python3
7070
7171 echo " Install additional tools..."
7272 apt-get install -y chafa gnuplot gawk
@@ -87,7 +87,7 @@ install () {
8787 echo " Latest grpcurl version: $GRPCURL_VERSION "
8888 GRPCURL_PKG_URL=https://github.com/fullstorydev/grpcurl/releases/download/v" $GRPCURL_VERSION " /grpcurl_" $GRPCURL_VERSION " _linux_" $ARCH " .deb
8989 echo " Downloading grpcurl from $GRPCURL_PKG_URL ..."
90- wget -O /tmp/grpcurl.deb " $GRPCURL_PKG_URL "
90+ wget --quiet - O /tmp/grpcurl.deb " $GRPCURL_PKG_URL "
9191 dpkg -i /tmp/grpcurl.deb && rm -f /tmp/grpcurl.deb
9292 grpcurl --version
9393
@@ -96,26 +96,67 @@ install () {
9696 apt-get install speedtest -y
9797}
9898
99+ test_subnet () {
100+ IP=" $1 "
101+ CIDR_FILE=" $2 "
102+
103+ cidr=$( python3 -c " import ipaddress, sys; ip = ipaddress.ip_address('$IP '); matches = [l.strip() for l in open('$CIDR_FILE ') if l.strip() and ip in ipaddress.ip_network(l.strip(), strict=False)]; print(*matches, sep='\n') if matches else sys.exit(1)" )
104+
105+ if [ $? -eq 0 ]; then
106+ echo " Match $cidr "
107+ grep " $cidr " feed.csv || echo " No matching subnet $cidr in feed.csv"
108+ grep " $cidr " pops.csv || echo " No matching subnet $cidr in pops.csv"
109+ else
110+ echo " No Match"
111+ fi
112+ }
113+
99114geoip () {
115+ echo -e " \n###### Downloading feed.csv and pops.csv from geoip.starlinkisp.net..."
116+
117+ wget --quiet -O feed.csv https://geoip.starlinkisp.net/feed.csv
118+ wget --quiet -O pops.csv https://geoip.starlinkisp.net/pops.csv
119+
120+ cat feed.csv | awk -F' ,' ' {print $1}' > subnet.txt
121+
122+ echo -e " \n###### GeoIP Lookup via ipinfo.io"
100123 curl -4 ipinfo.io --interface " $IFACE "
124+ v4_ip=$( curl -4 -s ipinfo.io/ip --interface " $IFACE " )
125+
101126 if [ " $IPV6_AVAILABLE " -eq 0 ]; then
102127 curl -6 v6.ipinfo.io --interface " $IFACE "
128+ v6_ip=$( curl -6 -s v6.ipinfo.io/ip --interface " $IFACE " )
103129 fi
130+
131+ echo -e " \n###### Checking GeoIP and PoP information"
132+ test_subnet " $v4_ip " " subnet.txt"
133+ if [ " $IPV6_AVAILABLE " -eq 0 ]; then
134+ test_subnet " $v6_ip " " subnet.txt"
135+ fi
136+
137+ rm -f subnet.txt
104138}
105139
106140cf_ray () {
141+ echo -e " \n###### Cloudflare Ray ID"
107142 curl -sI https://www.cloudflare.com/cdn-cgi/trace | grep cf-ray
108143}
109144
110145dns () {
111146 # TODO: support -b option to bind to specific interface
147+ echo -e " \n###### Checking DNS resolver locations"
112148 OPTIONS=" CHAOS TXT id.server +nsid"
149+ echo -e " -- Cloudflare DNS"
113150 dig @1.1.1.1 $OPTIONS
151+ echo -e " -- Google DNS"
114152 dig @8.8.8.8 $OPTIONS
153+ echo -e " -- Quad9 DNS"
115154 dig @9.9.9.9 $OPTIONS
116155}
117156
118157trace () {
158+ echo -e " \n###### MTR to Cloudflare"
159+
119160 OPTIONS=" -r -w -i 1 -c 10 -b --mpls"
120161 if [ -n " $IFACE " ]; then
121162 OPTIONS=" $OPTIONS -I $IFACE "
@@ -127,16 +168,22 @@ trace () {
127168}
128169
129170grpc_status () {
171+ echo -e " \n###### Starlink GRPC Status"
130172 grpcurl -plaintext -d {\" get_status\" :{}} 192.168.100.1:9200 SpaceX.API.Device.Device/Handle
173+
174+ echo -e " \n###### Starlink GRPC Location"
131175 grpcurl -plaintext -d {\" get_location\" :{}} 192.168.100.1:9200 SpaceX.API.Device.Device/Handle
132176}
133177
134178show_networking () {
179+ echo -e " ###### Networking Interfaces"
135180 ip addr show
181+ echo -e " ###### Routing Table"
136182 ip route show
137183}
138184
139185obstruction_map () {
186+ echo -e " \n###### Generating Obstruction Map"
140187 lens -map
141188 ls -alh obstruction-map-* .png
142189 filename=$( ls -alh obstruction-map-* -t | head -n 1 | awk ' {print $9}' )
@@ -147,6 +194,8 @@ obstruction_map () {
147194}
148195
149196ping_gw () {
197+ echo -e " \n###### Ping Starlink Gateway"
198+
150199 datetime=$( date " +%y%m%d-%H%M%S" )
151200 ping -D -I " $IFACE " -c 10000 -i 0.01 100.64.0.1 > ping-100.64.0.1-$datetime .txt
152201 ls -alh ping-100.64.0.1-* .txt
@@ -173,8 +222,6 @@ run_once() {
173222
174223 IPV6_AVAILABLE=$( test_ipv6; echo $? )
175224
176- set -x
177-
178225 show_networking
179226 grpc_status
180227 geoip
0 commit comments