OpenVZ Forum


Home » General » Support » Network diagnostics script
Network diagnostics script [message #6358] Thu, 14 September 2006 19:52 Go to next message
John Kelly is currently offline  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

Re: Network diagnostics script [message #6443 is a reply to message #6358] Mon, 18 September 2006 07:47 Go to previous message
Vasily Tarasov is currently offline  Vasily Tarasov
Messages: 1345
Registered: January 2006
Senior Member
Hello,

It would be cool, if you'll write an article at wiki.openvz.org about this script and problem you've solved using it.

Great thanks!
Previous Topic: *SOLVED* Cant login to VE via SSH
Next Topic: Huge image
Goto Forum:
  


Current Time: Tue May 21 20:08:13 GMT 2024

Total time taken to generate the page: 0.01617 seconds