LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Identify eth interface used by each pppoe link (https://www.linuxquestions.org/questions/linux-networking-3/identify-eth-interface-used-by-each-pppoe-link-528962/)

noisebleed 02-14-2007 07:50 AM

Identify eth interface used by each pppoe link
 
Hi! This is my first post :cool:

I'm developing a C API for gathering network info from my home made router (3 WAN + 1 LAN).

My ISPs provide connection through PPPoE and DHCP.

For each ppp connection i need to identify the ethernet interface used. Is it possible?


I'm using Gentoo 2006.1 with kernel 2.6.17-gentoo-r8 and my pppoe client is rp-pppoe.

I'll post more info if requested.

Thanks in advance.

win32sux 02-16-2007 04:38 AM

couldn't you identify them by MAC address??

noisebleed 02-16-2007 06:08 PM

Thanks for your reply :)

It sounds like a good idea, but it seems i'm lacking the hw address on ppp interfaces.

Does ppp links have hw addresses like 'real' interfaces (eth)?


This is what one of my ppp interfaces looks like:

Code:

porteiro ~ # ip link l ppp0
71: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,10000> mtu 1492 qdisc htb qlen 3
    link/ppp

And this is my eth0 interface:

Code:

porteiro ~ # ip link l eth0
1: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:80:c8:f8:45:1f brd ff:ff:ff:ff:ff:ff

As you can see no mac address on ppp.

Do you have hw address on ppp links?

I can't really find info on how to do this.

win32sux 02-16-2007 09:06 PM

Quote:

Originally Posted by noisebleed
Do you have hw address on ppp links?

not really... the mac address concept is for ethernet... but since you are doing PPPoE i figured you might somehow be able to extract the MAC from the ethernet frames which your PPP streams are getting encapsulated in... i'm not sure how to do that, and i would actually be surprised if there wasn't some other way to do what you want... what does your /etc/network/interfaces file (or equivalent) look like??

noisebleed 02-17-2007 10:34 AM

The equivalent is /etc/conf.d/net, which I configured like this:
Code:

config_eth0=( "null" )
config_eth1=( "null" )
config_eth2=( "null" )
config_eth3=( "null" )

Nothing is done here because I've made my own init script where I start all my services and network interfaces. Somewhere in the file I have:
Code:

for interface in $INTERFACES; do
  /etc/myrouter/conf/init.${interface}
done

And for instance, on init.eth0, I could have:
Code:

/usr/sbin/pppoe-start pppoe_eth0.conf
and so on.

So, after the init script I could have this association:
ppp0 -> eth0
eth1 -> eth1
ppp1 -> eth2

Due to instability, ppp links go down, and when they return the association could look like this:
ppp1 -> eth0
eth1 -> eth1
ppp0 -> eth2

And this is a problem to me :scratch:

Is there a way to ask the kernel for this?nelink sockets?

I've already looked at /proc/sys/net/ipv4/conf/ppp*/ but I couldn't extract nothing useful.

UhhMaybe 04-16-2007 06:30 PM

Are YOU able to output the complete hardware listing of YOUR system? One that shows all YOUR devices and the associated IRQ's. Try using "lspci" "lsusb" and "modprobe". Gentoo has specific applications, but something like "Ethtool" may be the way to proceed. On my system, I can use Yast to "see" all the items, line by line. Also, try "ifconfig" for the current output. Good luck.

noisebleed 04-19-2007 04:59 AM

Hi. thanks for the reply.

After a long search I found a way to solve my problem. It's not pretty :) but it works.

I've changed the way pppd names it's pids when called by pppoe. Now the pid name has the ethernet name appended. Because each pid file has inside the name of the ppp link I can now associate Ethernet interface and PPP link. Great!

Of course I would like to do this differently. Maybe asking the kernel for this. But I never found how do it so I'm using this pid's trick.


All times are GMT -5. The time now is 10:50 PM.