BestLightNovel.com

LPI Linux Certification in a Nutshell Part 35

LPI Linux Certification in a Nutshell - BestLightNovel.com

You’re reading novel LPI Linux Certification in a Nutshell Part 35 online at BestLightNovel.com. Please use the follow button to get notification about the latest chapter next time when you visit BestLightNovel.com. Use F11 button to read novel in full-screen(PC only). Drop by anytime you want to read free – fast – latest novel. It’s great if you could leave a comment, share your opinion about the new chapters, new novel with others on the internet. We’ll do our best to bring you the finest, latest novel everyday. Enjoy

[-o[destination(s)]]

[-p[printer(s)]][-r][-R][-s][-t][-u[user(s)]]

[-v[printer(s)]]

Description lpstat displays status information about the current cla.s.ses, jobs, and printers. When run with no arguments, it lists jobs queued by the current user. displays status information about the current cla.s.ses, jobs, and printers. When run with no arguments, it lists jobs queued by the current user.

Options -a [printer(s)]

Shows the accepting state of printer queues. If no printers are specified, shows all printers.

-t Shows all status information. This option is very useful for troubleshooting.

Name lpadmin Syntax lpadmin[-E][-Uusername][-hserver[:port]]-ddestination lpadmin[-E][-Uusername][-hserver[:port]]-pprinteroption(s) lpadmin[-E][-Uusername][-hserver[:port]]-xdestination Description lpadmin configures printer and cla.s.s queues provided by CUPS. It can also be used to set the server default printer or cla.s.s. configures printer and cla.s.s queues provided by CUPS. It can also be used to set the server default printer or cla.s.s.

Options -m model Sets a standard System V interface script or PPD file from the model directory.

-v device-uri device-uri Sets the device URI attribute of the printer queue. If device-uri device-uri is a filename, it is automatically converted to the form is a filename, it is automatically converted to the form file:/// file:///file/name. Use the lpinfo lpinfo(8) command for a list of supported device URIs and schemes.

-E Enables the printer and accepts jobs; this is the same as running the accept accept and and cupsenable cupsenable programs for a specific printer. programs for a specific printer.

