- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Method to obtain count of physical interfaces
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2004 01:09 AM
12-10-2004 01:09 AM
Method to obtain count of physical interfaces
I am able to get information of an interface using /dev/dlpi and get_physical_stat. However I am not able to programatically find the no. of (total count of) physical interfaces on a system.
ID_ifNumber returns 4; but I have only 2 interfaces configured and hence it
should return 3(including loopback)
# netstat -in
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs
Coll
lan0:1 1500 10.0.0.0 10.0.0.1 0 0 0 0 0
lan1 1500 192.168.76.0 192.168.79.233 15528 0 190913 0 0
lan0:2 1500 10.0.0.0 10.0.0.2 36 0 72 0 0
lan0 1500 192.168.76.0 192.168.79.11 3997775 62 1066618 0 0
lo0 4136 127.0.0.0 127.0.0.1 1784 0 1784 0 0
# cat /etc/rc.config.d/netconf
INTERFACE_NAME[0]="lan0"
IP_ADDRESS[0]="192.168.79.11"
SUBNET_MASK[0]="255.255.252.0"
BROADCAST_ADDRESS[0]=""
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0
IP_ADDRESS[1]=192.168.79.233
SUBNET_MASK[1]=255.255.252.0
INTERFACE_NAME[1]=lan1
BROADCAST_ADDRESS[1]=192.168.79.255
INTERFACE_STATE[1]=up
What does 4 indicate?. Is there a way to programatically obtain the count of
physical interfaces configured on a system where multiple ip addresses are configured
on an interface.
Thanks and Regards,
M Shetty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2004 01:12 AM
12-10-2004 01:12 AM
Re: Method to obtain count of physical interfaces
I would go with lanscan :)
HTH,
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2004 01:24 AM
12-10-2004 01:24 AM
Re: Method to obtain count of physical interfaces
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2004 01:24 AM
12-10-2004 01:24 AM
Re: Method to obtain count of physical interfaces
Will list the interfaces. You cn manipulate this to get a count.
number=$(lanscan | grep -v Hardware | grep -v State | wc -l)
echo "NIC cards: $number"
That gets you a good count.
The last iten on the netstat is your loopback. Its needed for networking to work properly.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2004 01:29 AM
12-10-2004 01:29 AM
Re: Method to obtain count of physical interfaces
Instead use:
ioscan -kfnC lan
Why - if you've APA - it will not tell you how may physical NICs are in that APA aggregate:
# lanscan
Hardware Station Crd Hdw Net-Interface NM MAC HP-DLPI DLPI
Path Address In# State NamePPA ID Type Support Mjr#
0/0/0/0 0x00306E2CC6EF 0 UP lan0 snap0 1 ETHER Yes 119
0/5/0/0 0x0060B05846D2 1 UP lan1 3 FDDI Yes 119
1/10/0/0 0x00306EF23A17 4 UP lan4 snap4 6 ETHER Yes 119
LinkAgg0 0x00306EF23A2C 900 UP lan900 snap900 9 ETHER Yes 119
LinkAgg1 0x00306E0ED6B9 901 UP lan901 snap901 10 ETHER Yes 119
LinkAgg2 0x000000000000 902 DOWN lan902 snap902 11 ETHER Yes 119
LinkAgg3 0x000000000000 903 DOWN lan903 snap903 12 ETHER Yes 119
LinkAgg4 0x000000000000 904 DOWN lan904 snap904 13 ETHER Yes 119
but you can also do:
# lanscan -q
0
1
4
900 3 2
901 5 6
902
903
904
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2004 01:46 AM
12-10-2004 01:46 AM
Re: Method to obtain count of physical interfaces
I see that you have: lan0, lan0:1, lan0:2 and lan1
So that would make 4 interfaces. I would think it is probably not counting lo0.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2004 02:09 AM
12-10-2004 02:09 AM
Re: Method to obtain count of physical interfaces
APA 900 use lan3 and lan2
APA 901 use lan5 1nd lan6
The three remaining ports lan0, lan1 and lan4 - are unused.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2004 11:01 PM
12-10-2004 11:01 PM
Re: Method to obtain count of physical interfaces
Thanks for the response.
But I want to do it through a program in C.
Don't want a command
Thanks and Regards,
M Shetty