Get quick control over your Linux server with server commands



Similar documents
Hands On Activities: TCP/IP Network Monitoring and Management

Homework 3 TCP/IP Network Monitoring and Management

LAB THREE STATIC ROUTING

Red Hat Linux Networking

Network Management and Debugging. Jing Zhou

BASIC TCP/IP NETWORKING

Scalable Linux Clusters with LVS

It should be noted that the installer will delete any existing partitions on your disk in order to install the software required to use BLËSK.

ITIS 2110 Lab 11: Domain Name Server. Tyler Everhart 11/12/2010

INUVIKA OVD VIRTUAL DESKTOP ENTERPRISE

Workshop on Scientific Applications for the Internet of Things (IoT) March

Domain 5.0: Network Tools

Introduction to Operating Systems

ICS 351: Today's plan

LOCKSS on LINUX. CentOS6 Installation Manual 08/22/2013

LOCKSS on LINUX. Network Data Transition 02/17/2011

DNS Resolving using nslookup

DHCP and DNS Protocols

Host Configuration (Linux)

LOCKSS on LINUX. Installation Manual and the OpenBSD Transition 02/17/2011

Chapter 6. About This Chapter. Before You Begin. Windows 2000 Naming Schemes. [Previous] [Next]

How To Set Up A Network Map In Linux On A Ubuntu 2.5 (Amd64) On A Raspberry Mobi) On An Ubuntu (Amd66) On Ubuntu 4.5 On A Windows Box

6.0. Getting Started Guide

Lab 5 Explicit Proxy Performance, Load Balancing & Redundancy

CYAN SECURE WEB APPLIANCE. User interface manual

How-to: DNS Enumeration

PasserellesNumeriquesCambodia (PNC)

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering

Procedure: You can find the problem sheet on Drive D: of the lab PCs. 1. IP address for this host computer 2. Subnet mask 3. Default gateway address

RedHat (RHEL) System Administration Course Summary

Network Administration and Monitoring

HOST AUTO CONFIGURATION (BOOTP, DHCP)

Implementing, Managing, and Maintaining a Microsoft Windows Server 2003 Network Infrastructure

1.0 Basic Principles of TCP/IP Network Communications

GL254 - RED HAT ENTERPRISE LINUX SYSTEMS ADMINISTRATION III

SO114 - Solaris 10 OE Network Administration

Instructor Notes for Lab 3

Red Hat Linux Administration II Installation, Configuration, Software and Troubleshooting

Note: This case study utilizes Packet Tracer. Please see the Chapter 5 Packet Tracer file located in Supplemental Materials.

Linux TCP/IP Network Management

Unix System Administration

.Trustwave.com Updated October 9, Secure Web Gateway Version 11.0 Setup Guide

TECHNICAL NOTE. Technical Note P/N REV 03. EMC NetWorker Simplifying firewall port requirements with NSR tunnel Release 8.

How to Enable Internet for Guest Virtual Machine using Wi-Fi wireless Internet Connection.

System administration basics

IP network tools & troubleshooting. AFCHIX 2010 Nairobi, Kenya October 2010

Local DNS Attack Lab. 1 Lab Overview. 2 Lab Environment. SEED Labs Local DNS Attack Lab 1

TCP/IP Network Essentials. Linux System Administration and IP Services

netkit lab single-host Università degli Studi Roma Tre Dipartimento di Informatica e Automazione Computer Networks Research Group

Command Line Interface User Guide for Intel Server Management Software

Introduction to Network Security Lab 1 - Wireshark

Laboratory guide nº 2

WINDOWS PROCESSES AND SERVICES

20 Command Line Tools to Monitor Linux Performance

Virtual Appliance Setup Guide

Lab 1: Introduction to the network lab

Scalable Linux Clusters with LVS

Acronis Backup & Recovery 11.5 Quick Start Guide

Veritas Cluster Server

Dynamic Host Configuration Protocol (DHCP) 02 NAT and DHCP Tópicos Avançados de Redes

Lab 2. CS-335a. Fall 2012 Computer Science Department. Manolis Surligas

Remote Unix Lab Environment (RULE)

Using Symantec NetBackup with Symantec Security Information Manager 4.5

CA Nimsoft Monitor. Probe Guide for Apache HTTP Server Monitoring. apache v1.5 series

Trend Micro Incorporated reserves the right to make changes to this document and to the products described herein without notice.

Firewalls with IPTables. Jason Healy, Director of Networks and Systems

Wireshark DNS. Introduction. nslookup

SUSE Manager in the Public Cloud. SUSE Manager Server in the Public Cloud

NovaBACKUP Storage Server User Manual NovaStor / April 2013

Understanding Task Scheduler FIGURE Task Scheduler. The error reporting screen.

Red Hat System Administration 1(RH124) is Designed for IT Professionals who are new to Linux.

TEIN2 Measurement and Monitoring Workshop.

ACS 5.x and later: Integration with Microsoft Active Directory Configuration Example

Quick Installation Guide

What communication protocols are used to discover Tesira servers on a network?

A virtual network laboratory for learning IP networking

EMC Data Domain Management Center

TELE 301 Network Management

Intel Entry Storage System SS4200-E Active Directory Implementation and Troubleshooting

embeo Getting Started and Samples

Chapter 8 Monitoring and Logging

Canopy Wireless Broadband Platform

HP Intelligent Management Center v7.1 Virtualization Monitor Administrator Guide

Work No. 1 Samba. What is Samba?

Configuring the Edgewater 4550 for use with the Bluestone Hosted PBX

Troubleshooting This document outlines some of the potential issues which you may encouter while administering an atech Telecoms installation.

Internet Filtering Appliance. User s Guide VERSION 1.2

Create a virtual machine at your assigned virtual server. Use the following specs

VM-Series Firewall Deployment Tech Note PAN-OS 5.0

Configuring the Content Routing Software

1 Basic Configuration of Cisco 2600 Router. Basic Configuration Cisco 2600 Router

Packet filtering with Linux

Comodo MyDLP Software Version 2.0. Installation Guide Guide Version Comodo Security Solutions 1255 Broad Street Clifton, NJ 07013

System Admin Module User Guide. Schmooze Com Inc.

Debugging Network Communications. 1 Check the Network Cabling

Configure NFS Staging for ACS 5.x Backup on Windows and Linux

NETWORK SETUP GLOSSARY

SIOS Protection Suite for Linux v Postfix Recovery Kit Administration Guide

How to Configure the Windows DNS Server

Computer Networks I Laboratory Exercise 1

Transcription:

