LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-07-2007, 04:54 AM   #1
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Rep: Reputation: 32
Angry Problem with 'route' on temporary dialup connection


Hi there, normally I access the internet via ADSL. Due to a mixup by my ISP, broadband has been cut off, and while I'm waiting for it to be restored they've provided a free dialup connection. I managed to get the dialup modem working (which was a saga in itself), but there is a complication: since the computer the modem is in is normally on a LAN and connects via an external modem router, the default route is through the ethernet connection gateway. This means that when I connect via dialup, networking programs are unable to find their way out of the local net.

To fix the problem, after the connection is established, I run 'route add default ppp0' to add the dialup connection as the default for IP connections. This works fine for me, but the computer has a number of other users. A lot of these people are non tech-savvy and consequently don't know how to use the command line, and don't have access to root privileges (I'm using Ubuntu so this is done via sudo).

Since the net interface ppp0 doesn't exist until the dialup connection is established, I can't just put the command 'route add default ppp0' in the boot sequence. I'm not willing to make the boot sequence open the dialup connection automatically (and then fix the route), because doing so obviously ties up the phone line, which is needed for calls (not to mention problems with making sure the connection is established before setting the route)!

In order to make it possible for other people to use the dialup, I tried making a script, which looked like this:
Code:
#!/bin/sh
route add default ppp0
I set the owner of the script to root, and turned on the sticky bit, which I *thought* would enable the script to be run by other users, while taking on root privileges, therefore allowing the command to run. However, when I try running this script I get a "SIOCADDRT: Operation not permitted" error, the same as if an unprivileged user tries to run route.

I guess one way of getting round the problem would be to temporarily set the sticky bit on route (right?), but there must be a more elegant way. Can anyone suggest one?

This problem isn't massively important, broadband should be back in a few days, but it would stop people bugging me about it, and also I'm always keen to learn more about what I'm doing...

Thanks!
 
Old 06-07-2007, 07:00 AM   #2
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
It's not the sticky bit you are thinking of, but the setuid bit, which would cause the script to run with the permissions of root. But setting that bit should only be done as a last resort, especially on a script.

I'm not sure about Ubuntu, but Mandriva starts up PPP with the script /etc/sysconfig/network-scripts/ifup-ppp.

When the connection is made, the default route is automatically added unless there is a line in the file /etc/sysconfig/network-scripts/ifcfg-ppp0. The line is "DEFROUTE=no".

If you find the equivalent Ubuntu file and that line is present, delete or comment it and the default should be automatically added when the connection is established. And the old default will be restored when the connection is torn down.

If that doesn't work, trace backwards from system script /sbin/ifup to find a place to add a local configuration line.
 
Old 06-07-2007, 08:04 AM   #3
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Original Poster
Rep: Reputation: 32
Hi Ken, thanks for that. Not sure why I said the sticky bit, since it was definitely the setuid bit that was set (chmod 4755 script_name). It turns out that Ubuntu ignores the setuid bit on scripts for security reasons, which would explain why my script didn't work. After some hunting around, I think that editing /etc/ppp/peers/<connection_name> to include the options "defaultroute" and "replacedefaultroute" should fix things. At the moment I'm at work, not at home, so can't test it, but when I get back later I'll have a go and report back. Thanks for your hints so far!
 
Old 06-11-2007, 08:46 AM   #4
Gethyn
Member
 
Registered: Aug 2003
Location: UK
Distribution: (X)Ubuntu 10.04/10.10, Debian 5, CentOS 5
Posts: 900

Original Poster
Rep: Reputation: 32
Just in case this helps other people in future: I connected using kppp. Adding the lines 'defaultroute' and 'replacedefaultroute' to the file /etc/ppp/peers/kppp-options fixed the problem. If you use a different program such as wvdial or gnome-ppp, you'd need to add the options to a different file, but they all seem to be kept in /etc/ppp/peers.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
I need help with a dialup connection tcon50 SUSE / openSUSE 1 11-24-2006 04:15 PM
Suse 10.1 DialUp connection problem manosspy Linux - Newbie 1 06-22-2006 02:35 PM
DialUp Internet Connection Problem lenson Linux - Newbie 3 08-25-2005 02:21 AM
need to setup router to share and route dialup connection Insurr3cti0n Linux - Networking 2 11-18-2003 12:32 AM
Route dialup modem packets back through dialup instead of default route cable modem jogress Linux - Networking 1 10-21-2003 03:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:16 AM.

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