Posts

Basic Linux Networking Tools

Image
Verify Network Connection Most people, who have been around redhat linux for a while, know how to check the IP address, and MAC address using ifconfig. Next, they would typically use route -n (or netstat -r) to find the gateway, and then ping it to verify a connection. Then maybe check duplex and speed using ethtool. Check the IP Address # ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:15:17:C1:54:D4 inet addr:10.10.5.67 Bcast:10.10.5.255 Mask:255.255.255.0 inet6 addr: fe80::215:17ff:fec1:54d4/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:342967 errors:0 dropped:0 overruns:0 frame:0 TX packets:353260 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:64963573 (61.9 MiB) TX bytes:262444897 (250.2 MiB) Memory:b8820000-b8840000 Discover the Gateway Address Then, it is common to check the default route with route -n, or netstat -nr. # route -n Kernel...

bash loops

Image
Simple ways to loop in bash shell scripts, or one-liners. Note that the variable in bash is declared without a "$", and called with it, but in perl the variable is declared with and called with a "$" at the beginning of the name. The Bash "for" Loop Loop a number of times for i in {1..10}; do echo -n "$i ";done;echo Output: 1 2 3 4 5 6 7 8 9 10 For short lists, the items can be entered manually. for num in 1 2 3;do echo -n $num;done;echo Output: 1 2 3 Loop Through Items on a List for host in `cat all.txt `;do ping -c 1 $host; done See also: How to Run a Bash Command on All Items in a List and: Ping Multiple Hosts Using Bash Nmap and Fping Loop using Perl This syntax should be familiar to C programmers. In Perl. the scalar variable does not have to be declared as it would in C (int $counter). Note that the variable name starts with "$" to indicate a scalar. #!/usr/bin/perl for($counter = 1; $counter <= 10; $counter++){ print ...

Yum Repositories for RHEL 5

Image
Sometimes we need a RHEL5 Repository that includes software not released by Redhat. It may be that we need a newer version, or simply something that was not included in our installation, and is not part of the standard redhat repositories. Missing RPM Have you ever tried to install something with yum, only to find that the package is not available? $sudo yum -y install vlc Password: Server | 1.3 kB 00:00 Updates | 951 B 00:00 Workstation | 1.1 kB 00:00 addons | 951 B 00:00 base | 2.1 kB 00:00 extras | 2.1 kB 00:00 update | 1.9 kB 00:00 Excluding Packages in global exclude list Finished...

Cisco CCNA Exam Notes - Network Simulator

Image
When studying for a Cisco certification such as CCNA, CCNP, CCIP, or CCIE, there is nothing like having real routers and switches to play with, but it can get expensive to build a lab to study with. There is an excellent simulator that is free, but the users must supply their own Cisco IOS software. Once it is set up, the simulated routers, switches, and firewalls act as if they were real hardware. That gives the user flexibility to play with the real Cisco IOS from command prompts on the simulated hardware. What is GNS3? GNS3 is a graphical network simulator that allows you to design complex network topologies. You may run simulations or configure devices ranging from simple workstations to powerful Cisco routers. It is based on Dynamips, an IOS emulator which allows users to run IOS binary images from Cisco Systems and Pemu, a PIXOS emulator to emulate PIX firewalls. Where Can I Download GNS3? http://www.gns3.net How To Configure GNS3 This installation assumes you have a cisco rout...

Data Recovery: 5 Things You Must Know

Image
Hard drive data recovery is one of the most difficult tasks a sysadmin can attempt to perform, so it should be considered a last resort that, after many frustrating hours, may not even work at all. Data Recovery or Disaster Recovery can be thought of in several categories, and it is important to have a plan in place, and know the options before resorting to one of your local hard disk data recovery services. Many people fail to consider the value of their data until it is too late. This article discusses general principles, with some specific examples from experience with Novel, Microsoft, and Linux operating systems. Detailed tool discussions will be reserved for separate posts. Here is a short list of categories, roughly in order of increasing level of difficulty to recover. Backups and off-site storage RAID Documents File Systems Data Recovery from Hard Drives There is software available that can recover from several types of failures, but it does not always work when ther...

nagios-config-build Released

Image
I wrote some shell scripts to generate Nagios configuration files, and I finally decided to publish them on Freshmeat . The initial version is crude, and has some hard-coded information, but it is still better than trying to edit the .cfg files by hand. Here is a brief description nagios-config-build is a group of shell scripts that generate Nagios configuration files from a list of hostnames. It automatically resolves IP addresses from DNS, and provides a quick way to manage a large number of hosts without having to set up a complicated system. Nagios is more than just a server monitoring tool. From the Nagios website: " Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes." Systemnotes.org download: http://www.systemnotes.org/download/shell/nagios-config-build.html Freshmeat project: http://freshmeat.net/projects/nagios-config-build Please feel free to use thi...

How to Record and Play in Vim

Image
Have you ever been in the middle of editing something in vim, and noticed "recording" on the lower left of the screen? If you were in a hurry, you probably just continued typing, and thought, maybe I'll use that feature some day, but as long as it lets me continue I won't worry about it. Well it's really quite simple to use once you know the sequence. Here is a high level overview on how to use the macro recording feature of vim. High Level Steps to Record and Play a Macro in Vim 1. Press q to Start recording, followed by a lower case character to name the macro. 2. Perform any typical editing, actions inside Vim editor, which will be recorded. 3. Stop recording by pressing q. 4. Play the recorded macro by pressing @ followed by the macro name. 5. To repeat a macro multiple times, press : n @ macro name, where n is a number. For more details, check out a complete tutorial at thegeekstuff.com: Vim Macro Tutorial: How To Record and Play