CONNECTION AND SETTINGS FROM INTERNET LINUX
The advance of Linux in its use as a single system (for personal use on systems not connected to) has aroused the interest of using this OS (King of networks), and his extensive collection of tools for Internet access. In this series of articles will learn how to configure access to the Internet using the Linux operating system.
Throughout the different chapters of this course will be taught to set and maintain the programs that provide access to Internet services in the world under Linux, commenting on the process of setting up an easy way to allow anyone (with knowledge minimum GNU / Linux) configured to connect to the Internet, electronic mail and access to Web pages, IRC, etc., all from one operating system so powerful and stable as Linux.
SETTING THE INTERNET CONNECTION
To make the connection to the Internet could be used in some specific assistance or desktop applications, such as desktop KDE kppp. In our case has chosen not to use such assistants as not all systems have them. Instead, it will build small elements included in all Linux distributions (such as pppd), which will allow us to perform our tasks in a more standard and fast. Recall that the philosophy of Linux is that by combining small tools are available from major solutions.
Setting up the modem port
The modem device is normally detected and including initialization during startup by most of the installation programs from different distributions. We use a modem IRQ and be connected to one of the 4 COM ports that are normally present on the PC. If an internal modem is usually located in COM4 (or COM3), while those outside are often connected to COM2, although this is variable via jumpers or connectors.
On Linux, in / dev can be found all the devices (devices) connected to your PC, including the different COM ports, under the name / dev/ttyS0 to / dev/ttyS3 (COM1 to COM4), which are files by which special access to these ports. It is also often a / dev / modem, which is only a link to our modem COM port for the modem to work with a more generic. If we do not have it, it must be established as a link to the port (using ln), which is situated our modem (/ dev / ttySx where x a number from 0 to 3 depending on the equivalence table 1):
Gandalf: / # ln-s / dev / ttySx / dev / modem
TABLE 1:
Device Equiv. MSDOS Port IRQ
--------------------------------------------------
/ dev/ttyS0 COM1 0x3F8 4
/ dev/ttyS1 COM2 0x2f8 3
/ dev/ttyS2 COM3 0x3e8 4
/ dev/ttyS3 COM4 0x2e8 3
After doing this we must seek the maximum speed of communication with our modem, which will edit the file / etc / rc.d / rc.local (or / etc / rc.serial, / sbin / init.d / serial or / etc / rc.d / rc.local as distributions), and include the line:
/ bin / setserial / dev / modem spd_vhi
Normally, the modem is usually configured in this way since the installation of Linux, but is never more sure of this. The same operation can be done manually at the command line (each time you want to activate the flag spd_vhi) by running the command:
Gandalf: / # setserial / dev / modem spd_vhi
He then tested the serial port using setserial:
Gandalf: / # setserial / dev / modem-a
ttyS3, Line 1, UART: 16550A, Port: 0x02e8, IRQ: 3
Baud_base: 115200, close_delay: 50, divisor: 0
closing_wait: 3000, closing_wait2: infinite
Flags: spd_vhi skip_test
To check whether your modem is working correctly, you can use the program minicom (for connecting to a BBSs, eg.) Which will enable us to set a time to call mode terminal using AT commands (or through the menu that includes) and test operation modem. Once the proper functioning may be the configuration of pppd, the daemon that manages PPP connections.
PPP and Internet access
The connection between your computer and the Internet is not real but all the data passing through our ISP (Internet Service Provider, such as CTV, etc..), Which is the real link between us and Our Network goal is to make a connection Point-to-Point Protocol (PPP, Point to Point Protocol) between your computer and our ISP using the telephone line for the exchange of data between two machines (although PPP in general can be used in communication via serial between different machines).
The job of setting itself is quite simple and consist simply create multiple configuration files for the program pppd, who made the connection by taking the information necessary to make it from the configuration files to operate. The whole setup process should be done as root, and the connection (typically up to the comment using sudo or UserGroups to make connections to these users are not super-user).
Many Linux are compiled with support for connections dpi (usually included by default) and with the package pppd (ppp module that loads automatically before each call). To find out if we installed the package and its version, run:
Gandalf: / # rpm-q ppp
ppp-2.2.0f-6
To make a connection sufficient to run the program pppd with the appropriate parameters:
Gandalf: / # pppd / dev / modem 115200 modem passive [etc.].
In practice the large number of options that are used to make the connection makes it easier to include them in the change, calling pppd using one of these files:
Gandalf: / # pppd file options
This option file is just a text file with the parameters that we want to pass pppd (the same as if you did from the command line), normally located in the / etc / ppp. If pppd run with no other parameter (without the parameter file) the program will search the options in / etc / ppp / options (ideal if you only have one supplier), but may include options for each provider to take a different file, which then would allow us to connect by either changing the call to daemon pppd:
Gandalf: / # pppd file / etc / ppp / proveedor_example
You can see an example of file parameters for pppd, where each option is separated by a line feed (although it could use the space) and where any line preceded by the character '#' is a comment. This file is created with any text editor, eg. JOE editor using the joe / etc / ppp / options-example:
#
# Example file on / etc / ppp / options-example
#
connect "/ usr / sbin / chat-v-f / etc / ppp / chat-Infovia"
IPCP-accept-remote
: 192.168.13.200
crtscts
modem
passive
name sromero @ example
noipdefault
debug
defaultroute
asyncmap A0000
/ dev / modem
115200
Some things to note about these settings are:
1 .- The options-accept-remote IPCP and: 192.168.13.200 claim to be conducted to inform the connection that pppd Infovia not provide the IP address of a supplier, you must accept the direction we are indicating fictica, as being make the connection (solution of many failed connections).
2 .- The option crtscts enable hardware flow control of data (using RTS / CTS) serial port.
3 .- The passive option indicates that if no response is received to initiate a connexion passively receiving valid data.
4 .- By pppd's modem to use the phone line.
5 .- The value 115200 is the speed of our port (no modem) in bps. Regarding the actual speed of connection, the Linux automatically negotiate to seek the maximum possible.
6 .- The parameter name our user accounts for authentication of identity. Does not specify the name of our email address, but the account that we make the connection (for example, the same is placed in the connection wizard of Windows). The password is entered into a separate file (PAP authentication), as we shall see below.
CONNECT AND CHAT
Connect the option introduces a new program: chat, which is a little conversation between the modem and pppd, telling how they should act in certain responses from the modem. This will create a file / etc / ppp / chat-Infovia. An example of this type of file:
TIMEOUT 5
"" ATZ
OK ATDT055
ABORT 'NO CARRIER'
ABORT BUSY
ABORT 'NO DIALTONE "
ABORT WAITING
TIMEOUT 70
CONNECT "
The meaning of this file that comes to be, for example, receive a BUSY (toll communicating) by the modem, you should abort (abortion) connection, this way of defining the response to an online communicating. Chat control action to execute pppd to different possible states of the modem as BUSY, NO CARRIER and CONNECT (for more information, chat man). This file must be given execute permissions, so that (as long as root) execute the command:
Gandalf: / # chmod 770 / etc / ppp / chat-Infovia
FILE resolv.conf
Once the text files / etc / ppp / options-exampleand / etc / ppp / chat-Infovia must edit / etc / resolv.conf and add it to the DNS provider and our domain:
#
# / Etc / resolv.conf
# Include DNS domain and primary (and secondary if available).
#
arrakis.es domain
nameserver 195.5.64.2
nameserver 195.5.64.6
After the domain parameter specifies the domain of our ISP, and after the DNS nameserver write it, provided by the supplier (many suppliers have a primary and one secondary DNS, and Linux can include as many as nameserver DNSs take our ISP) . If we do not know the DNS of our ISP, you can look at the connection that we have under Windows, into the connection icon with the right mouse button and review the TCP / IP, or call our supplier to tell us it.
FILE PAP-SECRETS
After creating the two files above and modify resolv.conf only necessary to include our account and password in the file / etc / ppp / pap-secrets, a small database of providers of Internet accounts and passwords for them to following format:
"cuenta1" TAB * TAB "Password1"
"cuenta2" TAB * TAB "password2"
(etc.)
For example, my pap-secrets file (remember separation by tabs and not just spaces):
# Secrets for authentication using PAP
# Client server secret
"examplesromero @" * "my_password"
With this change and we fully configured your Internet connection.
PROCESS CONNECTION
After seeing all the files involved in the operation of a connection, the reader can create their own files of options, which in general are practically the same as in the examples changing identities (name and SECRETS-PAP) and the domain and DNS by our ISP. These configuration files will not be necessary to amend them, and being configured system for future connections. To make our first connection can follow the following process:
1 .- enter as root on the first virtual console and run:
Gandalf: / # tail-f / var / log / messages
By this command will obtain data on the screen that will be added by the system to / var / log / messages, the file system message, which will see outlets generated by pppd and therefore verify all the parameters of the connection. This is only needed the first time that we try to make the connection to see any errors. Tail may quit at any time with pressing CTRL + C.
2 .- We go to the 2nd virtual console with ALT + F2 and enter as root. In this console to start the run pppd markings:
Gandalf: / # pppd file / etc / ppp / mi_provider
3 .- We turn back to the first virtual console (ALT + F1) and look at the messages obtained from pppd for each side of the connection (marked connection, authentication, negotiation of rates and IP addresses, etc.).. Following this, and if you do not get any message hangup modem (the modem has hung up), we see on screen 2 IP addresses (local and remote), and have made the connection. If the connection has failed should try a couple of times because it is more likely to have failed authentication, which the server has not responded, or even to have a bug in our scripts connection, we must correct (apart from the usual failure Information about connections to certain hours). On the other hand if we have a modem PlugNplay and this has not been detected by Linux will have to configure it manually, as discussed in the next issue.
In Table 2 can see the output of a typical connection pppd done successfully.
TABLE 2:
Output tail-f / var / log / messages:
Gandalf pppd [151]: pppd 2.2.0 started by root, uid 0
Gandalf chat [154]: send (ATZ ^ M)
Gandalf chat [154]: expect (OK)
Gandalf chat [154]: ATZ ^ M ^ M
Gandalf chat [154]: OK - got it
Gandalf chat [154]: send (ATDT055 ^ M)
Gandalf chat [154]: abort on (NO CARRIER)
Gandalf chat [154]: [more channels on abortion]
Gandalf chat [154]: expect (CONNECT)
Gandalf chat [154]: ATDT055 ^ M ^ M
Gandalf chat [154]: CONNECT - got it
Gandalf chat [154]: send (^ M)
Gandalf pppd [151]: Serial connection established.
Gandalf pppd [151]: Using interface ppp0
Gandalf pppd [151]: Connect: ppp0 <-> / dev / modem
Gandalf pppd [161]: [validation and IPCP chains]
Gandalf pppd [161]: local IP address 195.5.78.119
Gandalf pppd [161]: remote IP address 192.168.13.200
4 .- At this time we can pass any console and enter a user either to use any navigation software, IRC, email or Internet service such as Netscape, Arena, mail or news readers, ftp or telnet.
OFF THE INTERNET
To make the disconnect from the Internet (including the crash of the phone), it would suffice to list the processes that are currently running using the ps, kill and kill order by the number of the pppd (No kill _process). You can also use killall pppd PID to kill all the partners and thus the connection. The closure of the connection can be checked in / var / log / messages:
Gandalf pppd [161]: Hangup.
Gandalf pppd [161]: Connection terminated.
Gandalf pppd [161]: Exit.
Besides these methods of disconnection, some distributions are included in the ppp-off script.
IN SUMMARY
Although it may seem a very complex process, in reality simply by creating a couple of files is set around the access to the Internet. These files can stop the case and the connection and disconnection is simply a call to pppd killall pppd or very easy and fast by the user. Moreover, we shall soon see what advantages does not make connections with Linux with the tools to discuss and include in future issues.
IN THE NEXT DELIVERY
We have seen how to configure access to our ISP leaving organized to make connections in a simple manner by pppd. In the next article in this series will discuss how to configure Netscape Communicator for Linux, the configuration of the famous Plug'n'Play modems, configuration collection and automatically send e-mail to news and made the connection process by pppd, the Some programs use linux as FTP and Telnet access for example to our own computer (localhost). Until then, the reader can conduct its own scripts connecting to the Internet from the fabulous Linux