[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 110: Undefined array key "cached"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 111: Undefined array key "normal"
[phpBB Debug] PHP Notice: in file /includes/db/dbal.php on line 112: Undefined array key "total"
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 885: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3391: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3393: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3394: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3395: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2922)
Cabrillo College Linux Classes • View topic - script to aggregate network configs

script to aggregate network configs

UNIX/Linux Network Administration

script to aggregate network configs

Postby Greg Earthman on Tue May 26, 2009 2:11 pm

Here is another q&d script (see post on "screams for scripting" for definition of q&d) that helps me when working with the netowrk configs.
This one basically writes all the various configs in one stdout rather than having to cat or vi each config individually. It also has route -n and ifconfig included to help as well.
basically when you run it, pipe it to less so that you can scroll back and forth through it to examine the configs, and I have saved much time troubleshooting with the output in one place. For me it is easier to spot mistakes in the address configs this way.
Once agaiin in the q&d tradition, there is no error checking, so some of the output may produce blank lines or error messages form the system if for instance one of the files being examined does not exist...


#!/bin/bash
echo "Default Gateway Check"
echo
cat /etc/sysconfig/network
echo
echo "DNS setup check"
echo
cat /etc/resolv.conf
echo
echo "static eth0 check"
echo
cat /etc/sysconfig/network-scripts/ifcfg-eth0
echo
echo "static eth1 check"
echo
cat /etc/sysconfig/network-scripts/ifcfg-eth1
echo
echo "static eth2 check"
echo
cat /etc/sysconfig/network-scripts/ifcfg-eth2
echo
echo "check perm route forwarding"
echo
cat /etc/sysctl.conf | grep ip_forward
echo
echo "Routing Table"
echo
route -n
echo
echo "ifconfig output"
ifconfig
echo

I named it cfg_chk.sh so to run it it is ./cfg_chk | less or you can redirect to a file and then less the file for similar results, so you will have a copy of config to use in a before and after scenario
Greg Earthman
 
Posts: 21
Joined: Tue Nov 04, 2008 9:34 pm

Re: script to aggregate network configs

Postby Rich Simms on Tue May 26, 2009 11:57 pm

Nice! - Rich
User avatar
Rich Simms
Site Admin
 
Posts: 640
Joined: Thu May 15, 2008 2:44 pm


Return to CIS 192 - Spring 2009

Who is online

Users browsing this forum: No registered users and 0 guests

cron