LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-08-2012, 02:08 PM   #1
donalbane
LQ Newbie
 
Registered: Jan 2011
Location: Austin, TX
Posts: 29

Rep: Reputation: 2
How to enable ping by non-root on non-main routing tables?


I have no default route in the main routing table. I have a separate routing table created for each cellular provider that I use with the default route assigned there. I notice that if I try to execute ping through a specific interface (i.e. "ping -I ppp0 8.8.8.8") as a non-root user, that it attempts to use the main routing table (which then fails with "Network Unreachable"). However, if I run "sudo ping -I ppp0 8.8.8.8", it will correctly use the appropriate default gateway in the provider-specific routing table and work fine.

Can someone tell why the ping uses correct routing table for root, but ping for a non-root user does not?

Thank you,
Don
 
Old 08-09-2012, 10:56 AM   #2
ProtoformX
Member
 
Registered: Feb 2004
Location: Canada
Distribution: LFS SVN
Posts: 334

Rep: Reputation: 33
This is a fairly simple explanation actually,
The user can't touch hardware interfaces (eth0, ppp0..etc) are hardware nodes so of course ping -I ppp0 as a user will fail, you don't have the right to access that interface.

So ping just tries to get out whatever interface is available. (if ppp0 is indeed configured and working then if you wanted to ping through ppp0 try changing the metrics of both interfaces so that ping looks at ppp0 first and not eth0.

Last edited by ProtoformX; 08-09-2012 at 10:58 AM.
 
Old 08-09-2012, 11:48 AM   #3
donalbane
LQ Newbie
 
Registered: Jan 2011
Location: Austin, TX
Posts: 29

Original Poster
Rep: Reputation: 2
Thanks, ProtoformX, for the explanation.

However, I don't think that changing the metrics on the interfaces will solve the problem. If ping DID look for any route available, then "ping 8.8.8.8" would work for the general user when ppp0 is the only interface available. However, that does not happen unless there is a default route through ppp0 in the main routing table. I don't want to have to reconfigure the main routing table everytime the user wants to ping out a particular interface.

Does this mean there isn't a way for a general user to specify the interface to be used?

Don
 
Old 08-09-2012, 12:52 PM   #4
ProtoformX
Member
 
Registered: Feb 2004
Location: Canada
Distribution: LFS SVN
Posts: 334

Rep: Reputation: 33
There is, you need to give them permission to the interface (maybe as part of a group?) but no not directly.
 
Old 08-09-2012, 03:31 PM   #5
donalbane
LQ Newbie
 
Registered: Jan 2011
Location: Austin, TX
Posts: 29

Original Poster
Rep: Reputation: 2
This post

http://serverfault.com/questions/406...r-an-interface

indicates that ping should run as root, if owned by root (mine is). That would seem to make the use of sudo irrelevant, but it's not in my case.

I also looked at the ownership/permissions of the devices that the interfaces are being created on. The devices are created as
crw-rw-rw- root:dialout /dev/ttyUSB#
and the symlinks created for them from the udev rules show up as
lrwxrwxrwx root:root /dev/USBModem#

All users are part of the dialout group. I'm using the symlinks for pppd, but my understanding is that they are passthrough for permissions to the actual devices, so I wouldn't think that root being the group for the symlinks would matter. Strangely, changing the GROUP or MODE in the udev rules has no effect on the group/permissions of the symlinks.

Don

Last edited by donalbane; 08-09-2012 at 03:32 PM.
 
Old 08-15-2012, 02:11 PM   #6
donalbane
LQ Newbie
 
Registered: Jan 2011
Location: Austin, TX
Posts: 29

Original Poster
Rep: Reputation: 2
I've discovered that a non-root user can successfully do:

ping -I <IPaddress> 8.8.8.8

while

ping -I <interface> 8.8.8.8

fails.

So, it doesn't seem to be a permissions issue, but rather something is wrong in the routing table configuration that prevents the interface name from properly being associated with its IP address for non-root users.

Can anyone give me a simple routing table setup procedure for 2 interfaces that will allow "ping -I <interface> 8.8.8.8" to work properly for each interface for a non-root user?

Don
 
  


Reply

Tags
ping, root, routing, tables


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
routing tables props666999 Linux - Networking 1 10-14-2005 08:27 PM
Routing tables TPB Linux - Networking 3 07-27-2005 09:01 PM
IP Routing Tables collern2 Linux - Security 1 05-23-2005 10:48 AM
changing non-main routing tables ? laclac01 Linux - Networking 1 02-20-2004 09:51 AM
routing tables dunkyb Linux - Networking 3 05-25-2003 02:10 PM


All times are GMT -5. The time now is 05:13 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration