Re: [UPDATED:] Re: confusion on /sbin/ifconfig on F16

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 5/22/2012 9:38 PM, Ed Greshko wrote:
I guess I really don't know what precisely is the problem you're having.

Interface naming convention has been undergoing changes since, maybe, F14.
Interfaces that were once called eth0 became em1 and other niceties.  I don't recall
if the names changed on upgrades or only new installs.  Anyway, the changes didn't
make my life miserable, so I've kind of ignored the changes.

So, what is it that you are really after?  Do you just want a script, or series of
commands, to return the IP address of a single, known interface?

As in something like this?

[egreshko@meimei net]$ /sbin/ifconfig p128p1 | grep 'inet ' | cut -d : -f 2 | awk '{
print $1}'
192.168.0.18

Maybe if you posted the output of commands on your system and asked questions based
on the output it would make more sense....at least to me.


Ed:

Thanks for reply.

First problem is I think there is something wrong if "ip addr show" lists eth0 on x86_64 and em1 on i686. I know things are in transition, but I would expect that to be on a release by release, not sub-set of platform by platform as it makes scripts that work on one break on the other. I am trying to get some validation that I am not doing something wrong so I can submit as bug

Second problem is, given that, I can't figure out how to get "ip addr show" to work on both platforms. My fault for not including example as I was more focused on the possible bug and thinking I just needed to kick the ip command a few more times.

On x86_64, "ip addr show" gives:
+++

1: lo:<LOOPBACK,UP,LOWER_UP>  mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0:<BROADCAST,MULTICAST,UP,LOWER_UP>  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:1e:68:26:b1:ff brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.13/24 brd 192.168.2.255 scope global eth0
    inet6 fe80::21e:68ff:fe26:b1ff/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0:<BROADCAST,MULTICAST,UP,LOWER_UP>  mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:1f:3a:c1:1c:79 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.103/24 brd 192.168.2.255 scope global wlan0
    inet6 fe80::21f:3aff:fec1:1c79/64 scope link
       valid_lft forever preferred_lft forever
+++

On i686, it gives:
+++
1: lo:<LOOPBACK,UP,LOWER_UP>  mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: em1:<BROADCAST,MULTICAST,UP,LOWER_UP>  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:e0:81:00:4c:b0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.2.10/24 brd 192.168.2.255 scope global em1
    inet6 fe80::2e0:81ff:fe00:4cb0/64 scope link
       valid_lft forever preferred_lft forever
+++

One uses eth0, the other em1.

I tried using the label option with a pattern, but can't figure out how to tell ip to show me any devices that match eth0 or em1. I figured out that I can tell it "label e*" but that feels like a hack since it opens me up to any future names changes that start with an e* without assures that there won't be two "e*" entries on a given machine.

So, I was able to hack up something in which:
+++
theUname=`uname -p`
theDeviceToCheck="eth0"
if [ ${theUname} != "x86_64" ]; then
    theDeviceToCheck="em1"
fi
theIpAddr=`/sbin/ip addr show ${theDeviceToCheck} | grep 'inet ' | awk '{ print $2}'
+++

SO, I am at least running (but with a groan at how)

I'd like a single command with no "if's" (ip or other) that give me 192.168.2.x (I can handle if it has "/24?) on the end.

Paul



--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org


[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux