Linux Network Management Command

Download Report

Transcript Linux Network Management Command

Linux Network Management
Command
(1) Domainname
• Command Name :- domainname
• Purpose:- Displays or sets the name of the current Network
Information Service(NIS) domain
• Syntax:- domainname [DomainName]
•
Example:1. To join a new domain, enter
$ domainname caesar
In this example, the domainname command sets the NIS domain
name to caesar.
Conti..
2. To find out the name of the domain your machine belongs to,
enter:
$ domainname
caesar
(2) Hostname
• Command Name :- hostname
• Purpose:- Specifies the name of the host
• Syntax:- hostname [-a | -d | -f | -h | -i | -s]
-a
-d
-f
-h
-i
-s
Displays the alias name of the host, if used.
Displays DNS domain name
Displays fully qualified domain name.
Displays help message.
Displays IP address of the host.
Trim domain name from display.
Cont..
Example:1. hostname command
hostname
The above command will print as username.com
2. hostname -a
The above command will remove space and print as username
3. To display DNS domain name
hostname –d
The above command will print as .com
(3) Finger
• Command Name :- finger
• Purpose:- finger command displays the user's login name,
real name, terminal name and write status (as a ''*'' after the
terminal name if write permission is denied), idle time, login
time, office location and office phone number..
• Syntax:- finger [-lmsp] [user ...] [user@host ...]
Conti..
- l = Prints all the information described by -s option and also
the user's home directory, home phone number, login shell, mail
status, and the contents of the files ".plan",".project",".pgpkey", and
".forward" from the users home directory.
- m = Match arguments only on user name (not first or last name).
- p = Supress the prinitng format of -l, It will not display the contents
of ".plan",".project", and ".pgkey" files.
-s = Prints the output in short format.
Example:•
To Print the user information in short format:
finger -s hiox
Login
Name
Conti..(output)
Tty
Idle LoginTime
Office OfficePhone HIOX
HIOX INDIA
*:0
Sep 14 09:07 HIOX
HIOX INDIA
*pts/0
9 Sep 14 09:08 HIOX
HIOX INDIA
*pts/1 1:29 Sep 14 09:12
(4) Ifconfig
•
Command Name :- Ifconfig
• Purpose:- ifconfig command displays information about the
network interfaces attached to the system and also used to
configure the network interface.
• Syntax:- ifconfig [options]
• [Option]
• -a =dispalys information about both active and inactive
Interface
• [interface-name] =dispalys information about interface
• [interface-name] up =Activates the interface
• [interface-name] down =Inactivates the interface
• [interface-name] [IP Address] up =Assigns IP address to the
interface and activates it
Conti..
• Example:1. To get information of active network-interfaces:
ifconfig
2. To Assign IP address to Network Interface[Ethernet Card]:
ifconfig eth0 192.168.0.12 up
The above command will Assign IP address 192.168.0.12 to Ethernet
card with name eth0.
3. To inactivate the Network Interface[Ethernet Card]:
ifconfig eth0 down
The above command inactivates the ethernet card.
(5) Netstat
• Command Name :- netstat
• Purpose:- nestat command displays statistics information and
current state of network connections, protocol, ports/ sockets and
devices.
• Syntax:- netstat [options]
•
[option]
-s = dispalys statics information about protocols.
-i = dispalys statistics information about the network interface.
-r = diplays routing table.
-c = displays statistics information and updates every second.
-l = displays information about all sockets that are in listening state.
-a = displays information about all sockets that are in listening and
non-listening state.
-p = displays information about sockets with ProcessName and PID.
• Conti..
• Example:1. To get statistics of network connections:
netstat
2. To Get Statistics of Protocols:
netstat –s
3. To Get statistics of Network Interface:
netstat -i
(6) Ping
• Command Name :- ping
• Purpose :- System administration command. Confirm that a
remote host is online and responding. Ping is used for
verifying connectivity between two hosts on a network. It
sends Internet Control Message Protocol (ICMP) echo request
packets to a remote IP address and watches for ICMP
responses.
• Syntax:- ping [options] host
-a = Make ping audible. Beep each time response
is received.
-b = Ping a broadcast address.
-c = count
Stop after sending count ECHO_REQUEST packets. With
deadline option, ping waits for count ECHO_REPLY packets, until the
timeout expires.
-n = Show network addresses as numbers. ping normally displays
addresses as host names.
-q = Quiet output nothing is displayed except the summary lines at
startup time and when finished.
-i = Specify the interval between successive transmissions. The
default is one second.
-t = Set the IP Time to Live to n seconds.
-w = Exit ping after n seconds.
EXAMPLE:
ping google.com -c 3
Display ECHO_REQUEST 3 times only because we set count for three.
ping -n google.com
Here network add display as nom.
(7)Route
• Command Name :- route
• Purpose :- route command displays routing table resides in kernel
and also used to modify the routing table.The tables which
specifies how packets are routed to a host is called routing table.
• Syntax :- route [options]
[Option]
-n =
-e =
add =
del =
dispalys routing table in numerical[IP Address] format
dispalys routing table in Hostname format
Adds a new route to the routing table
Deletes a route from the routing table
Conti..
EXAMPLE:
1. To dispaly the routing table:
route –n
2. To add static route to a network in the routing table:
route add -net 192.168.1.0 netmask 255.255.255.0 gw
192.168.1.1 dev eth0
3. To delete a route from the routing table:
route del -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.1.1
dev eth0
(8) telnet
• Command Name :- telnet
• Syntax:1. To login to a remote machine, use this syntax:
% telnet <hostname>
2. You can also use the telnet command to connect to a host on a
certain port.
% telnet <hostname> [port]
• (9) ftp
• Command:- ftp
• Purpose :- To connect to an FTP server, simply run the ftp(1)
command and specify the host
• Syntax :- % ftp <hostname> [port]
• If the host is running an FTP server, it will ask for a username
and password. You can log in as yourself or as “anonymous”.
Anonymous FTP sites are very popular for software archives.
For example, to get Slackware Linux via FTP, you must use
anonymous FTP.
• Once connected, you will be at the ftp> prompt. There are
special commands for FTP, but they are similar to other
standard commands. The following shows some of the basic
commands and what they do:
Conti..
• Command
= Purpose
• ls
= List files
• cd <dirname> = Change directory
• bin
= Set binary transfer mode
• ascii
= Set ASCII transfer mode
• get <filename> = Download a file
• put <filename> = Upload a file
• hash
= Toggle hash mark stats indicator
• tick
= Toggle byte counter indicator
• prom
= Toggle interactive mode for downloads
• mget <mask> = Download a file or group of files; wildcards are
allowed
• mput <mask>
= Upload a file or group of files; wildcards are
allowed Log off the FTP server
ftp> ls *.TXT
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
-rw-r--r-- 1 root 100
18606 Apr 6 2002 BOOTING.TXT
-rw-r--r-- 1 root 100
10518 Jun 13 2002 COPYRIGHT.TXT
-rw-r--r-- 1 root 100
602 Apr 6 2002 CRYPTO_NOTICE.TXT
-rw-r--r-- 1 root 100
32431 Sep 29 02:56 FAQ.TXT
-rw-r--r-- 1 root 100
499784 Mar 3 19:29 FILELIST.TXT
-rw-r--r-- 1 root 100
241099 Mar 3 19:12 PACKAGES.TXT
-rw-r--r-- 1 root 100
12339 Jun 19 2002 README81.TXT
-rw-r--r-- 1 root 100
14826 Jun 17 2002 SPEAKUP_DOCS.TXT
-rw-r--r-- 1 root 100
15434 Jun 17 2002 SPEAK_INSTALL.TXT
-rw-r--r-- 1 root 100
2876 Jun 17 2002 UPGRADE.TXT
226 Transfer complete.
ftp> tick
Tick counter printing on (10240 bytes/tick increment).
ftp> get README81.TXT
local: README81.TXT remote: README81.TXT
200 PORT command successful.
150 Opening BINARY mode data connection for README81.TXT (12339 bytes).
Bytes transferred: 12339
226 Transfer complete.
12339 bytes received in 0.208 secs (58 Kbytes/sec)
(10) Dig
• Command:- dig
• Purpose :- dig (Domain Information Groper) command is used
in network administration. It is used to querying and display the
server details of Domain Name System (DNS) name servers. dig
is used for network trouble shooting.
• Syntax :dig [ @server ] [ -b address ] [ -c class ] [ -f filename ] [ -k
filename ] [ -p port# ] [ -t type ] [ -x addr ] [ -y name:key ] [
name ] [ type ] [ class ] [ queryopt... ]
dig [ -h ]
dig [ global-queryopt... ] [ query... ]
Conti..
[OPTIONS]
-b = Set the source IP address of the query instead of Domain
Name System (DNS) name servers.
-c = Over-ride the default query class (IN for internet).
-f = Operate in batch mode by reading a list of lookup requests to
process from a file.
-4 = Force dig to only use IPv4 query transport.
-6 = Force dig to only use IPv6 query transport.
-t = Set the query type to type, any valid query type which is
supported in BIND9.
-h = Print a brief summary of the command-line arguments and
options.
• Conti..
• EXAMPLE:dig hscripts.com
• Output:
; <<>> DiG 9.7.4-P1-RedHat-9.7.4-2.P1.fc14 <<>> hscripts.com ;;
global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode:
QUERY, status: NOERROR, id: 36393 ;; flags: qr rd ra; QUERY: 1,
ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0
;; QUESTION SECTION: ;hscripts.com.
IN A
;; ANSWER SECTION: hscripts.com. 10113 IN A 50.28.68.231
;; AUTHORITY SECTION: hscripts.com. 66378 IN NS
ns2.dnsforcloud.com. hscripts.com. 66378 IN NS
ns1.dnsforcloud.com.
;; Query time: 0 msec ;; SERVER: 192.168.0.1#53(192.168.0.1) ;;
WHEN: Wed Jul 17 14:57:52 2013 ;; MSG SIZE rcvd: 94
• The above command lists the information about hscripts.com.
Thank You