Get quick control over your Linux server with server commands by Jack Wallen Linux is a powerful environment for both the desktop and server: Both systems have matured so any action can be managed with a simple point and click. Often, however, it is necessary or preferable to administer a Linux server with only commands. Enter the Linux server command primer. Below you'll find summarizations for some of the most useful commands. You should have familiarity with the terms before examining the man pages. arp Arp manipulates the kernel's ARP cache. The primary options are clearing an address mapping entry and manually setting up one. For debugging purposes, arp also allows a complete dump of the ARP cache. arp [-evn] [-H type] [-i if] -a [hostname] arp [-v] [-i if] -d hostname [pub] arp [-v] [-H type] [-i if] -s hostname hw_addr [temp] arp [-v] [-H type] [-i if] -s hostname hw_addr [netmask nm] pub arp [-v] [-H type] [-i if] -Ds hostname ifa [netmask nm] pub arp [-vnd] [-H type] [-i if] -f [filename] In all instances where a hostname is expected, one can also enter an IP address in dotted-decimal notation. As a special case for compatibility, the order of the hostname and the hardware address can be exchanged. Each complete entry in the ARP cache will be marked with the C flag. Permanent entries are marked with M and published entries have the P flag. df The df command is useful to display filesystem information. This command is the fastest way to keep track of hard disk drive space on a machine. df [ -F FSType ] [-a [-b] [-e] [-g] [-k] [-l] [-n] [-t] [-V ] [ -o FSTypespecific_options ] [block_device directory file resource... ] [-P] The most common use of the df command is df -h, which renders output in human-readable format. du The display usage command is helpful in identifying the size of files and/or programs within directories. Although rudimentary, this is a very good way to keep track of security on a system as there are certain programs and files that should never change size. du [-a] [-k] [-s] [-d] [-L] [-o] [-r] [-x] directories

The most common usage of the du command, under a specific directory, is du -a. (NOTE: You should not run this command from the root (/) directory, as it will display size for every file on the entire Linux hard disk drive.) find The find command helps find locations of files and directories quickly across the entire filesystem. This command is best used as the root user, when in admin mode. One of the most powerful aspects of this command is its ability to accept regular expressions. Since all options of find always return true, it is best to place the options at the beginning of the expression. find [path...] [expression] The most common use of the find command would be: find / -name appname -type d -xdev where appname is the name of the file or application to be searched for. There are other commands that can take the place of find, such as locate or slocate. ifconfig The ifconfig tool is the best way to configure network interfaces on a server. This is especially necessary when dealing with a server with no GUI installed. ifconfig [-L] [-m] interface [create] [address_family] [address[/prefixlength] [dest_address]] [parameters] ifconfig interface destroy ifconfig -a [-L] [-d] [-m] [-u] [address_family] ifconfig -l [-d] [-u] [address_family] ifconfig [-L] [-d] [-m] [-u] [-C] If you run the ifconfig command without an option, the command will return to you the details of the configured network interfaces on the server. This lets you check that your network hardware is working properly. Of course, ifconfig is not just about offering up information. The ifconfig command, as the name would imply, allows you to configure the network interface from the command line. For example, to set up basic information for a network card, ifconfig would be run (as root) as such: ifconfig eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255 up Where 192.168.0.1 is the IP address of your machine, 255.255.255.0 is the network mask (which decides the potential size of your network), the number 192.168.0.255 is the broadcast address, and the up keyword loads the module related to the Ethernet card into the kernel and makes it ready to receive and send data.

Ifup/ifdown/ifstatus I ve put these commands together because their usage is so similar. These commands either bring a network interface up, down, or give the status of said interface. It's quite useful when having to stop and start a network on a machine. ifup/ifdown/ifstatus interface where interface is the name of the network device, such as eth0. init Although not as obvious as some commands, init will allow you to change a server to a different runlevel. Let's say, for example, you decide to install your server along with the GUI (to make network configuration easier). But, at some point, you decide you do not want to load the GUI at boot. To do this, init will be your friend. init [ -a ] [ -s ] [ -b ] [ -z xxx ] [ 0123456Ss ] If your server boots into GUI mode, it is in runlevel 5. To change the runlevel to 3 (text-only) run the command: init 3. This, of course, is not a permanent change. To make the change permanently, you have to change the /etc/inittab file. Open up that file (as root) and look for the line: id:5:initdefault: and change it to: id:3:initdefault: Now your server will only boot into text-based mode. netstat The netstat command gives a summary of network connections and status of sockets on a server. When viewing the netstat readout, the top few lines are going to be the most helpful for server administration. netstat [-veennccf] [] -r netstat {-V --version -h --help} netstat [-vnncaeol] [...] netstat { [-veennac] -i [-cnne] -M -s } [delay] The most common uses of netstat include netstat (with no options) and netstat head (or netstat -r). The -r option offers a look at the network routing addresses. nslookup The nslookup command checks the domain name and IP information of a server. Where this command will come in most handy is if you suspect server intrusion. Take a look at the server logs and run the nslookup to gain DNS information on possible intruders. Nslookup has two modes: interactive and non-

interactive. Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. Non-interactive mode is used to print just the name and requested information for a host or domain. Interactive mode is entered when either no arguments are given (the default name server will be used) or when the first argument is a hyphen (-) and the second argument is the host name or Internet address of a name server. nslookup [ - option ]... host [ server ] The most common use of nslookup is nslookup www.hostname.com ping The tried-and-true ping command simply sends test packets to a specified server to check if it is responding properly. This is an extremely useful command for testing network connectivity and response time of servers. Ping creates a series of test packets that are bounced to the server and back indicating if a server (or interface) is operating correctly. ping -s [-d] [-l] [-L] [-n] [-r] [-R] [-v] [ -i interface_address ] [-I interval] [-t ttl] host [packetsize] [count] The most common use of ping is ping address (where address is either a FQDN or IP address.) Ping is the first line of testing if a network failure occurs. If ping returns information indicating that your network is live, then there is another issue. If, say for example, you are able to ping www.yahoo.com but can not ping your mail server, your mail server is having issues. ps The ps command lists all existing processes on the server. This is helpful because it will let you know if Apache is running on your Web server. If you can't hit your Web server, but you know the machine is up and connected properly, running ps will let you know if Apache is, in fact, running. One problem, however, is that often you will have more processes than will fit on a screen. To overcome this issue, pipe ps to the more command with the character: ps more With this in place, you will be able to see the output one screen at a time. ps [-a] [-A] [-c] [-d] [-e] [-f] [-j] [-l] [-L] [-P] [-y] [ -g grplist ] [ -n namelist ] [-o format ] [ -p proclist ] [ -s sidlist ] [ -t term] [ -u uidlist ] [ -U uidlist ] [ -G gidlist ] Most common uses: ps and also ps -f more The f switch is most handy because it causes ps to generate a full listing of information.

route The route command lists the routing tables for your server. The route command is identical to netstat -r so it's just a matter of preference which you run. Of course, with the route command, you can use the add or del options to modify a routing table manually. Most common use: route -v This is essentially the exact same output as the command netstat -r. shred Although not directly related to configuring a network or a server, there are times when it would be necessary to obviate files on a server. This would most likely be used on confidential information that had to be deleted (customer information for example). To do this, shred deletes a file securely (and completely) by overwriting its contents. The results of using shred on a file is that the file deleted will never be retrieved again. shred [OPTIONS] FILE [...] The most common use of shred is shred -v filename (Where filename is the name of a specific file.) The -v (verbose) option is useful since it provides extra view of what exactly the shred tool is doing while you wait. (NOTE: With large files, shred can take quite a long time.) top The top command displays system statistics and details regarding active processes. Top is a command that, when run, keeps an open window of processes-and the resources they use-continually updating. This command is very convenient when trying to solve a runaway process that s eating up precious memory. When used in conjunction with ps, top is an administrator s best friend. top [-] [d delay] [p pid] [q] [c] [C] [S] [s] [i] [n iter] [b] The most common use of the top command is simply: top traceroute The traceroute command traces the existing network routing for a remote or local server. Probably one of the most powerful commands in the net admin toolkit, traceroute gives the exact information about the route between the machine you are on and the server you are trying to reach. This tool is quite helpful when trying to trace down a network slowdown. By running traceroute, you can view the route the trace takes one hop at a time. As each hop goes by, you are given information not only on server name, but time taken between hops. This alone can help determine network outages or slowdowns. traceroute [-d] [-F] [-I] [-n] [-v] [-x] [-f first_ttl] [-g gateway [-g gateway] -r] [-i iface] [-m max_ttl] [-p port] [-q nqueries] [-s src_addr] [-t tos] [-w waittime ] host [packetlen]

The most common use of the traceroute command is: traceroute hostname (where hostname is the name of the server you are trying to reach.) w The w command offers details of all users currently on the server and what processes they are running. The difference between w and who is that w displays the process the user is running. w [options] [user] The most common use of the w command is without option or argument. All that and more Although mostly basic, this toolkit of Linux commands will get you started administering Linux servers. Each of these commands can be researched more intensely with their man pages (enter the command man followed by the command name. For example, man netstat will give you the manual page on the netstat command. Of course, being a Linux network administrator is more than just having a toolkit of commands at hand. You must understand networking and network security on a fundamental level; you ll also need to learn about server applications, such as Apache and Sendmail. But, knowing the basics, you re at a good starting point.