pppoe configuration and dns name resolution

Jack jacks.1785 at gmail.com
Sun Oct 21 11:42:00 UTC 2012


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


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

#ifconfig_fxp0="inet netmask"

# 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.

# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable



## /etc/ppp/ppp.conf:

 set log Phase tun command

 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

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

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


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

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


 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.


More information about the freebsd-questions mailing list