Network diagnostics script [message #6358] |
Thu, 14 September 2006 19:52 |
John Kelly
Messages: 97 Registered: May 2006 Location: Palmetto State
|
Member |
|
|
Here's a little time saving script.
I was diagnosing a network problem, and I needed a snapshot of my network configuration on the HN and VE, plus a venet0 tcpdump. I wanted to see the output on the screen, and capture it to a file, too. And I also wanted to use Ctrl-C to make it stop, when I saw enough.
This helped me solve the network problem quickly, though I spent several hours getting the script to work the way I wanted. :-/
Just change VEID and and MYDATA to your liking, and enjoy!
#!/bin/sh
VEID=123
MYDATA=/root/temp/netdata
set -e
mkdir -p ${MYDATA%/*}
{
arp -a; echo ""
route -n; echo ""
vzctl exec $VEID 'route -n; echo ""; ifconfig venet0'
tcpdump -i venet0 -l -n -v &
trap ':' INT
wait $! || :
trap - INT
vzctl exec $VEID 'echo ""; ifconfig venet0'
} \
2>&1 | tee -i $MYDATA
Oops, I almost forgot to say: run this script on the HN, not the VE.
[Updated on: Thu, 14 September 2006 19:57] Report message to a moderator
|
|
|