LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-12-2009, 08:22 AM   #1
shree_gn
LQ Newbie
 
Registered: Jul 2009
Posts: 1

Rep: Reputation: 0
Cool Configuring BSNL broadband connection


Hi all,
I am Ganesh Nandanwar. I am new to linux. I want to ask that How to configure BSNL broadband connection through command line.
 
Old 07-12-2009, 08:36 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Hello Ganesh

Help us to help you by telling us what ADSL modem you are using and which Linux you use.

Best

Charles
 
Old 07-12-2009, 10:10 AM   #3
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 440

Rep: Reputation: 32
Here's an exhaustive write-up on how to configure BSNL Broadband by Giridhar. I found it very useful, hope it helps you. Really, there isn't much to it.

http://appaji.net/get/dataone/bdah.html
 
Old 07-12-2009, 10:50 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by adityavpratap View Post
Here's an exhaustive write-up on how to configure BSNL Broadband by Giridhar. I found it very useful, hope it helps you. Really, there isn't much to it.

http://appaji.net/get/dataone/bdah.html
Very nice write up but a little out of date, at least on DNS servers. Not surprising, the last revision was January 2007.

Maybe this is a good time to share about BSNL's DNS servers. The problem is inconsistency; the servers come and go and, even while they are there, their ranking by time-to-resolve varies a lot. Most people I know give up on BSNL's DNS servers and configure OpenDNS servers instead. They're not as quick as BSNL's best and they deliver naff advertising when they can't resolve a name but they are consistent. "Configure and forget" is very attractive for the busy sysadmin.

Me, I keep half an eye on how long Firefox says "Looking up ..." and when it takes long I run this little script and edit /etc/resolv.conf accordingly. The script includes a list of all the BSNL and OpenDNS DNS servers' IP addresses I've found:
Code:
#! /bin/bash

set -o posix
set -o nounset
shopt -s extglob # allow extended pattern matching operators 

# Executables
# ~~~~~~~~~~~
# So can change to suit OS variant
nslookup='/usr/bin/nslookup'
sort='/usr/bin/sort'

#--------------------------
# Name: test_servers
# Purpose: tests response times of list of servers
# $1 - list of servers
# $2 - results heading
#--------------------------
function test_servers {

	local oIFS out secs server

	out=''
	for server in $1
	do
		echo -n '.'
		# DEVELOPMENT NOTE: -timeout=5 in command below does not seem to be effective; default 15 timeout operates
		secs="$(/usr/bin/time -f '%e' $nslookup '-timeout=5' 'www.google.com' $server 2>&1 1>/dev/null)"
		out="$out
	$secs $server"
	done
	
	out="$(echo "$out" | $sort --general-numeric-sort)"
	
	echo
	echo "$2"
	oIFS="$IFS"
	IFS='
	'
	for buf in $out
	do
		IFS="$oIFS"
		IP_address="${buf#* }"
		response_time="${buf% *}"
		if [[ ${response_time%.*} -lt 5 ]]; then
			response_time="$response_time seconds"
		else
			response_time='Timed out'
		fi
		printf '%16s  %s\n' "$IP_address" "$response_time"
	done


	return 0

}  # end of function test_servers

BSNL_servers='
61.1.96.69
61.1.96.71
61.1.96.72
218.248.240.23
218.248.240.135
218.248.240.208
218.248.240.180
218.248.255.145
'

#echo 'DEBUG: setting small BSNL DNS server list'
#BSNL_servers='
#218.248.240.23
#218.248.240.208
#'

OpenDNS_servers='
208.67.222.222
208.67.220.220
'

test_servers "$BSNL_servers" 'Known BSNL DNS servers with query response times'
test_servers "$OpenDNS_servers" 'Known OpenDNS servers with query response times'

echo '
Here'"'"'s the current /etc/resolv.conf:'
cat '/etc/resolv.conf'
\exit 0
Best

Charles
 
Old 07-13-2009, 10:54 AM   #5
adityavpratap
Member
 
Registered: Dec 2004
Location: Hyderabad, India
Distribution: Slackware 13, Ubuntu 12.04
Posts: 440

Rep: Reputation: 32
Nifty piece of scripting! Even I didn't know about the new BSNL DNS servers. I hope I can use it. How about 4.2.2.2?

