network information script

#!/bin/bash # john meister 2014_O7_23 # date with options produces a file name that shows when the info was collected: network.2014_07_23.txt # # echo "gathering network info for `hostname`" > network.`date +'%Y_%m_%d'`.txt echo "==================================" >> network.`date +'%Y_%m_%d'`.txt date >> network.`date +'%Y_%m_%d'`.txt echo "==================================" >> network.`date +'%Y_%m_%d'`.txt ifconfig -a | grep Bcast >> network.`date +'%Y_%m_%d'`.txt ifconfig -a | grep HWaddr >> network.`date +'%Y_%m_%d'`.txt echo "==================================" >> network.`date +'%Y_%m_%d'`.txt route | grep default >> network.`date +'%Y_%m_%d'`.txt echo "==================================" >> network.`date +'%Y_%m_%d'`.txt cat /etc/resolv.conf | grep search >> network.`date +'%Y_%m_%d'`.txt cat /etc/resolv.conf | grep nameserver >> network.`date +'%Y_%m_%d'`.txt echo "==================================" >> network.`date +'%Y_%m_%d'`.txt uname -a >> network.`date +'%Y_%m_%d'`.txt echo "==================================" >> network.`date +'%Y_%m_%d'`.txt cat /etc/hosts >> network.`date +'%Y_%m_%d'`.txt echo "==================================" >> network.`date +'%Y_%m_%d'`.txt cat /etc/resolv.conf >> network.`date +'%Y_%m_%d'`.txt echo "==================================" >> network.`date +'%Y_%m_%d'`.txt or better, use a variable for the log file, and add the hostname if dealing with multiple systems: --> cat bin/networkinfo.sh #!/bin/bash # john meister 2014_07_23 # produces a file name: network.hostname.2014_07_23.txt # network.hostname.YYYY_MM_DD.txt # export LOG="network.`hostname`.`date +'%Y_%m_%d'`.txt" date >> $LOG echo "==================================" >> $LOG ifconfig -a | grep Bcast >> $LOG ifconfig -a | grep HWaddr >> $LOG echo "==================================" >> $LOG route | grep default >> $LOG echo "==================================" >> $LOG route >> $LOG echo "==================================" >> $LOG cat /etc/resolv.conf | grep search >> $LOG cat /etc/resolv.conf | grep nameserver >> $LOG echo "==================================" >> $LOG uname -a >> $LOG echo "==================================" >> $LOG cat /etc/hosts >> $LOG echo "==================================" >> $LOG cat /etc/resolv.conf >> $LOG echo "==================================" >> $LOG #

quick script to find IP on known subnet on MacOSx

#!/bin/bash # john meister 2016_05_15 # extracts active IP information on designated subnet # name the script based on the subnet, e.g.: the10 # /sbin/ifconfig -a | grep 10.10 # # name the script based on the subnet, e.g.: the192 /sbin/ifconfig -a | grep 192.168

results of "the192"

--> the192 inet 192.168.1.19 netmask 0xffffff00 broadcast 192.168.1.255 note: hex value of 0xffffff00 is 255.255.255.0

ping to find all IP's using the broadcast

this is often disabled on most routers inside firewalls for security broadcast ping using MacOSX: --> ping -c 3 192.168.1.255 PING 192.168.1.255 (192.168.1.255): 56 data bytes 64 bytes from 192.168.1.9: icmp_seq=0 ttl=64 time=0.100 ms 64 bytes from 192.168.1.204: icmp_seq=0 ttl=64 time=3.829 ms 64 bytes from 192.168.1.11: icmp_seq=0 ttl=64 time=3.928 ms 64 bytes from 192.168.1.4: icmp_seq=0 ttl=64 time=4.038 ms 64 bytes from 192.168.1.9: icmp_seq=1 ttl=64 time=0.266 ms 64 bytes from 192.168.1.11: icmp_seq=1 ttl=64 time=5.112 ms 64 bytes from 192.168.1.204: icmp_seq=1 ttl=64 time=5.132 ms 64 bytes from 192.168.1.4: icmp_seq=1 ttl=64 time=5.226 ms 64 bytes from 192.168.1.9: icmp_seq=2 ttl=64 time=0.083 ms --- 192.168.1.255 ping statistics --- 3 packets transmitted, 3 packets received, +6 duplicates, 0.0% packet loss round-trip min/avg/max/stddev = 0.083/3.079/5.226/2.132 ms
FROM LINUX: --> ping -c 3 192.168.1.255 Do you want to ping broadcast? Then -b ------------------------------------------------ --> ping -b -c 3 192.168.1.255 WARNING: pinging broadcast address PING 192.168.1.255 (192.168.1.255) 56(84) bytes of data. 64 bytes from 192.168.1.204: icmp_seq=1 ttl=64 time=0.845 ms 64 bytes from 192.168.1.19: icmp_seq=1 ttl=64 time=1.05 ms (DUP!) 64 bytes from 192.168.1.2: icmp_seq=1 ttl=64 time=1.57 ms (DUP!) 64 bytes from 192.168.1.7: icmp_seq=1 ttl=64 time=181 ms (DUP!) 64 bytes from 192.168.1.19: icmp_seq=2 ttl=64 time=0.351 ms 64 bytes from 192.168.1.204: icmp_seq=2 ttl=64 time=0.509 ms (DUP!) 64 bytes from 192.168.1.2: icmp_seq=2 ttl=64 time=0.627 ms (DUP!) 64 bytes from 192.168.1.7: icmp_seq=2 ttl=64 time=416 ms (DUP!) 64 bytes from 192.168.1.19: icmp_seq=3 ttl=64 time=0.337 ms --- 192.168.1.255 ping statistics --- 3 packets transmitted, 3 received, +6 duplicates, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 0.337/67.035/416.758/135.853 ms

ebook:
Full Size
Jeep Buyer's
Guide
ebook:
Practical Suggestions
for Microsoft
Windows
Linux Tackles Microsoft
12 hour Video Course by john:
The Art of Linux System Administration
published by O'Reilly Media
Study Guide for the LPIC-2 Certification Exams
search for:
on the internet, or:
JohnMeister.com-fotos
LinuxMeister-Linux
BibleTech-
Bible overview


An overview of Biblical history:
"Promises and Prophets"

Wagoneers

FULL SIZE JEEPS

JeepMeister
"Jeep is America's
only real sports car."
-Enzo Ferrari


MeisterTech
Diesels +

One Page Overview of Linux Commands

click for an image of the 5 essential Linux commands

An Intro to Linux
AMSOIL product guide,
or, AMSOIL web, or 1-800-956-5695,
use customer #283461

Amsoil dealer since 1983
purchase AMSOIL
at Midway Auto on SR9 in Snohomish,
or at Northland Diesel in Bellingham, WA


SJ - 1962-1991

XJ - 1984-2001

WJ - 1999-2004

KJ - 2002-2007

WK - 2005-2010

Find the recommended
AMSOIL synthetics
for your Jeep

CJ-10A - 1984-1986

Jeepsters

MJ - 1984-1992

Willys - 1946-1965

Other Jeeps (FC)