Linux with Operating System Concepts



Download 5,65 Mb.
Pdf ko'rish
bet74/254
Sana22.07.2022
Hajmi5,65 Mb.
#840170
1   ...   70   71   72   73   74   75   76   77   ...   254
Bog'liq
Linux-with-Operating-System-Concepts-Fox-Richard-CRC-Press-2014

FTP Command
Meaning
ascii
Transfer files in ascii text (default mode)
binary
Transfer files in binary (necessary if files are binary files)
cd
Change directory on remote machine
close
Close connection but remain in ftp
delete
Delete remote file
get
Transfer file from remote computer to local computer (download)
help
Get the list of commands
lcd
Change directory on the local computer so that uploads originate from 
the specified directory, and downloads are saved to the specified 
directory
ls, mkdir, pwd
List contents of remote directory, create new directory on remote 
machine, and output current working directory on remote machine
mget
Mass get—used in conjunction with wildcards, for example, mget *.txt
mput
Mass put
open
Open a new connection to specified machine
put
Transfer file from local computer to remote computer (upload)
quit
Close connection and exit ftp
rmdir
Delete specified directory on remote computer


188

Linux with Operating System Concepts
• wget www.nku.edu/~foxr
• wget -A .jpg www.nku.edu/~foxr
• wget -r www.nku.edu/~foxr
The nc (netcat) program has been called the “Swiss Army Knife” of network programs. 
It contains a number of useful features that can be used to explore a network including its 
security. In our case, we are interested in using it to communicate with a web server. The 
basic command is 
nc 
remotename port
as in 
nc www.nku.edu 80
. The port 80 
is the default port for HTTP communication. The nc command itself establishes an open 
connection to the remote computer. Once a connection has been made, the user is able to 
interact with the remote computer by sending it commands.
As we will focus on a web server, the commands we wish to send will all be HTTP com-
mands. Therefore, we will want to send GET, OPTION, PUT, or HEAD messages. We must 
specify, along with the command, the URL and the version of HTTP in use. For instance, 
to obtain the file index.html, we might issue the command
GET /index.html HTTP/1.0
If the file is in a subdirectory, such as foxr’s index.html, it would appear as
GET /foxr/index.html HTTP/1.0
With nc, we can specify preferences to the web server to perform 
content negotiation

A web server is set up to return the requested file, but in some cases, the web developers 
might provide multiple files to fulfill a variety of preferences. One type of preference is the 
file’s language. Imagine that there are two versions of /foxr/index.html, one that ends with 
the extension .en and one with the extension .fr. These are most likely the same file but one 
is written in English (en) and one is written in French (fr). If a user wishes the French ver-
sion, the request becomes
GET /foxr/index.html HTTP/1.0
Accept-Language: fr en
This request says “give me a version in French if available, otherwise English.” You are 
able to establish preferences such as language, encoding (compression), character set, and 
MIME type in your web browser as well through the nc program.
5.7.3 Linux Network Inspection Programs
There are numerous other network programs available in Linux. Many of these are tools 
for the system administrator, such as 
route

bind

sendmail

ss

ip,
and 
netstat

We will examine these in Chapter 12 when we focus on network configuration from the 
system administrator perspective. There are a few other programs worth noting though for 


Linux Applications

189
both the administrator and the user. These are 
ip

ping

traceroute

host

dig,
and 
nslookup
. So, we wrap up the chapter by examining these.
As stated in the introduction, every computer on the Internet has a unique IP address. 
Many computers have two addresses, a version 4 address (IPv4), and a version 6 address 
(IPv6). The IPv4 address is stored as a single 32-bit binary number. If written as a decimal 
value, it is four individual numbers, each in the range 0–255 where each number is sepa-
rated by a period such as 1.2.3.4, 10.11.12.13, or 172.31.251.3. Each number is called an 
octet
.
The IPv6 address is a 128-bit binary number that is often written as 32 hexadecimal 
digits. The hexadecimal digits are grouped into octets of four digits long, and separated 
by colons. However, for convenience, leading zeroes are often omitted and if an octet is all 
zeroes, it can also be omitted. For instance, the IPv6 address
fe80::125:31ff:abc:3120
is actually
fe80:0000:0000:0000:0125:31ff:0abc:3120
To determine your computer’s IP address, use the program 
ip
. This program is stored 
in /sbin, which may not be in your path; so, you might have to issue this as /
sbin/ip
. The 
ip command provides many different types of information about your computer’s network 
connections such as local router addresses and addresses of other local devices. The ip 
command expects the object you wish information on. For the address, use 
ip addr

This will supply you with both the IPv4 and IPv6 IP addresses if they are both available. 
To limit the response to just one of these addresses, use the option 
–f inet
for IPv4 and 
–f inet6
for IPv6.
In Linux, you will have at least two interface devices to communicate over: an Ethernet 
device (probably named eth0) and a loopback device named lo. The eth0 device will be 
given an IPv4 and/or IPv6 address. The loopback device is used for your computer to com-
municate with itself rather than networked computers. The lo address is always 127.0.0.1 
with an IPv6 address of all 0s.
Another way to obtain your IP address is with the older program 
ifconfig
, also in 
/sbin. Both ifconfig and ip will display your IP addresses and both of them can be used to 
modify network address information. As these are tasks for a system administrator, we will 
not cover it here.
To test the availability of a remote computer, there are other available Linux programs. 
The easiest and most commonly used one is called 
ping
. The ping program sends out con-
tinual messages to the destination address at 1 second intervals and reports on responses. 
For instance, 
ping 1.2.3.4
could result in the following output:
64 bytes from 1.2.3.4: icmp_seq 
=
1 ttl 
=
60 time 
=
0.835 ms
64 bytes from 1.2.3.4: icmp_seq 
=
2 ttl 
=
60 time 
=
0.961 ms
64 bytes from 1.2.3.4: icmp_seq 
=
3 ttl 
=
60 time 
=
1.002 ms


190

Linux with Operating System Concepts
Such messages repeat until you exit the program by typing control
+
c. Upon termina-
tion, you are given overall statistics such as
3 packets transmitted, 3 received, 0% packet loss,
time 2798 ms rrt min/avg/max/mdev 
=
0.835/0.933/1.002/0.071
As with most Linux commands, ping has a number of useful options. You can specify the 
number of packets transmitted using –c, as in 
ping –c 10
to force ping to exit after the 
10th packet. The –f option outputs a period for each packet sent rather than the output shown 
above. You can establish a different interval for packet transmission using –i interval although 
intervals of < 0.2 seconds require system administrator privilege. The option –R records the 
route that the packet took to reach the destination. This is the output after the first packet’s 
response. You can also specify your own route if you have knowledge of router addresses that 
would permit your message to be routed between your computer and the remote computer.
The 
traceroute
command is like the ping command with the –R option. The trace-
route command sends out packets to a remote computer and reports statistics on the route 
(or routes) that the packets took. While ping is useful to ensure that a computer is acces-
sible, traceroute is useful in determining several things about a network. First, by exam-
ining several traceroutes, you can see what parts of your network are reachable and what 
parts might not be. Also, you can determine if any particular router or part of the network 
is overburdened because it is responding slowly. The newer traceroute6 (or traceroute -6) 
provides IPv6 addresses rather than IPv4 addresses.
The traceroute command sends out several packets, known as 
probes
. To successfully 
reach the next network location, three probes must be received and a response must be 
received. Each probe is sent with a set time-to-live (ttl) value. This is initially a small value, 
but if a probe is unsuccessful in reaching the next network location, a probe is resent that 
has a larger ttl.
The traceroute output provides a list of every segment of the network that was success-
fully reached. In cases where a network segment was not reachable (a time-out is indicated 
if a response is not returned within five seconds), traceroute responds with * * *. The probes 
will reach a variety of types of devices en route to the remote computer. These will include 
your network’s gateway to the Internet, perhaps an Internet service provider, routers at 
various Internet locations such as (or including) Internet backbone sites, the destination 
computer’s gateway to the Internet, internal routers, and finally the destination computer. 
For each segment, the information provided includes the IP alias (if any), the IP address, 
and the time it took for the three probes to reach the device. If more probes reach the loca-
tion, only the last 3 times are output.
The final programs of note are 
host

dig,
and 
nslookup
. These programs perform 
DNS lookups to translate IP aliases into IP addresses. A DNS server
*
contains one or more 
files that provide the address translation information, each file representing one domain 
(or subdomain) within that site.
*
We provide only a cursory examination of DNS tables here. For more detail, see Chapter 15.


Linux Applications

191
DNS servers tend to fall into one of the two categories, authorities that can be masters or 
slaves, and caches. An authority DNS is one that happens to store an SOA (start of author-
ity) entry for a given domain. While this information can be propagated to other DNS 
servers including caches, only the SOAs can be modified to show changes to addressing 
information.
The difference between a master and a slave is that the master’s DNS table is modified 
and then transmitted in regular intervals to all slaves. In this way, a system administrator 
who is maintaining a domain only has to modify a single computer’s DNS table. As we will 
see below, information in this table specifies how often the slaves should be modified.
Other DNS servers may receive copies of address translations. In these cases, the serv-
ers will probably cache the data for some time. DNS servers can be set up to cache or not 
cache such information. Cache entries are fairly short lived so that out-of-date data are 
not kept. If a nonauthority DNS server is asked to perform address translation for a given 
domain, and it does not have the information in its cache, it will ask another DNS server. 
Ultimately, the request will be made of a DNS server that has the information in its cache, 
or is an authority (whether master or slave).
An authority’s DNS table begins with a record about the authority itself. This appears in 
an authority record denoted as

Download 5,65 Mb.

Do'stlaringiz bilan baham:
1   ...   70   71   72   73   74   75   76   77   ...   254




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish