geekvenue.net

Welcome to Chucktips Hardware HELP WITH DEAD OS Installing FreeBSD Miscellaneous
 faq
 search
 add article
 cool-stuff
 how-to
 main
 tips


HOWTO: Connect to the internet with ppp
Networking and Connectivity Posted by Jason on Sunday March 18, @05:09PM
from the Route-66 dept.
If you would like to connect your FreeBSD box to the internet using a modem, here is a quick and dirty HOW-TO.

FreeBSD even supports dial-on-demand networking, so your machine will dial your isp automatically when you start your browser.

There are only a couple of things you will need to do to connect to the internet.

[Connect a modem]
You will need to connect a modem to a serial port or use an internal modem that can be referenced with COM port number. FreeBSD doesn't work well with WinModems.
(WinModems are modems that replace portions of the electronics with software- usually part of the drivers. WinModems are often referred to as Laboto-Modems)

[Modify the /etc/ppp/ppp.conf file]
Login as root, change to the /etc/ppp directory and use vi or ee to edit the ppp.conf file.

 cd /etc/ppp
 ee ppp.conf

You should only need to modify four lines of the file. (device refers to your serial port- com1 is cuaa0 and com2 is cuaa1). Here's what you change:

 set device /dev/cuaa0
 set authname YOUR_ISP_LOGIN_NAME
 set authkey YOUR_ISP_PASSWORD
 set phone 999-9999

Here is what the entire ppp.conf file looks like:

#/etc/ppp/ppp.conf
default:
 set device /dev/cuaa0
 set speed 115200
 disable pred1
 deny pred1
 disable lqr
 deny lqr
 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 8 \"\" AT OK-AT-OK \\dATDT\\T TIMEOUT 40 CONNECT"
  set redial 3 20
#end default
demand:
 set authname YOUR_ISP_LOGIN_NAME
 set authkey YOUR_ISP_PASSWORD
 set phone 999-9999
 set timeout 0
 add default HISADDR
 set openmode active
 accept pap
 set ifaddr 127.1.1.1/0 127.2.2.2/0 255.255.255.0
 add 0 0 HISADDR
#end demand

[Modify the /etc/ppp/ppp.linkup file]
Login as root, change to the /etc/ppp directory and use vi or ee to edit the ppp.linkup file.

 cd /etc/ppp
 ee ppp.linkup

Edit the file to read
#/etc/ppp/ppp.linkup
demand:
 delete ALL
 add 0 0 HISADDR
#
MYADDR:
 add 0 0 HISADDR

[Edit /etc/resolv.conf]
The resolv.conf file contains your ISP's DNS server IP address's. Here is how to set it up.

cd /etc
ee resolv.conf

Edit the file to read
search YOUR_ISP.COM
nameserver YOUR_ISP_DNS_1
nameserver YOUR_ISP_DNS_2

[Edit /etc/rc.conf]
You will need to add the following text to your /etc/rc.conf file. These commands will start the ppp protocol and setup dial-on-demand.

Login as root and edit /etc/rc.conf

cd /etc/
ee rc.conf

Append these lines to the file
ppp_enable="YES"
ppp_mode="auto"
ppp_nat="YES"
ppp_profile="demand"

ppp_enable -Starts userland ppp daemon at startup.
ppp_mode -Sets the mode. Use auto for dial-on demand, use ddial for a persistent 24/7 connection.
ppp_nat -Tells ppp to use network address translation.
ppp_profile -Tells ppp what tag to use in your /etc/ppp/ppp.conf file.

[Reboot]
After you restart your computer, try to ping your isp. It should trigger the modem to dial the connection and ping them. Next, try to ping an internet website. If that works, you should be in business.


(note: if you would like a copy of the files mentioned in this posting, download the file attachment to the right ppp-sample.tar and extract the two files with the command tar xvf ppp-sample.tar

<  |  >

 

Related Links
  • Articles on Networking and Connectivity
  • Also by Jason
  • Contact author

    Lilliput Mini USB Computer Monitor

    If you have ever wanted to learn about Cisco Routers, check out my new book "Cisco Routers for the Small Business" - it's Cisco CLI for the Regular Guy!

  • Sponsors

    File Attachment
  • Click to download attachment ppp-sample.tar
    10KB (10240 bytes)

  • The Fine Print: The following comments are owned by whoever posted them.
    ( Add a Reply )

    Re: HOWTO: Connect to the internet with ppp
    by Jeremy Reid on Monday April 15, @01:41PM
    I'm curious.. are there any methods for having two ppp logins run at boot time?
    I currently have two logins, for two 'static' ip addresses.. I've managed to make them both login manually, but I can only make one load at boot time through rc.conf.
    What would you suggest? A startup script?
    [ Add a Reply to this ]
    • Re: HOWTO: Connect to the internet with ppp
      by Jason on Tuesday April 16, @12:00PM
      I think a startup script would be an easy way to allow for this, you could create the two dial-up ppp profiles in /etc/ppp/ppp.conf and call one from rc.donf and the other from a script in /usr/local/etc/rc.d/xyz.sh
      [ Reply to this ]
      • Re: HOWTO: Connect to the internet with ppp
        by lucky on Wednesday April 17, @02:18AM
        #Maybe this will help any of those with ADSL or optic fibre using PPPoE:...
        #The /etc/ppp/ppp.conf file
        #dont forget to put a space when you start typing set...
        #do not type <space>, use the space bar =)

        default: #don't forget the column
        <space>set device PPPoE:ed1 #assuming ed1 is the lan cards device address
        <space>set MRU 1454
        <space>set MTU 1454
        <space>set log Phase Chat CCP tun command
        <space>add default HISADDR
        <space>accept chap
        <space>alias enable yes
        <space>add 0 0 HISADDR
        <space>add 0 0 127.2.2.2
        <space>set authname YOURLOGIN@YOUR_ISP
        <space>set authkey YOURPASSWORD

        #If you have static IPs, just change the add 0 0 HISADDR to add <ip> <ip> HISADDR


        #The /etc/resolv.conf, add 2 lines...
        #if you don't have this file....Make it.
        nameserver 200.200.200.201 // ISP nameserver
        nameserver 200.200.200.202 // ISP nameserver


        #in /etc/hosts add 2 lines under ::1 (return) 127.0.0.1localhost localhost.my.domain
        192.168.1.1 bsd bsd.my.domain
        192.168.1.2 lucky lucky.my.domain
        192.168.1.3 myotherpc myotherpc.my.domain


        #in /etc/rc.conf add these lines
        hostname="bsd.my.domainh
        gateway_enable="YESh
        network_interface="lo0 ed1h #assuming ed1 is the lan cards device address
        ifconfig_lo0="inet1 127.0.0.1h
        ifconfig_ed1="inet 192.168.1.1 netmask 255.255.255.0"

        #for static ips, in your rc.conf...
        ifconfig_lo0="inet 127.0.0.1"
        ifconfig_ep1="inet 192.168.1.1 netmask 255.255.255.0"
        ifconfig_tun0="inet <ip1> <ip2> netmask 255.255.255.255"
        #replace <ip1+2> with your ips

        #Easy to make a file in /usr/local/etc/rc.d/ to connect when you boot.
        #easy way...
        echo "ppp -ddial" > /usr/local/etc/rc.d/dialup.sh
        chmod 777 /usr/local/etc/rc.d/dialup.sh
        #reboot your machine. Don't have to but it makes life easy


        #or you can just do it manually instead of dialup.sh
        ppp -ddial
        #and
        killall ppp // to kill it =)



        #If you now want to connect your windows machines to the internet using your BSD box as a gateway.

        #in windows open the tcp/ip properties
        #under IP address enter
        192.168.1.2
        255.255.255.0
        #leave wins empty. In gateway enter
        192.168.1.1
        #in DNS settings select eUse DNSf and enter
        lucky my.domain
        #in the DNS server numbers add the 2 ip addresses from /etc/resolve.conf
        in this case it was
        200.200.200.201 // ISP nameserver
        200.200.200.202 // ISP nameserver

        #Now reboot that badboy and lets see if it works =)

        I hope this can help somebody as I spent far too many hours trying to work this out.
        [ Reply to this ]
    Re: HOWTO: Connect to the internet with ppp
    by Leo on Wednesday May 07, @10:59AM
    Hi, I saw your examples and are very good. But, I could need if somebody tested ppp in auto mode asking for a passowrd to user. This is wat I'm trying to do: in ppp.conf file leo: set phone "123456" set device /dev/cuaa1 set speed 19200 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 15 \ \"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 60 CONNECT" set authname MyName set authkey \"!/bin/cat /home/pass\" set ifaddr 127.1.1.1/0 127.2.2.2/0 255.255.255.0 I whish to save my password in /home/pass file, so when a dial up is made passowrd is read from /home/pass. This is what manual says: If the first character of value is an exclamation mark (``!''), ppp treats the remainder of the string as a program that must be executed to determine the ``authname'' and ``authkey'' values. The version I run is "PPP Version 2.3.3" I couldn't make it works. Did anybody try it? Thanks Leo
    [ Add a Reply to this ]
    Re: HOWTO: Connect to the internet with ppp
    by Leo on Wednesday May 07, @11:02AM

    I'm sorry because the struct in previous mail. Here is the same readable.

    Hi,

    I saw your examples and are very good. But, I could need if somebody tested ppp in auto mode asking for a passowrd to user. This is wat I'm trying to do:

    in ppp.conf file leo:

    set phone "123456" set device /dev/cuaa1 set speed 19200 set dial "ABORT BUSY ABORT NO\\sCARRIER TIMEOUT 15 \ \"\" AT OK-AT-OK ATE1Q0 OK \\dATDT\\T TIMEOUT 60 CONNECT" set authname MyName set authkey \"!/bin/cat /home/pass\" set ifaddr 127.1.1.1/0 127.2.2.2/0 255.255.255.0

    I whish to save my password in /home/pass file, so when a dial up is made passowrd is read from /home/pass.

    This is what manual says: If the first character of value is an exclamation mark (``!''), ppp treats the remainder of the string as a program that must be executed to determine the ``authname'' and ``authkey'' values.

    The version I run is "PPP Version 2.3.3"

    I couldn't make it works. Did anybody try it?

    Thanks Leo


    [ Add a Reply to this ]
    Re: HOWTO: Connect to the internet with ppp
    by jassim on Tuesday April 19, @07:23PM
    ok fine thx :) but how can I increase or decrease the sound volume for my external modem using ppp (U.S Robotics External 56.K (serial port))
    [ Add a Reply to this ]
    The Fine Print: The following comments are owned by whoever posted them.
    ( Article Reply )

    "You never know how many friends you have until you own a Condo on the beach." -- Jason's Postulate

    Powered by Zope  Powered by Apache  Squishdot Powered
    All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©2001 Jason Neumann.
    [ main | post article | search ]