Grabbing IP and zonename from multiline 'ifconfig' output
Hi There,
I have a Solaris server that has a bunch of zones configured and I am trying to write a script that will take all interfaces other than the loopback ones (e.g. lo0:3 etc) and present them so that I can easily determine the zone that owns the IP
So in the case of the following ifconfg output
I would get something like
Im a little unsure how I would get it to treat each individual block of ifconfig output as a seperate entity as clearly the virtual IP's for the zones are laid out differently by ifconfig than the non zone/main IP's (eg. nxge3) .. youll notice that the ip address line is positioned differently.
I have to capture all valid IPs in the report whether they are linked to a zone or not ..
Any advice or guidance on what would be a good starting point for me would be greatly appreciated, as im not really sure how to tackle this one
I asked a similar question earlier and got a very good answer but a new doubt came up. This is a few lines of a '/sbin/ifconfig' command on my PC:
RX packets:3781025 errors:0 dropped:0 overruns:0 frame:0
TX packets:1941909 errors:0 dropped:0 overruns:0 carrier:0
Does the RX and TX packets... (1 Reply)
I'm trying to install the recommended patch cluster on a x86 Solaris 10 box.
I get this error:
ERROR: /sbin/zonename cannot be found. install_cluster for 10_x86 patch cluster not applied. Exiting.
I tried touching the file and it gave a different error of: expected argument..
anyone... (1 Reply)
I am executing a stored proc and sending the results in a log file. I then want to grab one result from the output parameters (bolded below, 2) so that I can store it in a variable which will then be called in another script. There are more details that get printed in the beginning of the log file,... (3 Replies)
Hi -
Trying to understand a few things from an ifconfig -a output - can't seem to find info anywhere on the net.
Specifically - looking to understand the following:
Flags=8863
Smart
Running (is this the same as UP)
Simplex
inet6
supported media: autoselect - does that imply the... (1 Reply)
Hi,
I wish to format the output of a grep command in such a way that sed will be able to handle the newline characters held in the output.
Since sed does not allow newlines to be contained in a replacement pattern, that means adding a backslash '\' character to the end of each line from... (8 Replies)
Hi all,
Very new to shell scripting so appreciate some help!
There is a process count that I need to monitor, I have the AIX command that gives this value and I've cleaned it up with grep/awk so it only spits out the value I'm interested in:
echo "psc -i 10050 -s RELOAD_SERVICE" | tmadmin... (14 Replies)
I'm trying to gather information on the interfaces on a large number of servers.
If I run ifconfig I will get: eth0 Link encap:Ethernet HWaddr 00:50:56:A2:27:C1
inet addr:10.145.xxx.xxx Bcast:10.152.45.255 Mask:255.255.254.0
-----
eth1 Link... (2 Replies)
Hi,
I have created a bonding bond1 interface with 6 Eth , mode=4. Recently i have changed my old ipv6 to new one and tried to restart as well as reload network service. Post which i can see old as well as changed ipv6 in ifconfig command output. Below are few files and command output for your... (1 Reply)
Dear all,
I have below "ldapsearch" output
$ ldapsearch -D "CN=SVC-ACCOUNT,OU=SVC,OU=VDSI,OU=Non-Human,DC=Org,DC=com" -w secretword -H ldaps://org.com:636 -b DC=Org,DC=com -s sub uid=v00000 "(filter)" "displayName" "uid" "street"
# extended LDIF
#
# LDAPv3
# base <DC=Org,DC=com> with... (7 Replies)
Discussion started by: baluchen
7 Replies
LEARN ABOUT DEBIAN
io::interface::simple
Interface::Simple(3pm) User Contributed Perl Documentation Interface::Simple(3pm)NAME
IO::Interface::Simple - Perl extension for access to network card configuration information
SYNOPSIS
use IO::Interface::Simple;
my $if1 = IO::Interface::Simple->new('eth0');
my $if2 = IO::Interface::Simple->new_from_address('127.0.0.1');
my $if3 = IO::Interface::Simple->new_from_index(1);
my @interfaces = IO::Interface::Simple->interfaces;
for my $if (@interfaces) {
print "interface = $if
";
print "addr = ",$if->address,"
",
"broadcast = ",$if->broadcast,"
",
"netmask = ",$if->netmask,"
",
"dstaddr = ",$if->dstaddr,"
",
"hwaddr = ",$if->hwaddr,"
",
"mtu = ",$if->mtu,"
",
"metric = ",$if->metric,"
",
"index = ",$if->index,"
";
print "is running
" if $if->is_running;
print "is broadcast
" if $if->is_broadcast;
print "is p-to-p
" if $if->is_pt2pt;
print "is loopback
" if $if->is_loopback;
print "is promiscuous
" if $if->is_promiscuous;
print "is multicast
" if $if->is_multicast;
print "is notrailers
" if $if->is_notrailers;
print "is noarp
" if $if->is_noarp;
}
DESCRIPTION
IO::Interface::Simple allows you to interrogate and change network interfaces. It has overlapping functionality with Net::Interface, but
might compile and run on more platforms.
Class Methods
$interface = IO::Interface::Simple->new('eth0')
Given an interface name, new() creates an interface object.
@iflist = IO::Interface::Simple->interfaces;
Returns a list of active interface objects.
$interface = IO::Interface::Simple->new_from_address('192.168.0.1')
Returns the interface object corresponding to the given address.
$interface = IO::Interface::Simple->new_from_index(2)
Returns the interface object corresponding to the given numeric index. This is only supported on BSD-ish platforms.
Object Methods
$name = $interface->name
Get the name of the interface. The interface object is also overloaded so that if you use it in a string context it is the same as
calling name().
$index = $interface->index
Get the index of the interface. This is only supported on BSD-like platforms.
$addr = $interface->address([$newaddr])
Get or set the interface's address.
$addr = $interface->broadcast([$newaddr])
Get or set the interface's broadcast address.
$addr = $interface->netmask([$newmask])
Get or set the interface's netmask.
$addr = $interface->hwaddr([$newaddr])
Get or set the interface's hardware address.
$addr = $interface->mtu([$newmtu])
Get or set the interface's MTU.
$addr = $interface->metric([$newmetric])
Get or set the interface's metric.
$flags = $interface->flags([$newflags])
Get or set the interface's flags. These can be ANDed with the IFF constants exported by IO::Interface or Net::Interface in order to
interrogate the state and capabilities of the interface. However, it is probably more convenient to use the broken-out methods listed
below.
$flag = $interface->is_running([$newflag])
$flag = $interface->is_broadcast([$newflag])
$flag = $interface->is_pt2pt([$newflag])
$flag = $interface->is_loopback([$newflag])
$flag = $interface->is_promiscuous([$newflag])
$flag = $interface->is_multicast([$newflag])
$flag = $interface->is_notrailers([$newflag])
$flag = $interface->is_noarp([$newflag])
Get or set the corresponding configuration parameters. Note that the operating system may not let you set some of these.
AUTHOR
Lincoln Stein <lstein@cshl.org>
This module is distributed under the same license as Perl itself.
SEE ALSO
perl, IO::Socket, IO::Multicast), IO::Interface, Net::Interface
perl v5.14.2 2007-01-22 Interface::Simple(3pm)