Skip to main content

Posts

Showing posts from September, 2011

How to send email from the Linux command line

MAIL First run a quick test to make sure the “sendmail” application is installed and working correctly. Execute the following command, replacing “you@youremailid.com” with your e-mail address. # mail -s “Hello ” you@youremailid.com Hit the return key and you will come to a new line. Enter the text “This is a test from my server”. Follow up the text by hitting the return key again. Then hit the key combination of Control+D to continue. The command prompt will ask you if you want to mark a copy of the mail to any other address, hit Control+D again. Check your mailbox. This command will send out a mail to the email id mentioned with the subject, “Hello”. # echo “This will go into the body of the mail.” mail -s “Hello ” you@youremailid.com And if you want mail to read the content from a file: # mail -s “Hello ” you@youremailid.com < /home/user/application.log Some other useful options in the mail command are: -s subject (The subject of the ...

iSCSI initiator configuration in RedHat Enterprise Linux 5

[root@rhel5 ~]# rpm -ivh /tmp/iscsi-initiator-utils-6.2.0.871-0.16.el5.x86_64.rpm Preparing... ########################################### [100%] 1:iscsi-initiator-utils ########################################### [100%] [root@rhel5 ~]# [root@rhel5 ~]#rpm -qa | grep iscsi iscsi-initiator-utils-6.2.0.871-0.16.el5 [root@rhel5 ~]# rpm -qi iscsi-initiator-utils-6.2.0.871-0.16.el5 Name : iscsi-initiator-utils Relocations: (not relocatable) Version : 6.2.0.871 Vendor: Red Hat, Inc. Release : 0.16.el5 Build Date: Tue 09 Mar 2010 09:16:29 PM CET Install Date: Wed 16 Feb 2011 11:34:03 AM CET Build Host: x86-005.build.bos.redhat.com Group : System Environment/Daemons Source RPM: iscsi-initiator-utils-6.2.0.871-0.16.el5.src.rpm Size : 1960412 License: GPL Signature : DSA/SHA1, Wed 10 Mar 2010 04:26:37 PM CET, Key ID 5326810137017186 Packager : Red Hat, Inc. <h...

Configure a New Global Catalog

To configure a Windows 2000/2003 Domain Controller as a GC server, perform the following steps: Start the Microsoft Management Console (MMC) Active Directory Sites and Services Manager. (From the Start menu, select Programs, Administrative Tools, Active Directory Sites and Services Manager). Select the Sites branch. Select the site that owns the server, and expand the Servers branch. Select the server you want to configure. Right-click NTDS Settings, and select Properties. Select or clear the Global Catalog Server checkbox, which the Screen shows. Click Apply, OK. You must allow for the GC to replicate itself throughout the forest. This process might take anywhere between 10-15 minutes to even several days, all depending on your AD infrastructure.

Microsoft Hyper-V will not boot virtual SCSI devices

"Each IDE controller can have two devices. You can not boot from a SCSI controller. This means an IDE disk will be required. The boot disk will be IDE controller 0 Device 0. If you want a CDROM it will consume an IDE device slot." Source: MSDN Blog The hypervisor that runs the virtual BIOS does not support booting from a SCSI controller, today, but it does support the following boot devices: CD IDE Legacy Network Adapter Floppy The root reason is SCSI in a synthetic device and there is no VMBUS until after boot. One might think that this shouldn't be a problem, after all, the virtual machines can still boot from regular IDE-based virtual disks. So where's the catch? The main problem is related to the fact that in Virtual Server, virtual SCSI controllers have major performance benefits over virtual IDE controllers. In Virtual Server, it is recommended to attach the Virtual Disks to one or more SCSI controllers to improve disk input/output (I/O) per...

Rename Windows Server 2008 Domain Controllers

The command In order to rename a DC you will need the NETDOM command. In Windows Server 2008, this is part of the operating system, and not a separate download as in previous versions. By using the NETDOM command, you ensure that there is little or no disturbance for the domain and client operations. Renaming a domain controller requires that you first provide a FQDN as a new computer name for the domain controller. All of the computer accounts for the domain controller must contain the updated SPN attribute and all the authoritative DNS servers for the domain name must contain the host (A) resource record for the new computer name. Both the old and new computer names are maintained until you remove the old computer name. This ensures that there will be no interruption in the ability of clients to locate or authenticate to the renamed domain controller, except when the domain controller is restarted. Important : To rename a domain controller using the NETDOM command, the domain ...

Installing the Virtual SCSI Controller Driver for Virtual Server 2005 on Windows Server 2008

You can install the virtual SCSI controller driver during the installation of the guest operating system by performing the following steps: Description and screenshots where made while installing Windows Server 2008 on Virtual Server 2005 R2 SP1, however the same instructions apply to the installation of Windows Vista. For Windows 2000/2003/XP you will need to press the F6 key during the text phase of the installation process, then press "S" to specify additional drivers, and then provide the driver floppy image. 1. Begin the installation by inserting the appropriate Windows Server 2008 installation media into your DVD drive. 2. Continue with the installation process, until you reach the point where you're prompted for the location of the system partition. Click on the Load Driver link. 3. Now you need to load the driver files as a virtual floppy image. The image's name is "SCSI Shunt Driver.vfd", and it is located in the C:\Program Files\Micros...

Windows 2003 Domain Rename

This functionality is not available in Microsoft Windows 2000 Server family.  Microsoft Windows Server 2003 family provides the capability to rename domains in an Active Directory forest after the forest structure is in place. The structure of an Active Directory forest is the result of the order in which you create domains and the hierarchical names of those domains. Beginning with the forest root domain, all child domains derive their distinguished names and default DNS names from the forest root domain name. The same is true of every additional tree in the forest. The way to change the hierarchical structure of an existing domain tree is to rename the domains. For example, you can rename a child domain to have a different parent, or rename a child domain to be a new tree-root domain. In each case, you reposition an existing domain to create a different domain-tree structure. Alternatively, you can rename domains without affecting the structure. For example, if you ...

Setting Virtual Machine Boot Options in Windows 2008 Hyper-V

One of the problems with server virtualization is that when you virtualize your servers, you are essentially putting all of your eggs into one basket. Imagine for instance that a physical server that is hosting a number of virtual machines drops offline for whatever reason. None of the virtual machines hosted by that server will be available until the host operating system is rebooted, and all of the virtual servers are booted. Fortunately, there are some things that you can make the process of bringing everything back online a lot less painful. Automatic Start Action Even if your host operating system isn’t normally prone to failure, it’s worth taking a look at Hyper-V’s automatic startup options for virtual machines. It’s inevitable that you will eventually have to reboot your host operating system as a part of the match management process. When those reboots do occur, it’s nice not to have to manually boot every single virtual machine that’s hosted by that server individually. ...

How to Restore Windows Server 2003 Active Directory

There is an option to restore Active Directory objects that have been deleted and are now in a phase called "tombstone". You can use one of the three methods to restore Active Directory from backup media: Primary Restore, Normal Restore (i.e. Non Authoritative), and Authoritative Restore. Primary Restore: This method rebuilds the first domain controller in a domain when there is no other way to rebuild the domain. Perform a primary restore only when all the domain controllers in the domain are lost, and you want to rebuild the domain from the backup. Members of the Administrators group can perform the primary restore on local computer. On a domain controller, only members of the Domain Admins group can perform this restore. Normal Restore: This method reinstates the Active Directory data to the state before the backup, and then updates the data through the normal replication process. Perform a normal restore for a single domain controller to a previously kno...

Expanding the Boot Volume of a Windows Server 2008 Virtual Machine

Expanding the Boot Volume To demonstrate how this works, I installed Windows Server 2008 as a virtual machine inside VMware ESXi 4.0. During the creation of the VM the boot partition size was set at 20 GB, which in Windows Server 2008 might just be a bit to small. To expand it, we need to expand the virtual disk first. This is a simple process, all it needs is a couple of mouse clicks and you're set. In the vSphere Client, right click the virtual machine and select Edit Settings Next, you need to find the virtual disk and edit it's size from 20 GB to 30 GB, or any other size you might want, click OK and let it weave it's magic. The disk should now be expanded, but Windows Server 2008 still doesn't recognize the new available space. This is where the Disk Manager enters the picture. Navigate the Start Menu and find Server Manager. Find the Storage node, expand it and select Disk Management Right click Disk Management and use either Refresh o...

Configuring Virtual Networks With Hyper-V

