# Setting up a connection with the dialogs

Setting up a connection with the dialog based setup is not too much more difficult than using the wizard.

You can reach the setup dialog the same way you did the wizard. Start &kppp; from your K menu, where you will find its entry in the Internet as Internet Dialer.

The following dialog will appear:

The &kppp; dialer startup screen
The &kppp; dialer startup screen

The &kppp; dialer startup screen

It will probably not have any entries to begin with, and that's what we're about to do now.

Click the Setup button to begin setting up a new Internet connection.

This time, choose Dialog setup and you'll see the following Dialog appear:

The New Account Dialog
The New Account Dialog

The New Account Dialog

The New Account dialog contains the following sections:

- Dial

- IP

- Gateway

- DNS

- Login Script

- Execute

- Accounting

You normally won't need to fill in all these, although each of them is described in the following sections.

## The Dial tab

The Accounts Dial tab
The Accounts Dial tab

The Accounts Dial tab

The Dial tab has the following options:

Connection Name:

  You must give the account a name. This can be anything you like, but if you have more than one account, each name must be unique.

Phone Number:

  Specify the phone number to dial. You can use characters such as - to make the number more legible. If you concatenate a series of numbers separated by a colon (&eg; `1111111:2222222:3333333`, &kppp; will try these numbers one after the other whenever it receives a busy signal. You can use the Add button to add another number, Remove to remove a number from the list, and the up and down arrows to change the order of the list.

Authentication

  Choose the appropriate method of authentication that &kppp; should use to log into the server. Check with your provider for more information. Use of PAP and CHAP are described in the chapter .

Store password

  Check this option if you want &kppp; to remember your password between sessions.

Customize pppd arguments...

  This will bring up the pppd arguments dialog. You can use this dialog to add any desired options that you want &kppp; to hand to pppd. See the pppd man page for a list of available options, but unless you know exactly what you are doing, you should probably restrain yourself from tinkering with these.

## The IP tab

The Accounts IP tab
The Accounts IP tab

The Accounts IP tab

Dynamic IP Address

  Check this if your ISP uses dynamic IP address assignment. In this case, your IP address will change every time you establish a connection.

Static IP Address

  Check this if your ISP has given you a static IP address. In that case you will also need to fill in that address in the IP Address box, and any Subnet Mask if applicable. Ask your ISP if unsure. Dynamically assigned addresses are used in the huge majority if ISP's and leaving this checked will in most cases be the right choice.

Auto-configure hostname from this IP

  Select this option if you want &kppp; to set the hostname and domain for your machine after a successful ppp connection.

  This is done by querying the defined Domain Name Server with the IP assigned for the ppp link.

  This option is useful for those stand-alone machines which want to use protocols such as talk, which require the hostname to be the same as your machine is known on the internet. It overrides the Domain Name option in the DNS section, and the machine defaults are restored to their original values when you close the ppp connection.

  This option is not useful if you just want to connect to the internet and surf, check mail, or chat. It has the side-effect of disallowing any new connections to your X server - in other words, you can't open any more GUI programs.

  Only turn this on if you are absolutely sure you need it.

## The Gateway tab

The Accounts Gateway tab
The Accounts Gateway tab

The Accounts Gateway tab

Default Gateway

  Check this if you want pppd to use the default Gateway for your machine. This is the default.

Static Gateway

  Check this if you want to specify the Gateway to be used in place of the default.

Assign the Default Route to this Gateway

  You almost certainly will need this to be checked (the default).

## The DNS tab

The Accounts DNS tab
The Accounts DNS tab

The Accounts DNS tab

Domain Name:

  Specify the domain name for your machine. As with DNS addresses, it is restored to the original specified in `/etc/resolv.conf` when the connection goes down. If it is left blank, no changes are made to the domain name specified in `/etc/resolv.conf`

Configuration:

  Choose between Automatic (the ISP will automatically issue you DNS server addresses when you connect) and Manual. If you choose manual, the DNS IP Address section is then enabled.

DNS IP Address

  This section is only enabled if you chose Manual in the previous option. Add the Domain Name Servers assigned to you by your ISP. You must specify at least one Domain Name Server for your OS to be able to resolve human readable IP addresses such as ftp.kde.org. The DNS server addresses supplied must be in numeric form, &eg; 128.231.231.233. These addresses will be added at runtime to `/etc/resolv.conf`.

  Choose the Add button to add each new DNS server address to the list box below. Choose Remove to remove an entry from the list.

Disable existing DNS Servers during Connection

  If you check this box, any DNS servers listed in `/etc/resolv.conf` will be disabled while the connection remains up.

## The Login Script tab

The Accounts Login Script tab
The Accounts Login Script tab

The Accounts Login Script tab

Use this dialog to compose a dial in script for your ISP dialup connection. You can use the mini-terminal and the information supplied by your ISP to find out what sequence of actions needs to be executed.

Choose an option from the drop down box on the left, and then add any parameters for that action in the edit box on the right. Use Add to add each entry to the bottom of the script, which is displayed in the lower part of the dialog. Use Insert to insert an entry anywhere in the script, and use Remove to delete a line from the script.

The options available are:

Expect

  &kppp; will wait for the specified string to be received.

Send

  &kppp; will send the specified string.

Scan

  &kppp; will scan the input stream for the specified string, and will store any character from the end of the string up to the next newline, in an internal buffer. Trailing and leading whitespace will be stripped off.

Save

  Permanently store the previously scanned string in the specified register. Currently the only valid register is `password`.

Pause

  Pause for the specified number of seconds.

Hangup

  &kppp; will send the `hangup` to the modem.

Answer

  &kppp; will set the modem into answer mode.

Timeout

  Change the default timeout to the specified number of seconds dynamically during the script. You can change the timeout several times during script execution if necessary.

Prompt

  Prompt the &kppp; user to enter a string, given the specified string as a hint. The user will see what is typed. If the specified string includes the mark `##`, the mark will be replaced with the current content of the internal scan buffer, as previously stored with the scan command.

PWPrompt

  Prompt the &kppp; user to enter a string, given the specified string as a hint. An asterisk will be printed for each character the user types.

ID

  If the Login ID field on &kppp;'s main dialog is filled in, send that ID. If the Login ID field is not filled in, prompt the &kppp; user to enter an ID, given the specified string as a hint. The user will see what is typed. On a second pass, such as in a loop on a second iteration, or during callback authentication, the prompt will be displayed regardless of whether the Login ID field is filled in.

Password

  If the Password field on &kppp;'s main dialog is filled in, send that password. If the Password field is not filled in, prompt the &kppp; user to enter a password, with the specified string as a hint. An asterisk will be printed for each character typed. On a second pass, such as in a loop on a second iteration, or during callback authentication, the prompt will be displayed regardless of whether the Password field is filled in.

LoopStart

  &kppp; will wait for the specified string to be received. It will save the string for use by `LoopEnd`.

LoopEnd

  &kppp; will wait for the specified string to be received to exit the loop. If the string given by the corresponding `LoopStart` is received first, it will trigger a jump to the line after `LoopStart`, enabling repetition of username/password style paired dialogs.

### Example Scripts

#### A simple example login script

Here is a simple example script I could use to connect to my ISP

     Expect      ID:                        # wait for ID:
     Send        myid                       # you have to substitute myid with your id
     Expect      word:                      # wait for 'password'
     Send        4u3fjkl                    # send my password '4u3fjkl'
     Expect      granted                    # My ISP send 'Permission granted' on login success.
     Send        ppp                        # This starts a ppp connection for
                                            # me on the ISP side.

#### A login script that prompts for ID and password, and has loops.

Here is a script for the same account with an ID and password prompt. This script will prompt for ID and password each time, no matter what is typed into the Login ID and password fields on &kppp;'s main screen.

This script also illustrates the use of the LoopStart/LoopEnd structure. If something goes wrong during the login procedure, for example, I mistype the password, my ISP will print an error message and restart the id/password loop by issuing the string `ID:` again. If the string `ID:` is caught before the LoopEnd keyword was parsed, &kppp; will start the script again, from the line after the LoopStart keyword.

     LoopStart   ID:                        # wait for ID:
     Prompt      Enter ID:                  # Prompt me for my ID and send it off.
     Expect      word:                      # wait for 'password'
     PWPrompt    Enter Password:            # Prompt me for my password and send it off.
     LoopEnd     granted                    # My ISP send 'Permission granted' on login success.
     Send        ppp                        # This starts a ppp connection for me

#### Prompts for information not filled in on the main dialog.

Here is the script that I actually use to connect to my ISP. This script will prompt for ID and password only if I haven't filled in the respective fields on &kppp;'s main dialog.

     LoopStart   ID:                        # wait for ID:
     ID          Enter ID:                  # Prompt me for my ID and send it off.
     Expect      word:                      # wait for 'password'
     Password    Enter Password             # Prompt me for my password and send it off.
     LoopEnd     granted                    # My ISP send 'Permission granted' on login success.
     Send        ppp                        # This starts a ppp connection for me
                                            # on the ISP side

#### A script for an ISP using challenge/response authentication.

Here is a script that I use to connect to an ISP which is using some sort of challenge/response authentication. Usually you got a hardware token (a smart card with a display and calculator like keypad) from the ISP. You have to know a password to use the token. After dialing in your ISP displays your challenge. You have to type in the challenge to your token and get a dynamic password as a response. Then you have to enter that password.

     LoopStart   ID:                        # wait for ID:
     ID          Enter ID:                  # Prompt me for my ID and send it off.
     Scan        Challenge:                 # Scan for 'Challenge' and store everything behind up to the next newline.
     Expect      Password:                  # wait for 'password'
     Prompt      Your token is ## - Enter Password  # Prompt me for my password and send it off.
     LoopEnd     granted                    # My ISP sends 'Permission granted' on login success.
     Send        ppp                        # This starts a ppp connection for me
                                            # on the ISP side

#### Using Scan and Save in scripts

The following log shows the login procedure of a fictitious ISP that provides a new password on each login. The new password has to be verified and recorded for the next session.

     University of Lummerland

     Login:mylogin
     Password:
     The password for your next session is: YLeLfkZb
     Please record and enter it for verification.
     Verification:YLeLfkZb

     1 = telnet
     2 = SLIP
     3 = PPP

     Your choice:

&kppp; can be used to this cumbersome task for you, eliminating the risk of losing that little sheet of paper that holds your current password at the same time. The key part of the following script is the combination of Scan/Save keywords.

    7 Expect      Login:                     # wait for login prompt
     ID                                     # send ID
     Expect      Password:                  # wait for password prompt
     Password                               # send password
     Scan        is:                        # wait for '... next session is:' and
                                            # scan the preceding password
     Save        password                   # save the new password for next login
     Expect      Verification:              # wait for 'Verification:'
     Password                               # send new password
     Expect      choice:                    # wait for a prompt that let's you choose
                                            # between different options (telnet, SLIP, PPP)
     Send        3                          # choose option 3, i.e. PPP

## The Execute tab

The Accounts Execute tab
The Accounts Execute tab

The Accounts Execute tab

Here you can select commands to run at certain stages of the connection. These commands are run with your real user id, so you cannot run any commands here requiring root permissions, unless you are of course dialled in as root (a bad thing to do for many reasons!)

Make sure to supply the whole path to the program, otherwise &kppp; may not be able to find it.

You can add commands to be run at four distinct times during the connection process:

Before Connect

  Run this command before the dialing is initiated, so it is already running when you connect to your ISP.

Upon Connect

  Run this command only after a successful connection is made.

Before disconnect

  Run this command while still connected, before hanging up the modem.

Upon disconnect

  Run this command after the connection has been closed.

You might for example want to run leafnode as soon as you have connected, or check your mail. You might want to make sure any mail in your queue is sent, before you close your connection down. You might want a clean-up script to tidy up logs and clear your cache after you have disconnected.

## The Accounting tab

The Accounts Accounting tab
The Accounts Accounting tab

The Accounts Accounting tab

Check the Enable Accounting box to enable or disable telephone cost accounting for this account.

Select from the list the applicable rule for your telecoms provider.

If you can't find one, you can write one yourself by copying the supplied template, which you will find in an appendix.

The final option on this page is Volume Accounting, described below.

### Volume Accounting

#### What is volume accounting?

Basically, it means to count the number of bytes transmitted to and from the Internet. &kppp; can count incoming bytes, outgoing bytes, or both. It's up to you what you want (or must) use.

#### Why should I use volume accounting?

Many Internet Service Providers bill their customers based on the number of bytes transferred. Even more commonly, ISP's offer a flat rate up to some arbitrary transfer limit, and then charge more for every megabyte above this limit. &kppp; shows you your current volume and can help you keep your bills to the minimum. Of course, even if you're not billed based on volume, you can turn on volume accounting just to satisfy your own curiosity.

#### What type of volume accounting should I select?

That depends mainly on your provider. Many of them only count how many megabytes you download from the Internet,and ignore how much you send. In that case you should choose Bytes In. If you have to pay for both, you should choose Bytes In and Out. Bytes Out is really only here for completeness, as we're not aware of any providers using it as a billing basis. It might be useful to those of you running a web or &FTP; server at home though.

#### Drawbacks

Unfortunately, there is a drawback on volume accounting. &kppp; will only count the number of bytes, regardless of their origin. Many providers set their limit only for Internet access, and not for data on their own network. Some providers set different limits for data that is on their own network, in the same country, and coming from overseas. So, if you're doing not much websurfing, and getting most of your pages from your ISP's own proxy cache, then your provider is probably not charging you for that data. &kppp; will not know these IP packets are coming from the proxy, and so it will count them. So if you this situation applies to you, or, as another example, your provider uses a caching news server such as nntpcached, then the volume reported by &kppp; may be higher than the amount you are going to be billed for. On the bright side, at least &kppp; will never underestimate your bills.