https://github.com/leonjza/find-gw
🛰A bash script to check if you have a gateway that could get you somewhere nice.
https://github.com/leonjza/find-gw
discovery gateway network
Last synced: about 1 year ago
JSON representation
🛰A bash script to check if you have a gateway that could get you somewhere nice.
- Host: GitHub
- URL: https://github.com/leonjza/find-gw
- Owner: leonjza
- License: mit
- Created: 2019-11-21T16:02:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-08T17:22:17.000Z (over 6 years ago)
- Last Synced: 2025-03-24T17:52:40.677Z (about 1 year ago)
- Topics: discovery, gateway, network
- Language: Shell
- Homepage:
- Size: 4.88 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# find-gw.sh
A bash script to check if you have a gateway that could get you somewhere nice.
## usage
First, make sure you have [`nping`](https://nmap.org/nping/).
Next, download the script and run it. `nping` is going to want root for icmp, so use `sudo` or something similar.
```bash
curl -fsSL https://raw.githubusercontent.com/leonjza/find-gw/master/find-gw.sh -o find-gw.sh
# read the source code, right?
chmod +x find-gw.sh
sudo ./find-gw.sh 8.8.8.8
```
## example
```bash
$ sudo ./find-gw.sh 8.8.8.8
[info] Trying ARP entries to reach 8.8.8.8...
[success] Could reach 8.8.8.8 via xx:xx:xx:xx:xx:xx => gw.local (10.0.0.11) at xx:xx:xx:xx:xx:xx on eth0
[success] Could reach 8.8.8.8 via xx:xx:xx:xx:xx:xx => ap.local (10.0.0.20) at xx:xx:xx:xx:xx:xx on eth0
[info] Done!
```
## other
Sometimes, your ARP table won't have all of the entries availble on the LAN. Solve that by pinging a broadcast address. Assuming you are in a network like 192.168.5.0/24, try:
```bash
# Linux
ping -b 192.168.5.255
# macOS
ping 192.168.5.255
```