The Virtual Switch What really sets Hyper-V apart from Microsoft’s other virtualization products is that virtual machines perform much better because they can communicate with the server’s hardware directly rather than having to pass hardware requests through the host operating system (although there are some exceptions to this). Of course you can’t just bombard a network adapter with simultaneous traffic from multiple virtual machines. There has to be a way of managing the traffic. To get around this problem, Microsoft has introduced the concept of the virtual switch. To understand how this is possible, you have to realize that Hyper-V is not a Windows Server 2008 add-on, but rather is a part of the operating system. When you install the Hyper-V role, the hyper visor is placed “underneath” the Windows 2008 operating system. The existing operating system (known as the host operating system) is placed into something called the parent partition, and each guest operating sys...

Creating and Managing Virtual Servers with Windows 2008 Server & Hyper-V

Installing a Virtual Operating System Open Server Manager and then navigate through the console tree to Roles -> Hyper-V -> Microsoft Hyper-V Server. If this is the first time that you have used Hyper-V, then you will be prompted to accept Hyper-V License Agreement. Once you accept the license agreement, the various Hyper-V options will be made available to you. The first thing that you must do is to click on the Connect to Server link, located in the Actions pane. When you do, you will be prompted to select the computer that you want to connect to. Choose the Local Computer option, and click OK. You will now see the screen shown in Figure A. This is the main screen that you will use for managing virtual machines. Creating a New Virtual Server To create a new virtual server, click the New -> Virtual Machine options found in the Actions pane. When you do, Windows will launch the New Virtual Machine Wizard. The wizard’s initial screen explai...

Implementing Hyper-V in Windows Server 2008

Perform a Clean Installation The first thing that I recommend doing is to perform a clean installation of Windows Server 2008. Server virtualization is extremely resource intensive, far more so than most other server applications, so I recommend using a clean Windows installation on a dedicated server. Installing the Hyper-V Role Now, log in using an account with local administrative privileges, and then open the Server manager. In case you aren’t familiar with the Server Manager, it’s the new tool that acts as a centralized management utility for Windows Server 2008. You can access it by entering the ServerManager.msc command at the server’s Run prompt. When Server Manager opens, right click on the Roles container, and then choose the Add Roles command from the resulting shortcut menu. Windows will now launch the Add Roles Wizard. Click Next to bypass the wizard’s Welcome screen and then you should see a screen similar to the one shown in Figure A, asking you which roles y...

How to use the OSI Model to Troubleshoot Networks

Is your network cable plugged in? (physical) Is there a link light on the Ethernet switch and Ethernet NIC? (data-link) Do you have an IP address? (network) Can you ping your default gateway? (network, testing LAN IP connectivity) Do you have DNS server information? Can you ping your DNS server? (network, testing IP connectivity) Do you have a firewall configured? (network on up to application) Can you ping the host you are trying to get to by name? (application, DNS and network WAN IP connectivity) What format is the graphic in? Do you have a viewer for that format? (presentation) Can your web browser open up another website? (basic application troubleshooting) It may turn out that the graphic they were trying to bring up was a .TIFF file and they didn’t have a decoder for that type of file. Thus, this would have been a presentation error issue as the presentation layer deals with formats of graphics & files, as well as compression and encryption. ...

How to Mount a Windows NTFS file system partition in Linux:

Open a terminal and type sudo su Type fdisk -l (note which partition contains the NTFS file system) Type mkdir /media/windows (This directory is where we will access the partition) Type mount /dev/hdx1 /media/windows/ -t ntfs -o nls=utf8,umask=0222 Type cd /media/windows (Moves us to the windows directory) Type ls to list the files on the NTFS partition Notes: Alternately, you can navigate to the media/windows directory outside of terminal to view the files. To unmount the Windows NTFS partiton, from the terminal simply type umount /media/windows/

Introduction to the OSI Model

The Open System Interconnection Reference Model (OSI) is a seven layer model that was developed as part of the effort to standardize networking that was started in the late 1970's as part of the Open Systems Interconnection (OSI) initiative. The Seven Layers of the OSI Model The Physical Layer defines the electrical and physical properties and the operating specifications for the devices and media in use. The main job of the Physical Layer is the physical "connection" or attachment of given media and how it is configured (e.g. Token Ring cable, size of cable used, termination in place etc.). In some instances, there may be secondary responsibilities of this layer depending on the device for things such as flow control, modulation/demodulation and so forth. The protocol data unit in use at this level of the OSI model is referred to as a "bit." The Data Link Layer provides the practical means to transfer data between network nodes as its main job is to transfe...

Mount an ISO image under Linux

An ISO image is an archive file (disk image) of an optical disc using a conventional ISO (International Organization for Standardization) format. ISO image files typically have a file extension of .ISO. The name "ISO" is taken from the ISO 9660 file system used with CD-ROM media, but an ISO image can also contain UDF file system because UDF is backward-compatible to ISO 9660. You can mount an ISO images via the loop device under Linux. It is possible to specify transfer functions (for encryption/decryption or other purposes) using loop device. But, how do you mount an ISO image under Linux? You need to use mount command as follows: Procedure to mount ISO images under Linux 1) You must login as a root user, if not root user then switch to root user using following command: $ su - 2) Create the directory i.e. mount point: # mkdir -p /mnt/disk 3) Use mount command as follows to mount iso file called disk1.iso: # mount -o loop disk1.iso /mnt/disk 4) Change dire...

Convert an IP Address from Decimal to Binary Form

The first, and probably most important step, is to put down this row of values: 128 64 32 16 8 4 2 1 In order to remember these values start with the number 1, go from right to left, and double that number seven times. For example, start with 1 on the right side. For your next number, double the 1 (1 x 2 = 2). So, 2 is your next number (remembering to go from right to left). For your third number, double the 2 (2 x 2 = 4); to continue the sequence, double the 4 (4 x 2 = 8). Repeat this process until you’ve doubled your original number, seven times. The key to this is that every single one of the values we put in that row are going to have either number 1 or number 0 assigned to it. To convert the IP address we will take that string of numbers and start from left to right this time. For each value we ask this question: “Can I subtract this value from the decimal remaining?” If the answer is “NO” then you put a “0” under the binary value, and if the answer is “Y...

Configure On-Demand Routing (ODR) on Cisco routers

ODR is used to allow hub routers to accept prefix information, distributed via Cisco Discovery Protocol (CDP) , from spoke routers. On the hub router, enter this command router odr Also, routes can be controlled with a distribute-list: distribute-list 10 in distribute-list 20 out assuming the referenced ACLs exist, otheriwse no routes are accepted or sent. Since the prefix updates are carried on CDP, ODR updates can be controlled, in true sledgehammer fashion, by disabling CDP on an interface:interface serial 0/0 no cdp enable For ODR to work properly, all dynamic routing protocols need to be disabled on the spoke routers.

Windows: Get a List of All Running Processes from the Command Line

If you need to get a quick list of running processes on your computer or another computer on your network, you can use the Windows Instrumentation command-line interface (WMIC) to quickly generate this. You can even generate a text file so you can print the list if need be. This Tech-Recipe applies to Windows XP Professional, Windows Vista, Windows Server 2003 and Windows Server 2008. 1. Open a command prompt. 2. Execute the following command: wmic process get description,executablepath To list the processes on another computer, execute the following command: wmic /node: process get description,executablepath Where computer name is the name of the desired computer. to generate a textfile, execute the following (make sure to change the output path to your liking): Your computer: wmic /output:d:\process.txt process get description,executablepath Another computer: wmic /node: /output:d:\process.txt process get description,executablepath Your results will look somethi...

Configure IGRP routing on a Cisco router

IGRP is a proprietary routing protocol designed by Cisco and can only be used in a homogeneous network of Cisco routers. IGRP is a distance-vector protocol that considers delay, bandwidth and other optional parameters to determine the best path. IGRP uses an autonomous system number parameter in the configuration. All routers with the same autonomous system number will share router advertisements and participate. This number is arbitrary but must be the same on all routers within the autonomous system. To configure a router to participate in IGRP routing within autonomous system 5 and advertise routing information about the 192.168.200.0 network, use: conf t router igrp 5 network 192.168.200.0

Windows: Use WMIC to Start or Stop a Service from the Command Line

By using the Windows Instrumentation command-line interface (WMIC), you can easily start or stop a service without having to use the GUI. Once you become familiar with the steps, it will be much faster than having to access the Services applet in the Administrative Tools. This Tech-Recipe applies to Windows XP Professional, Windows Vista, Windows Server 2003 and Windows Server 2008. 1. Open a command prompt. 2. Input WMIC and press Return. You will see a prompt that looks like this: wmic:root\cli> 3. At the new prompt, execute the following command: service get caption,start,startmode This will generate a list of all available services and their current status. 4. To start a service,go to the prompt and execute the following command: service where caption="" call startservice where service caption is the caption of the service you wish to start (use the exact caption provided by the previously generated list). For example, if I were wanting to start the...

Configure Cisco router as a basic DHCP server

Using a Cisco router as a DHCP server can simplify a network configuration by cetralizing DHCP services in a large network or decentralizing DHCP services to the endpoint routers at satellite locations. The ease of remote management of Cisco-based DHCP services is a great advantage. conf t service dhcp ip dhcp pool 192.168.1.0/24 network 192.168.1.0 255.255.255.0 default-router 192.168.1.1 dns-server 192.168.1.5 192.168.1.6 exit ip dhcp excluded-address 192.168.1.1 192.168.1.199 ip dhcp excluded-address 192.168.1.241 192.168.1.255 ^Z This example shows a Cisco router configuration as a basic DHCP server in the 192.168.1.0/24 network. The DHCP options implemented are default-router (DHCP option 3) and dns-server (DHCP option 6). Two DNS servers are configured. With the excluded-address commands, using only ip addresses between 192.168.1.200-192.168.1.240 will be available for client use.

Windows: Service Managing Through Command Line

How can I start/stop/pause Windows Services from command Line in win-2000,Win-XP & win-2003 To start a service follow the steps: 1. Go to START—->RUN 2. Type CMD—–> Click on Enter 3. Net Start  to Start a Service Eg:-  net start telnet 4. Net Stop  to Stop a Service Eg:-  net stop telnet 5. Net Pause  to Pause a Service Eg:-  net pause telnet 6. Net Continue  to Continue a Service Eg:-  net continue telnet

Cisco HSRP – Redundant gateway router configuration

HSRP stands for Hot Standby Router Protocol, and what it does is create a virtual IP address (which hosts will use as the gateway address). This virtual address is free to move between configured routers as needed. Some background for this config: Local Subnet: 192.168.2.0/24 Desired gateway address: 192.168.2.1 Both routers and their hosts must be on the same layer 2 network. On Router A: ip address 192.168.2.2 255.255.255.0 standby 1 ip 192.168.2.1 standby 1 preempt standby 1 priority 110 standby 1 authentication myrouter standby 1 track serial 0/0 The priority number determines which router will normally have the virtual IP address, higher numbers win. The track statement tells the router to give up the virtual address if the serial 0/0 interface goes down. Router B: ip address 192.168.2.3 255.255.255.0 standby 1 ip 192.168.2.1 standby 1 preempt standby 1 priority 100 standby 1 authentication myrouter standby 1 track serial 0/1 That’s all there is...

HOW TO EDIT THE BCD REGISTRY FILE

The BCD registry file controls which operating system installation starts and how long the boot manager waits before starting Windows. Basically, it’s like the Boot.ini file in earlier versions of Windows. If you need to edit it, the easiest way is to use the Startup And Recovery tool from within Vista. Just follow these steps: 1. Click Start. Right-click Computer, and then click Properties. 2. Click Advanced System Settings. 3. On the Advanced tab, under Startup and Recovery, click Settings. 4. Click the Default Operating System list, and edit other startup settings. Then, click OK. Same as Windows XP, right? But you’re probably not here because you couldn’t find that dialog box. You’re probably here because Windows Vista won’t start. In that case, you shouldn’t even worry about editing the BCD. Just run Startup Repair, and let the tool do what it’s supposed to. If you’re an advanced user, like an IT guy, you might want to edit the BCD file yourself. You can do this...

Virtual Server 2005: How To Configure the Virtual DHCP Server

Instead of configuring a virtual machine as a DHCP server, you can use the virtual DHCP server for your virtual network. To configure the virtual DHCP server: 1. Open the  Virtual Server Administration Website . 2. Under  Virtual Networks , select Configure  and then click the virtual network. 3. In  Virtual Network Properties , click  DHCP server . 4. Check the  Enabled  checkbox, then configure the necessary DHCP server options. 5. Click OK.