Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora User (http://www.linux-archive.org/fedora-user/)
-   -   confusion on /sbin/ifconfig on F16 (http://www.linux-archive.org/fedora-user/669895-confusion-sbin-ifconfig-f16.html)

Paul Allen Newell 05-23-2012 03:12 AM

confusion on /sbin/ifconfig on F16
 
Hello:

As I continue dealing with iptables, another issue has come up that I
can't tell is a mis-understanding on my part or a potential problem


I have three F16 machines, one x86_64 and two i383/686. If I run
/sbin/ifconfig on them, I get (short summary of):


x86_64: eth0
i686: em1

Looking in /etc/sysconfig/network-scripts, I can see only ifcfg-em1 and
no ifcfg-eth0 on all the machines (x86_64 and i686).


The closest bugzilla I can see if 784314 but it looks like it hints that
ifconfig is old-school and the right way to do things (and its F17 not F16).


Does anyone know what I am either doing wrong or if this looks like a
problem/bug. Plus, if there is a better way, I'd love to know.


What I want to do is have is a bash way to get the static ip address of
the machine which I can see in eth0/em1. I've been using something I
found online which assumes everything is eth0 (as in I think it was for
older Fedora):

+++
/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
+++

Its too clever for me to have come up with on my own (smile).

I tried expanding the grep to be 'inet addr:192.168.2' but that failed
on the laptop which has an entry for wireless which is dhcp (I cannot
assume wireless will be 192.168.2.*).


Any suggestions appreciated,
Thanks,
Paul
--
users mailing list
users@lists.fedoraproject.org
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

Paul Allen Newell 05-23-2012 03:22 AM

confusion on /sbin/ifconfig on F16
 
[updated, keeping original post and adding new info at bottom]

On 5/22/2012 8:12 PM, Paul Allen Newell wrote:

Hello:

As I continue dealing with iptables, another issue has come up that I
can't tell is a mis-understanding on my part or a potential problem


I have three F16 machines, one x86_64 and two i383/686. If I run
/sbin/ifconfig on them, I get (short summary of):


x86_64: eth0
i686: em1

Looking in /etc/sysconfig/network-scripts, I can see only ifcfg-em1
and no ifcfg-eth0 on all the machines (x86_64 and i686).


The closest bugzilla I can see if 784314 but it looks like it hints
that ifconfig is old-school and the right way to do things (and its
F17 not F16).


Does anyone know what I am either doing wrong or if this looks like a
problem/bug. Plus, if there is a better way, I'd love to know.


What I want to do is have is a bash way to get the static ip address
of the machine which I can see in eth0/em1. I've been using something
I found online which assumes everything is eth0 (as in I think it was
for older Fedora):

+++
/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
+++

Its too clever for me to have come up with on my own (smile).

I tried expanding the grep to be 'inet addr:192.168.2' but that failed
on the laptop which has an entry for wireless which is dhcp (I cannot
assume wireless will be 192.168.2.*).


Any suggestions appreciated,
Thanks,
Paul


Okay, so I managed to figure out that 'ip' is the new command. I'd
looked at it earlier to try to find a way around this, but couldn't
figure it out. Just spotted the 'obsolete, use ip' in man page of
ifconfig. As usual, there is always something discovered right after I
make the post.


Should I assume that even if ifconfig is giving a problem, its academic
and I should just focus on ip. And, if so, how the heck does one get the
ip addr. If I use "ip addr show", I still get eth0 on the x86_64 and em1
on the i686?


Thanks,
Paul

--
users mailing list
users@lists.fedoraproject.org
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

Ed Greshko 05-23-2012 04:38 AM

confusion on /sbin/ifconfig on F16
 
On 05/23/2012 11:22 AM, Paul Allen Newell wrote:
> [updated, keeping original post and adding new info at bottom]
>
> On 5/22/2012 8:12 PM, Paul Allen Newell wrote:
>> Hello:
>>
>> As I continue dealing with iptables, another issue has come up that I can't tell
>> is a mis-understanding on my part or a potential problem
>>
>> I have three F16 machines, one x86_64 and two i383/686. If I run /sbin/ifconfig on
>> them, I get (short summary of):
>>
>> x86_64: eth0
>> i686: em1
>>
>> Looking in /etc/sysconfig/network-scripts, I can see only ifcfg-em1 and no
>> ifcfg-eth0 on all the machines (x86_64 and i686).
>>
>> The closest bugzilla I can see if 784314 but it looks like it hints that ifconfig
>> is old-school and the right way to do things (and its F17 not F16).
>>
>> Does anyone know what I am either doing wrong or if this looks like a problem/bug.
>> Plus, if there is a better way, I'd love to know.
>>
>> What I want to do is have is a bash way to get the static ip address of the
>> machine which I can see in eth0/em1. I've been using something I found online
>> which assumes everything is eth0 (as in I think it was for older Fedora):
>> +++
>> /sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'
>> +++
>>
>> Its too clever for me to have come up with on my own (smile).
>>
>> I tried expanding the grep to be 'inet addr:192.168.2' but that failed on the
>> laptop which has an entry for wireless which is dhcp (I cannot assume wireless
>> will be 192.168.2.*).
>>
>> Any suggestions appreciated,
>> Thanks,
>> Paul
>
> Okay, so I managed to figure out that 'ip' is the new command. I'd looked at it
> earlier to try to find a way around this, but couldn't figure it out. Just spotted
> the 'obsolete, use ip' in man page of ifconfig. As usual, there is always something
> discovered right after I make the post.
>
> Should I assume that even if ifconfig is giving a problem, its academic and I
> should just focus on ip. And, if so, how the heck does one get the ip addr. If I
> use "ip addr show", I still get eth0 on the x86_64 and em1 on the i686?
>

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.


--
Never be afraid to laugh at yourself, after all, you could be missing out on the joke
of the century. -- Dame Edna Everage
--
users mailing list
users@lists.fedoraproject.org
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

Paul Allen Newell 05-23-2012 05:31 AM

confusion on /sbin/ifconfig on F16
 
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@lists.fedoraproject.org
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

Ed Greshko 05-23-2012 05:49 AM

confusion on /sbin/ifconfig on F16
 
On 05/23/2012 01:31 PM, Paul Allen Newell wrote:
> 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.

Well, as you said, things are in transition.... And, if you did some google searches
you'd find that there were/are differences between how interface names appear(ed) at
various points depending on system architecture. That seems to be your main "issue".

All that aside.... If you have a system with a single interface you can always do....

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



--
Never be afraid to laugh at yourself, after all, you could be missing out on the joke
of the century. -- Dame Edna Everage
--
users mailing list
users@lists.fedoraproject.org
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

Paul Allen Newell 05-23-2012 06:17 AM

confusion on /sbin/ifconfig on F16
 
On 5/22/2012 10:49 PM, Ed Greshko wrote:

Well, as you said, things are in transition.... And, if you did some google searches
you'd find that there were/are differences between how interface names appear(ed) at
various points depending on system architecture. That seems to be your main "issue".

All that aside.... If you have a system with a single interface you can always do....

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



Ed:

With all due respect, its become clear to me that ifconfig is obsolete
and a solution which uses it doesn't have a future. Can you try to get
the ip address with command "ip" on a i686 and x86_64 system without
having to run a different command for each?


As for the "issue", I am still hoping someone can tell me that "ip addr
show" giving a different device for the static IP on x86_64 and i686 is
"not right" so I can bug it with confidence that I am not making a
mistake (or let me know that I am making a mistake ... with enough info
that I can confirm it is a pilot error)


Thanks,
Paul


--
users mailing list
users@lists.fedoraproject.org
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

Ed Greshko 05-23-2012 06:33 AM

confusion on /sbin/ifconfig on F16
 
On 05/23/2012 02:17 PM, Paul Allen Newell wrote:
> On 5/22/2012 10:49 PM, Ed Greshko wrote:
>> Well, as you said, things are in transition.... And, if you did some google searches
>> you'd find that there were/are differences between how interface names appear(ed) at
>> various points depending on system architecture. That seems to be your main "issue".
>>
>> All that aside.... If you have a system with a single interface you can always
>> do....
>>
>> [egreshko@meimei test]$ /sbin/ifconfig | grep 'inet ' | grep -v '127.0.0.1' | cut -d
>> : -f 2 | awk '{ print $1}'
>> 192.168.0.18
>>
>
> Ed:
>
> With all due respect, its become clear to me that ifconfig is obsolete and a
> solution which uses it doesn't have a future. Can you try to get the ip address
> with command "ip" on a i686 and x86_64 system without having to run a different
> command for each?
>

It will continue to work.... Just not support some new features.

> As for the "issue", I am still hoping someone can tell me that "ip addr show"
> giving a different device for the static IP on x86_64 and i686 is "not right" so I
> can bug it with confidence that I am not making a mistake (or let me know that I am
> making a mistake ... with enough info that I can confirm it is a pilot error)
>

???? The "ip" command has nothing to do with the device/interface name.

It simply lists information on all the interfaces available on the
system...regardless of if they are up/down.... There is no "right" or "wrong".

[egreshko@meimei ~]$ ip addr show
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: p128p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 40:61:86:7c:2b:db brd ff:ff:ff:ff:ff:ff
inet 192.168.0.18/24 brd 192.168.0.255 scope global p128p1
inet6 fe80::4261:86ff:fe7c:2bdb/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 70:1a:04:f4:df:69 brd ff:ff:ff:ff:ff:ff
5: vboxnet0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
link/ether 0a:00:27:00:00:00 brd ff:ff:ff:ff:ff:ff

[egreshko@meimei ~]$ ip addr show dev p128p1
2: p128p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 40:61:86:7c:2b:db brd ff:ff:ff:ff:ff:ff
inet 192.168.0.18/24 brd 192.168.0.255 scope global p128p1
inet6 fe80::4261:86ff:fe7c:2bdb/64 scope link
valid_lft forever preferred_lft forever


Maybe the question you should be asking is this?

I don't like the names that have been assigned to my network interfaces. How can I
change them to be what I want them to be?



--
Never be afraid to laugh at yourself, after all, you could be missing out on the joke
of the century. -- Dame Edna Everage
--
users mailing list
users@lists.fedoraproject.org
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

Paul Allen Newell 05-23-2012 06:46 AM

confusion on /sbin/ifconfig on F16
 
On 5/22/2012 11:33 PM, Ed Greshko wrote:
Maybe the question you should be asking is this? I don't like the
names that have been assigned to my network interfaces. How can I
change them to be what I want them to be?


Ed:

Okay, that's a good question that I hadn't considered. So do you happen
to know how to change the names?


Paul

--
users mailing list
users@lists.fedoraproject.org
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

Ed Greshko 05-23-2012 07:26 AM

confusion on /sbin/ifconfig on F16
 
On 05/23/2012 02:46 PM, Paul Allen Newell wrote:
> Okay, that's a good question that I hadn't considered. So do you happen to know how
> to change the names?

No. Not something that I've needed or wanted to do.

--
Never be afraid to laugh at yourself, after all, you could be missing out on the joke
of the century. -- Dame Edna Everage
--
users mailing list
users@lists.fedoraproject.org
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

Reindl Harald 05-23-2012 08:07 AM

confusion on /sbin/ifconfig on F16
 
Am 23.05.2012 08:17, schrieb Paul Allen Newell:
> With all due respect, its become clear to me that ifconfig is obsolete and a solution which uses it doesn't have a
> future. Can you try to get the ip address with command "ip" on a i686 and x86_64 system without having to run a
> different command for each?
>
> As for the "issue", I am still hoping someone can tell me that "ip addr show" giving a different device for the
> static IP on x86_64 and i686 is "not right" so I can bug it with confidence that I am not making a mistake (or let
> me know that I am making a mistake ... with enough info that I can confirm it is a pilot error)

edit "/etc/udev/rules.d/70-persistent-net.rules" (ONE LINE, replace MAC with yours)

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:bd:00:27", ATTR{dev_id}=="0x0",
ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
__________________________

this has NOTHING to do with i686 / x86_64
http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming

remove the package, edit config as statet above and that was it

--
users mailing list
users@lists.fedoraproject.org
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


All times are GMT. The time now is 05:06 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.