Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Oct 2012 17:11:59 +0530
From:      Jack <jacks.1785@gmail.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: pppoe configuration and dns name resolution
Message-ID:  <CACmXQA34wbupfu%2BnxfQ5%2BjBGNoU3h-SmztP4AhLK8bLErmYPug@mail.gmail.com>
In-Reply-To: <20121020080905.27440256.freebsd@edvax.de>
References:  <CACmXQA2z_x1tpm0mm=41OzZa6MKVbn_en2%2Brn2t6q5miZtV4HQ@mail.gmail.com> <CACmXQA3waRyeTNKwcMz8g4QQVp9ZPfwjb81tU5PKqFpn=A9iXA@mail.gmail.com> <20121020080905.27440256.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi

This time I configured as simple as possible
with minimal settings, and voila things worked.
I successfully connected to internet in both
cases - DHCP server disabled in adsl modem, and
DHCP server enabled in adsl modem.

Thanks all  of you guys for helping. :)

Here are config files:

## /etc/rc.config
hostname="jacks_lappy"

ifconfig_fxp0="DHCP"

# The below line is to be used if DHCP server on adsl
# modem is disabled.

#ifconfig_fxp0="inet 192.168.1.4 netmask 255.255.255.0"

# This is assigned to telnet to adsl modem and configure it,
# if you don't wanna communicate with modem, remove
# this line. It doesn't affect ppp connectivity, in any way -
# I tried removing it  and got connected successfully.

sshd_enable="YES"
moused_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"

hald_enable="YES"
dbus_enable="YES"

-----------------------------------------------

## /etc/ppp/ppp.conf:

default:
 set log Phase tun command

adsl:
 set device PPPoE:fxp0

#MRU is optional too, you can remove it
# w/o affecting ppp connectivity.

 set mru 1492
 #set mtu 1492
# This was the cause of failure.
 # See man ppp for more info.
 # If MTU is set, ppp will not accept MRU values less than MTU.
 # e.g. MTU = 1492. Now if your ISP has MTU = 1460(my case), then
 # ppp on your PC, will not connect to ppp server at your ISP side.
 # So DO NOT set MTU explicitly.


 set authname <myusername>
 set authkey <mypassword>	
 set dial
 set login

 add default HISADDR

 enable dns
# a must, if DHCP server is enabled in adsl modem
# and if you don't wanna edit   /etc/resolv.conf
# each time before connecting tp ISP's ppp server.
#Now you don't need to touch /etc/resolv.conf

-----------------------------------------------------------------

My /etc/resolv.conf is updated each time I start
ppp, so I didn't needed to edit it.
I simply started ppp via

ppp -ddial adsl

I also didn't start ppp at bootup, as it requires that
your adsl modem must be powered on before FreeBSD
begins booting, which is not the usual case for me.

Also, as soon as I started ppp, an ip address is assigned to
tun0  interface by ISP, while fxp0 was assigned its ip
address via DHCP server enabled in adsl modem, even before
I attempted to dial ppp. That is expected.

I also tested this configuration with DHCP server disabled
in adsl modem and it too worked successfully, except
I need to chnage the line fxp0="DHCP" to manually assigned
ip address one, no other change was needed.

The problem might be I was I trying to explcitly set MTU
to be 1492, which ppp takes as minimum value - ie no MTU
value less than 1492 is agreed upon by user ppp.

My ISP's MTU was 1460, and since 1460 < 1492, so ppp
was not agreeing upon MTU value and no connection was
made.

Thanks again all  of you guys for sorting this out. :)

Mean while I created a script to start and stop ppp
service for a profile. This script is specifically written for
csh/tcsh shell - the default one for FreeBSD, so some
changes need to be made if it is to be run in other
shells.

Just go to c shell and type
pppdo <profilename> <start | stop>

where 'profilename' is the desired profilename defined in
etc/ppp/ppp.conf, and either you 'start' ppp or 'stop' ppp.


 ------------------------------------------------------------------------------------

Here goes the script:  pppdo.sh

#!/bin/csh

if ( $#argv != 2 ) then
   echo "Usage: $0 <ppp_profile> <start | stop>"
   exit
endif

switch ($2)
	case start:
		/usr/sbin/ppp -ddial $1
		; breaksw
	case stop:
                            killall -INT ppp
		killall -HUP ppp
                            ; breaksw
              default:
                            echo "$0 : Invalid Cmd"
                            ; breaksw
endsw

---------------------------------------------------------------------------------------------

 NOTE: before executing this script make sure it is executable
 If not, type this at shell:
 chmod +x ./pppdo.sh

 After executing this script try pinging to a remote site to confirm
 connectivity, e.g. type this at shell:
 ping -c5 freebsd.org
 If you get 0.0% packet loss, then you made it!


So, the only files that require modifications are
/etc/ppp/ppp.conf   and   /etc/rc.conf

No other file need to be modified to use user ppp,
no matter whether DHCP server on your adsl modem
is enabled or disabled, it doesn't matter - just use the
configuration mention above.

Then use the script as:

./pppdo adsl start

to start the ppp profile named "adsl"(tun0 interface is
created), and use

./pppdo adsl stop
to stop the ppp. This will destroy the tun0 interface too.


 PS: The user account from which this script is to be run, must be a
 member of "network" group too, though "network" group need not to be
 the user's login group. This is the requirement of user ppp itself, and
 not of this script.



Regards
-- 
Jack



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACmXQA34wbupfu%2BnxfQ5%2BjBGNoU3h-SmztP4AhLK8bLErmYPug>