Last edited by adityavpratap; 07-13-2009 at 11:00 AM.
 
Old 07-13-2009, 12:03 PM   #6
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Thanks adityavpratap Scripting's what I do best (better than laundry and stuff).

All those servers worked at one time in the last 12 months; some of them may no longer exist.

4.2.2.[1-4] are Level3 DNS servers so not as fast as BSNL's at best. Response time on par with OpenDNS as shown below (quick and dirty hack: I added it to the list of BSNL servers). Maybe a good alternative to OpenDNS but I have no experience of using them.
Code:
Known BSNL DNS servers with query response times
 218.248.255.145  0.06 seconds
  218.248.240.23  0.07 seconds
 218.248.240.180  0.08 seconds
 218.248.240.208  0.08 seconds
         4.2.2.2  0.33 seconds
      61.1.96.71  0.85 seconds
      61.1.96.69  1.43 seconds
 218.248.240.135  Timed out
      61.1.96.72  Timed out
..
Known OpenDNS servers with query response times
  208.67.222.222  0.30 seconds
  208.67.220.220  0.31 seconds
Best

Charles
 
Old 07-23-2009, 03:14 AM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Update on DNS servers to use with BSNL

Hello

Here's an update on DNS servers to use with BSNL.

Incidentally, a useful technique for use with BSNL's DNS servers on systems using /etc/resolv.conf is to use timeout:1. This will change the time the system waits to get an answer from a server that is not responding from the default 3 seconds to 1 second. The system will use a maximum of 3 DNS servers listed in /etc/resolv.conf (any more are silently ignored). See the resolv.conf man page for more information.

It may also be useful to cache DNS information from recent resolutions locally. I will experiment with this and report back.

Four things have changed
  1. BSNL advise configuring different DNS servers depending on the ADSL modem used. Sorry -- I do not have a reference to the source of this information and do not know the technical basis for it.
    Old equipment (HUAWEI)
    218.248.240.181
    218.248.240.180

    New equipment (Multiplay)
    218.248.255.146
    218.248.255.139
  2. OpenDNS servers sometimes don't work on BSNL, reason unknown; some say BSNL block them.
  3. More BSNL DNS servers (list updated in script below).
  4. Level3 DNS servers are sometimes faster than OpenDNS servers (so added to updated script below).

Here's the current response times seen from my system
Code:
Known BSNL DNS servers with query response times
  218.248.240.23  0.06 seconds
 218.248.240.208  0.07 seconds
 218.248.240.135  0.08 seconds
 218.248.255.146  0.18 seconds
 218.248.240.180  0.21 seconds
 218.248.255.139  0.23 seconds
 218.248.240.181  0.62 seconds
      61.1.96.71  1.55 seconds
 218.248.255.145  Timed out
      61.1.96.72  Timed out
      61.1.96.69  Timed out

Known OpenDNS servers with query response times
  208.67.220.220  0.38 seconds
  208.67.222.222  0.38 seconds

Known Level3 servers with query response times
         4.2.2.3  0.25 seconds
         4.2.2.2  0.26 seconds
         4.2.2.4  0.50 seconds
         4.2.2.1  0.51 seconds
I'm connected via a HUAWEI modem. One of the servers recommended for Multiplay modems is faster than both recommended for HUAWEI. When I tested yesterday, both Multiplay servers were faster than both HUAWEI servers!

Here's the updated script
Code:
#! /bin/bash

set -o posix
set -o nounset
shopt -s extglob # allow extended pattern matching operators 

# Executables
# ~~~~~~~~~~~
# So can change to suit OS variant
nslookup='/usr/bin/nslookup'
sort='/usr/bin/sort'

#--------------------------
# Name: test_servers
# Purpose: tests response times of list of servers
# $1 - list of servers
# $2 - results heading
#--------------------------
function test_servers {

	local oIFS out secs server

	out=''
	for server in $1
	do
		echo -n '.'
		# DEVELOPMENT NOTE: -timeout=5 in command below does not seem to be effective; default 15 timeout operates
		secs="$(/usr/bin/time -f '%e' $nslookup '-timeout=5' 'www.google.com' $server 2>&1 1>/dev/null)"
		out="$out
	$secs $server"
	done
	
	out="$(echo "$out" | $sort --general-numeric-sort)"
	
	echo
	echo "$2"
	oIFS="$IFS"
	IFS='
	'
	for buf in $out
	do
		IFS="$oIFS"
		IP_address="${buf#* }"
		response_time="${buf% *}"
		if [[ ${response_time%.*} -lt 5 ]]; then
			response_time="$response_time seconds"
		else
			response_time='Timed out'
		fi
		printf '%16s  %s\n' "$IP_address" "$response_time"
	done


	return 0

}  # end of function test_servers

BSNL_servers='
61.1.96.69
61.1.96.71
61.1.96.72
218.248.240.23
218.248.240.135
218.248.240.180
218.248.240.181
218.248.240.208
218.248.255.139
218.248.255.145
218.248.255.146
'

#echo 'DEBUG: setting small BSNL DNS server list'
#BSNL_servers='
#218.248.240.23
#218.248.240.208
#'

OpenDNS_servers='
208.67.222.222
208.67.220.220
'

Level3_servers='
4.2.2.1
4.2.2.2
4.2.2.3
4.2.2.4
'

test_servers "$BSNL_servers" 'Known BSNL DNS servers with query response times'
test_servers "$OpenDNS_servers" 'Known OpenDNS servers with query response times'
test_servers "$Level3_servers" 'Known Level3 servers with query response times'

echo '
Here'"'"'s the current /etc/resolv.conf:'
cat '/etc/resolv.conf'
\exit 0
Best

Charles
 
Old 09-09-2009, 03:31 PM   #8
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
A better solution is to use dnsmasq. Install, configure and forget. No more scripts to query the BSNL DNS servers and then update /etc/resolv.conf.

dnsmasq FAQ: here.

dnsmasq configuration: edit /etc/dnsmasq.conf ensuring
Code:
resolv-file=/etc/resolv.dnsmasq.conf 
listen-address=127.0.1
Create /etc/resolv.dnsmasq.conf with all the known BSNL DNS servers:
Code:
# Override default 5 second timeout because BSNL DNS servers often out of service 
timeout:1    <== EDIT: this syntax is wrong!  Should be options timeout:1 
# List all known BSNL DNS servers.  dnsmasq will discover the best and use them 
nameserver 61.1.96.69 
nameserver 61.1.96.71 
nameserver 61.1.96.72 
nameserver 218.248.240.23 
nameserver 218.248.240.135 
nameserver 218.248.240.180 
nameserver 218.248.240.181 
nameserver 218.248.240.208 
nameserver 218.248.255.139 
nameserver 218.248.255.145 
nameserver 218.248.255.146
Edit /etc/resolv.conf to include 127.0.0.1. Here's mine
Code:
# Override default 5 second timeout because BSNL DNS servers often out of service 
timeout:1    <== EDIT: this syntax is wrong!  Should be options timeout:1  
# Only 3 nameservers are used (see man page). 
nameserver 127.0.0.1 
nameserver 218.248.240.23 
nameserver 218.248.240.208
As long as dnsmasq is working OK the ones after 127.0.0.1 are not used.

If you want to see what dnsmasq is doing, add this line to /etc/dnsmasq.conf
Code:
log-queries
and see /var/log/daemon.log. Warning: lots of logging!

To get dnsmasq to restart, so it re-reads its configuration files:
Code:
/etc/init.d/dnsmasq restart
If you want to see which DNS servers dnsmasq is using:
Code:
grep /var/log/debug forwarded

Last edited by catkin; 12-21-2009 at 11:03 AM. Reason: timeout:1 syntax correction as noted by EDIT
 
  


Reply

Tags
broadband, connections



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to configure bsnl broadband connection in fedora 7 bhavanipraveen Linux - Networking 4 04-28-2011 04:03 AM
how to make broadband (bsnl) connection on Suse linux? sakshi Linux - Newbie 5 02-15-2009 10:11 AM
BSNL Broadband Fedora 4 How ?? Abhishek14 Linux - Networking 12 11-01-2007 03:53 PM
BSNL Broadband setup prashullegaddi Linux - Networking 0 10-02-2007 09:14 AM
broadband BSNL NeoMagic Linux - Wireless Networking 0 09-25-2006 01:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration