Changing interface names in pppd, where is the ifname option?
Josef Wolf
jw at raven.inka.de
Wed Mar 25 19:50:53 UTC 2009
On Wed, Mar 25, 2009 at 03:50:24PM -0300, Derek Broughton wrote:
> Josef Wolf wrote:
> > So how do I tell udev to name the device based on the provider name?
>
> What do you mean by "provider name"? As I mentioned, it's a looong time
> since I used ppp. How do _you_ know what the provider name is in the first
> place?
Well, it is part of the configuration:
$ perl -ne 'print if /ppp0/../^$/' /etc/network/interfaces
iface ppp0 inet ppp
pre-up ifconfig eth1 up
post-down ifconfig eth1 down
provider TCOM1
$ egrep '(eth|ifname)' /etc/ppp/peers/TCOM1
eth1
# ifname ppp0 # I'd like to have this line here
$
Thus, "ifup ppp0" sees "provider TCOM1" in /etc/network/interfaces.
Therefore it will use /etc/ppp/peers/TCOM1 for the ppp options. Here
it finds that the ADSL line for this peer is connected to eth1. All
is fine up to here. But sometimes this provider is connected to ppp1
or ppp2 or something, although I said "ifup ppp0".
To rename the interface to "tcom1" or something, I would need to find
out to which peer (TCOM1 in this example) it is connected. But I can't
find the relevant information from udev:
$ udevinfo -a -p /sys/class/net/ppp0/
Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.
looking at device '/devices/virtual/net/ppp0':
KERNEL=="ppp0"
SUBSYSTEM=="net"
DRIVER==""
ATTR{addr_len}=="0"
ATTR{dev_id}=="0x0"
ATTR{iflink}=="7"
ATTR{ifindex}=="7"
ATTR{features}=="0x0"
ATTR{type}=="512"
ATTR{link_mode}=="0"
ATTR{address}==""
ATTR{broadcast}==""
ATTR{carrier}=="1"
ATTR{dormant}=="0"
ATTR{operstate}=="unknown"
ATTR{mtu}=="1492"
ATTR{flags}=="0x1091"
ATTR{tx_queue_len}=="3"
looking at parent device '/devices/virtual/net':
KERNELS=="net"
SUBSYSTEMS==""
DRIVERS==""
looking at parent device '/devices/virtual':
KERNELS=="virtual"
SUBSYSTEMS==""
DRIVERS==""
$
More information about the ubuntu-users
mailing list