Name lpq Syntax lpq[options][users][job#s]

Description Query a print queue. If numeric job#s job#s are included, only those jobs are listed. If are included, only those jobs are listed. If users users are listed, only jobs submitted by those users are listed. are listed, only jobs submitted by those users are listed.

Options -l Long output format. This option results in a multiline display for each print job.

-P name name This specifies the print queue name name. In the absence of -P -P, the default printer is queried.

Example 1 Examine active jobs: $lpq lpisreadyandprinting RankOwnerJobFilesTotalSize activeroot193filter9443bytes 1stroot194resume.txt11024bytes 2ndroot196(standardinput)18998bytes Here, filter filter is currently being printed. is currently being printed. resume.txt resume.txt is up next, followed by the 18,998 bytes of data piped into is up next, followed by the 18,998 bytes of data piped into lpr lpr's standard input.

Example 2 Examine those same jobs using the long format: $lpq-l lpisreadyandprinting root:active[job193AsJRzIt]

filter9443bytes root:1st[job194AMj9lo9]

resume.txt11024bytes root:2nd[job196A6rUGu5]

(standardinput)18998bytes Example 3 Examine queue lp lp, which turns out to be empty: $lpq-Plp noentries Example 4 Examine jobs owned by bsmith bsmith: $lpqbsmith RankOwnerJobFilesTotalSize 7thbsmith202.bash_history1263bytes 9thbsmith204.bash_profile5676bytes Using the job numbers reported by lpq lpq, any user may remove her own print jobs from the queue, or the superuser may remove any job.

Name lprm Syntax lprm[-Pname][users][job#s]

lprm-ly Description Remove jobs from a print queue. In the first form, remove jobs from queue name name or from the default queue if or from the default queue if -P -P is omitted. If is omitted. If users users or or jobs jobs are specified, only those jobs will be removed. In the second form, all of a normal user's jobs will be omitted; for the superuser, the queue will be emptied. are specified, only those jobs will be removed. In the second form, all of a normal user's jobs will be omitted; for the superuser, the queue will be emptied.

Example 1 As a normal user, remove all of your print jobs: $lprm- Example 2 As the superuser, remove all jobs from queue ps ps: #lprm-Pps- You may occasionally be surprised to see a no entries no entries response from response from lpq lpq, despite observing that the printer is dutifully printing a doc.u.ment. In such cases, the spool has probably been emptied into the printer's buffer memory, and the result is that the job is no longer under the control of the printing system. To kill such jobs, you need to use the printer's controls to stop and delete the job from memory.

Name lpr Syntax lpr[options][files]

Description Send files files or standard input to a print queue. A copy of the input source is placed in the spool directory under or standard input to a print queue. A copy of the input source is placed in the spool directory under /var/spool/lpr /var/spool/lpr until the print job is complete. until the print job is complete.

Frequently used options -#number Send number number copies of the print job to the printer. copies of the print job to the printer.

-s Instead of copying a file to the print spooling area, make a symbolic link to the file, thereby eliminating transfer time and storage requirements in /var/spool/lpr /var/spool/lpr. This can relieve load on the daemon's system for very large files.

-Pname Specify the print queue name name. In the absence of -P -P, the default printer is queried.

Example 1 Print the file /etc/fstab /etc/fstab on the default print queue: on the default print queue: #lpr/etc/fstab Example 2 Print a manpage by piping to lpr lpr's standard input: #man-t5printcap|lpr Example 3 Disable a print queue: #lpcdisablelp Then, attempt to print three copies of a file to the disabled queue as superuser: #lpr-#3/etc/fstab This succeeds, despite the disabled printer queue. Now try as a regular user: $lpr-#3~/resume.txt lpr:Printerqueueisdisabled As expected, normal users can't print to the disabled queue.

On the ExamYou must be familiar with lp lp and its use with both files and standard input. Also remember that and its use with both files and standard input. Also remember that lp lp doesn't send data to the printer but to the printer daemon ( doesn't send data to the printer but to the printer daemon (cupsd on Linux), which handles sending it to the printer backend and then to the printer. on Linux), which handles sending it to the printer backend and then to the printer.

Troubleshooting General Printing Problems Logfiles are the first, and sometimes the best, guide to solving problems with printing. Many people still make the basic mistake of forgetting to check logfiles. These files are rotated, so that you can find recent events in the main file and older events in gzipped backup files. If you need even more detail, change the LogLevel LogLevel line in line in /etc/cups/cupsd.conf /etc/cups/cupsd.conf to the value to the value debug debug. It will dump loads of extra information into the logfiles for subsequent print operations.

You should also know about the cups-config cups-config command, which has some options that show you information about the current state of the system. command, which has some options that show you information about the current state of the system.

The Error Logfile Recent errors and related information can be found in /var/log/cups/error_log /var/log/cups/error_log. This file lists messages from the scheduler, which includes both errors and warnings. You can view detailed and real-time information about data transferring, filtering, etc. Sample messages generated by one typical job are: I[16/Nov/2009:11:19:07+0100][Job102]Addingstartbannerpage"none".

I[16/Nov/2009:11:19:07+0100][Job102]Addingendbannerpage"none".

I[16/Nov/2009:11:19:07+0100][Job102]Fileoftypeapplication/postscript queuedby"brunop".

I[16/Nov/2009:11:19:07+0100][Job102]Queuedon"PDF"by"brunop".

I[16/Nov/2009:11:19:07+0100][Job102]Startedfilter /usr/libexec/cups/filter/pstops(PID18223) I[16/Nov/2009:11:19:07+0100][Job102]Startedbackend /usr/libexec/cups/backend/cups-pdf(PID18224) I[16/Nov/2009:11:19:07+0100][Job102]Completedsuccessfully.

I[16/Nov/2009:11:20:17+0100][Job???]Requestfiletypeis application/postscript.

I[16/Nov/2009:11:20:17+0100][Job103]Addingstartbannerpage"none".

I[16/Nov/2009:11:20:17+0100][Job103]Addingendbannerpage"none".

I[16/Nov/2009:11:20:17+0100][Job103]Fileoftypeapplication/postscript queuedby"brunop".

I[16/Nov/2009:11:20:17+0100][Job103]Queuedon"PDF"by"brunop".

I[16/Nov/2009:11:20:17+0100][Job103]Startedfilter /usr/libexec/cups/filter/pstops(PID18340) I[16/Nov/2009:11:20:17+0100][Job103]Startedbackend /usr/libexec/cups/backend/cups-pdf(PID18341) I[16/Nov/2009:11:20:17+0100][Job103]Completedsuccessfully.

The I I that starts each line stands for "information." In this case, no errors or warnings were generated. that starts each line stands for "information." In this case, no errors or warnings were generated.

The Page Logfile This logfile can be found in /var/log/cups/page_log /var/log/cups/page_log. It keeps information from each page sent to a printer. Each line contains the following information (when applicable): printeruserjob-iddate-timepage-numbernum-copiesjob-billing job-originating-host-namejobnamemediasides A sample excerpt follows: Photosmart_C4500brunop86[31/Oct/2009:12:48:36+0100]11-localhost Photosmart_C4500brunop86[31/Oct/2009:12:48:52+0100]21-localhost adamp23brunop87[02/Nov/2009:13:40:33+0100]11-localhost adamp23brunop87[02/Nov/2009:13:40:33+0100]21-localhost adamp23brunop88[09/Nov/2009:09:31:11+0100]11localhost PDFroot100[16/Nov/2009:11:11:52+0100]11-localhost PDFbrunop101[16/Nov/2009:11:16:38+0100]11-localhost The Access Logfile This file can be found in /var/log/cups/access_log /var/log/cups/access_log. It lists each HTTP resource accessed by a web browser or client. Each line is in an extended version of the so-called "Common Log Format" used by many web servers and web reporting tools. A sample follows (lines broken to fit the page of this book): localhost--[16/Nov/2009:17:28:29+0100]"POST/HTTP/1.1"200138 CUPS-Get-Defaultsuccessful-ok localhost--[16/Nov/2009:17:28:29+0100]"POST/HTTP/1.1"200552 CUPS-Get-Printerssuccessful-ok localhost-root[16/Nov/2009:17:28:29+0100]"GET/printersHTTP/1.1" 20011258-- localhost-root[16/Nov/2009:17:28:29+0100]"GET /images/b.u.t.ton-search.gifHTTP/1.1"200332-- localhost-root[16/Nov/2009:17:28:29+0100]"GET /images/b.u.t.ton-clear.gifHTTP/1.1"200279-- Using the cups-config Utility for Debugging The cups-config cups-config utility has several parameters that can be handy while troubleshooting. The options are described in utility has several parameters that can be handy while troubleshooting. The options are described in Table18-2 Table18-2.

Table18-2.Options to cups-config

Option Description --cflags Displays the necessary compiler options.

--datadir Displays the default CUPS data directory.

--help Displays the program usage message.

--ldflags Displays the necessary linker options.

--libs Displays the necessary libraries to link to.

--serverbin Displays the default CUPS binary directory, where filters and backends are stored.

--serverroot Displays the default CUPS configuration file directory.

On the ExamBe familiar with the CUPS logfiles, and how to interpret them to troubleshoot printing issues.

Chapter19.Networking Fundamentals (Topic 109.1)

Although it is not necessary for you to be a networking expert to pa.s.s the LPIC Level 1 Exams, you must be familiar with networking, network-related vocabulary, and basic Linux networking configuration. This chapter introduces fundamental networking and troubleshooting concepts specifically included in the exams. However, it is not a complete introductory treatment, and you are encouraged to review additional material for more depth. This chapter covers this Objective: Objective 1: Fundamentals of Internet Protocols Candidates should demonstrate a proper understanding of network fundamentals. This Objective includes the understanding of IP addresses, network masks, and what they mean (i.e., determine a network and broadcast address for a host based on its subnet mask in dotted quad dotted quad or abbreviated notation, or determine the network address, broadcast address, and netmask when given an IP address and number of bits). It also covers the understanding of the network cla.s.ses and cla.s.sless subnets (CIDR) and the reserved addresses for private network use. IPv6 is also discussed, along with how this addresses some of the limitations of IPv4. It includes the understanding of the function and application of a default route. It also includes the understanding of basic Internet protocols (IP, ICMP, TCP, UDP) and the more common TCP and UDP ports (20, 21, 23, 25, 53, 80, 110, 119, 139, 143, 161). Weight: 4. or abbreviated notation, or determine the network address, broadcast address, and netmask when given an IP address and number of bits). It also covers the understanding of the network cla.s.ses and cla.s.sless subnets (CIDR) and the reserved addresses for private network use. IPv6 is also discussed, along with how this addresses some of the limitations of IPv4. It includes the understanding of the function and application of a default route. It also includes the understanding of basic Internet protocols (IP, ICMP, TCP, UDP) and the more common TCP and UDP ports (20, 21, 23, 25, 53, 80, 110, 119, 139, 143, 161). Weight: 4.

Objective 1: Fundamentals of Internet Protocols The TCP/IP suite of protocols was adopted as a military standard in 1983 and has since become the world standard for network communications on the Internet and on many LANs, replacing proprietary protocols in many cases. This section covers TCP/IP basics cited by the LPI Objectives.

Network Addressing For several years IPv4 has been the standard method for a.s.signing a unique address that identifies the host on the network and the Internet. The 32-bit IP address, also referred to as a dotted quad dotted quad, is composed of four 8-bit fields divided by a period. These fields identify first the network and then the host for a device on the network. IPv4 provides 4.29 billion addresses.

The IP address 192.168.1.150 and the binary equivalent would be: 11000000 10101000 00000001 10010110 IPv4 addresses are categorized into cla.s.ses to provide structure. There are five cla.s.sifications of networks defined by IP addresses. Table19-1 Table19-1 identifies the address ranges for the cla.s.ses that are primarily used. identifies the address ranges for the cla.s.ses that are primarily used.

Table19-1.IPv4 address ranges by cla.s.s

Address cla.s.s IP address range Cla.s.s A 0.0.0.0 to 127.255.255.255 Cla.s.s B 128.0.0.0 to 191.255.255.255 Cla.s.s C 192.0.0.0 to 223.255.255.255 Cla.s.s D 224.0.0.0 to 239.255.255.255 Cla.s.s E 240.0.0.0 to 247.255.255.255

Every device on a network or connected to the Internet needs a unique IP address, including printers and fax machines; consequently, the supply of available IP addresses will run out eventually. There have been many technologies developed to reduce the exhaustion of available IP addresses, including network address translation (NAT), Cla.s.sless Inter-Domain Routing (CIDR), and IPv6.

Private IP addresses and NAT One of the early attempts of handling the exhaustion of IP addresses was the implementation of private IP addresses. Private IP addresses are not globally a.s.signed, which means that different organizations may use the same private IP addresses. Private IP addresses are not routable, and therefore they are not accessible across the Internet. Organizations using private IP address internally for network connectivity use a process called network address translation (NAT) gateway or a proxy server to provide connectivity to the Internet. Each IP address cla.s.s has a range of IP addresses that are reserved as private addresses. Table19-2 Table19-2 lists the ranges for private IP addresses. lists the ranges for private IP addresses.

Table19-2.IPv4 private network address ranges

Cla.s.s Private IP address range Cla.s.s A 10.0.0.0 to 10.255.255.255 Cla.s.s B 172.16.0.0 to 172.31.255.255 Cla.s.s C 192.168.0.0. to 192.168.255.255

Cla.s.sless Inter-Domain Routing (CIDR) In the 1990s it became apparent that the exhaustion of the IPv4 addresses would be reached in a few years with the ever-growing expansion of Internet technology. The move was made away from a.s.signing IP addresses based on cla.s.ses to a method that uses ranges of address. IPv4 addresses are now specified using the CIDR notation that specifies subnet masks. The CIDR notation uses the format address address/prefix.

The prefix prefix designates the number of bits that will be used by the subnet mask. Let's say we have a range of IP addresses consisting of 206.24.94.105 and a subnet mask of 255.255.255.0. We would note this address using CIDR as: designates the number of bits that will be used by the subnet mask. Let's say we have a range of IP addresses consisting of 206.24.94.105 and a subnet mask of 255.255.255.0. We would note this address using CIDR as: 206.24.94.105/24 Using the CIDR notation allows for custom subnet masks to be created without tying them to the limitations of cla.s.ses.

Internet Protocol Version 6 (IPv6) The Internet Engineer Task Force (IETF) defined IPv6 in 1995. While IPv4 still has the majority of addressing, all network operating systems and hardware device manufacturers support IPv6. IPv6 increases the size of IP addresses from 32 bits to 128 bits, or 16 octets. This increases the possible number of available addresses to a maximum of 2128, or 3.421038, unique addresses. With the large number of available IPv6 addresses, it is not necessary to implement addressing conservation methods such as NAT and CIDR. This will help reduce the administration overhead of managing addresses.

The IPv6 address is composed of hexadecimal digits representing 4-bit sections separated by a colon. The addresses are represented by the format x.x.xx x.x.xx:x.x.xx:x.x.xx:x.x.xx:x.x.xx:x.x.xx:x.x.xx:x.x.xx. An example of the preferred format for IPv6 addresses would look like the following: 2130:0000:0000:0000:0003:0040:150c:235b IPv6 may be abbreviated by removing the leading zeros from the address, so if applied to the previous example, the address could appear as follows: 2130:0:0:0:3:40:150c:235b Another shorthand version of the IPv6 address uses double-colon notation, wherein address sections that consist of a series of zeros may be replaced with a double colon. In the instance of the IPv6 address 2130:0000:0000:0000:0003:0040:150c:235b, it could be shortened to: 2130::3:40:150c:235b IPv6 address several disadvantages of IPv4 addressing, including: Limited addresses As mentioned previously, IPv4 has only about 109 available addresses, and this supply is expected to be exhausted in the near future. IPv6 has a much larger addressing capability with 10 available addresses, and this supply is expected to be exhausted in the near future. IPv6 has a much larger addressing capability with 1038 addresses. addresses.

Security IPsec was designed to be integrated into IPv6 addressing and is mandated to be used with the protocol, whereas IPv4 treats it as an optional function. Encryption processes are also mandated to be included into IPv6 addressing.

Configuration IPv6 devices will autoconfigure themselves when connected to an IPv6-routed network. This process is a cleaner version of the IPv4 DHCP process discussed later in this chapter. The autoconfiguration functionality also improves addressing a.s.signments of mobile devices because these devices are a.s.signed to a "home" address where it remains always reachable. When the mobile device is at home, it connects using the home address. When the mobile device is not at home, a home agent, typically a router, will relay messages between the mobile device and the nodes it is communicating with.

Performance IPv6 headers have been modified to fixed widths to work with high-speed routers, increasing speed and performance when moving data packets across Internet backbones.On the ExamPrepare to discuss the difference between public and private IP addresses on the Internet. Also be able to discuss the major differences between IPv4 and IPv6 addressing.

Masks The early specification of the IP recognized that it would be necessary to divide one's given allotment of IP addresses into manageable subnetworks. Such division allows for distributed management, added security (fewer hosts can potentially snoop network traffic), and the use of multiple networking technologies (Ethernet, Token Ring, ATM, etc.). IP also enables convenient part.i.tioning of the physical portions of a network across physical and geographical boundaries. To provide the capability to locally define networks, IP addresses are considered as having two distinct parts: the part that specifies a subnet subnet and the one that specifies a network interface. (Remember that IP addresses are a.s.signed to network interfaces, not host computers, which can have multiple interfaces. For this discussion, however, we a.s.sume a one-to-one relations.h.i.+p between hosts and interfaces.) The boundary between the network and host portions of an IP address is delineated by a and the one that specifies a network interface. (Remember that IP addresses are a.s.signed to network interfaces, not host computers, which can have multiple interfaces. For this discussion, however, we a.s.sume a one-to-one relations.h.i.+p between hosts and interfaces.) The boundary between the network and host portions of an IP address is delineated by a subnet mask subnet mask, required by the TCP/IP configuration of any network interface. Like the IP address, the subnet mask is simply a 32-bit number specified in four 8-bit segments using dotted quad dotted quad decimal notation. The familiar cla.s.s A, B, and C networks have these subnet masks: decimal notation. The familiar cla.s.s A, B, and C networks have these subnet masks: Cla.s.s A: 255.0.0.0 (binary 11111111.00000000.00000000.00000000) 8-bit network address and 24-bit host address Cla.s.s B: 255.255.0.0 (binary 11111111.11111111.00000000.00000000) 16-bit network address and 16-bit host address Cla.s.s C: 255.255.255.0 (binary 11111111.11111111.11111111.00000000) 24-bit network address and 8-bit host address When logically AND'd with an IP address, the bits set to 0 0 in the subnet mask obscure the host portion of the address. The remaining bits represent the network address. For example, a host on a cla.s.s C network might have an IP address of 192.168.1.127. Applying the cla.s.s C subnet mask 255.255.255.0, the network address of the subnet would be 192.168.1.0, and the host address would be 127, as depicted in in the subnet mask obscure the host portion of the address. The remaining bits represent the network address. For example, a host on a cla.s.s C network might have an IP address of 192.168.1.127. Applying the cla.s.s C subnet mask 255.255.255.0, the network address of the subnet would be 192.168.1.0, and the host address would be 127, as depicted in Figure19-1 Figure19-1.

Figure19-1.Host interface address calculation Although it is typical to use the predefined cla.s.ses (A, B, and C), the boundary can be moved left or right in the IP address, allowing for fewer or more subnets, respectively. For example, if a single additional bit were added to the cla.s.s C subnet mask, its IP address would be: 255.255.255.128 (binary 11111111.11111111.11111111.10000000) 25-bit network address and 7-bit host address With such a subnet defined on an existing cla.s.s C network such as 192.168.1.0, the 256-bit range is split into two subnets, each with 7 host bits. The first of the two subnets begins at 192.168.1.0 (the subnet address) and continues through 192.168.1.127 (the subnet broadcast address). The second subnet runs from 192.168.1.128 through 192.168.1.255. Each of the two subnets can accommodate 126 hosts. To extend this example, consider two additional bits: 255.255.255.192 (binary 11111111.11111111.11111111.11000000) 26-bit network address and 6-bit host address When applied to a cla.s.s C network, four subnets are created, each with 6 host bits. Just as before, the first subnet begins at 192.168.1.0 but continues only through 192.168.1.63. The next subnet runs from 192.168.1.64 through 192.168.1.127, and so on. Each of the four subnets can accommodate 62 hosts. Table19-3 Table19-3 shows more detail on cla.s.s C subnets, considering only the host portion of the address. shows more detail on cla.s.s C subnets, considering only the host portion of the address.

Table19-3.Cla.s.s C IP subnet detail

Subnet mask Number of subnets Network address Broadcast address Minimum IP address Maximum IP address Number of hosts Total hosts 128 2 0 127 1 126 126

128 255 129 254 126 252 192 4 0 63 1 62 62

Please click Like and leave more comments to support and keep us alive.

RECENTLY UPDATED MANGA

LPI Linux Certification in a Nutshell Part 35 summary

You're reading LPI Linux Certification in a Nutshell. This manga has been translated by Updating. Author(s): Adam Haeder. Already has 970 views.

It's great if you read and follow any novel on our website. We promise you that we'll bring you the latest, hottest novel everyday and FREE.

BestLightNovel.com is a most smartest website for reading manga online, it can automatic resize images to fit your pc screen, even on your mobile. Experience now by using your smartphone and access to BestLightNovel.com