- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- lan and card information
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
11-18-2004 11:26 AM
11-18-2004 11:26 AM
So far I figure that by using "netstat -i", I will see the active/configured lans and can get the ip addresses. Using the lan id (the single number after lan, I can run "lanadmin -ax #" multiple times to display mac address, speed and half/full duplex. Then to get the hardware address I have to use "ioscan -fnC lan" to list all the cards and try to get the hardware address. From all that output I cut and paste into a list.
Isn't there an easier way?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2004 11:32 AM
11-18-2004 11:32 AM
Re: lan and card information
I use the same tools you do.
lanscan
lanadmin
ifconf
For the purpose of moving equipment, I use labelling indicating what ip address is on what network port. Just print and stick.
Don't like giving bad news, but I don't know a way to do it with one command.
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
11-18-2004 11:47 AM
11-18-2004 11:47 AM
Re: lan and card information
Write a small script that matches the outputs of 'lanscan', 'netstat -in' and 'lanadmin'. You will get what you need from those three.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2004 03:28 PM
11-18-2004 03:28 PM
Solution#!/usr/bin/sh
# Purpose: laninfo.sh: consolidate network info
# find physical networks
p_nics=`/usr/sbin/lanscan -ia | awk '{print $2","$1}'`
#clean up mac address
for i in $p_nics
do
addr=`echo $i|cut -dx -f 2,2`
o1=`echo $addr|cut -c 1-2`
o2=`echo $addr|cut -c 3-4`
o3=`echo $addr|cut -c 5-6`
o4=`echo $addr|cut -c 7-8`
o5=`echo $addr|cut -c 9-10`
o6=`echo $addr|cut -c 11-12`
clean_addr="${o1}:${o2}:${o3}:${o4}:${o5}:${o6}"
nic=`echo $i|cut -d , -f 1,1`
clean_nics="${nic},${clean_addr} $clean_nics"
done
#add primary ip addresses
for i in $clean_nics
do
nic=`echo $i|cut -d , -f 1,1`
ip=`/usr/sbin/ifconfig $nic 2>/dev/null |grep -s 'inet'|awk '{print $2}'`
nic_mac_ip="${i},${ip:=NONE} ${nic_mac_ip}"
done
#add virtual interfaces, if any
for i in `netstat -in |awk '{print $1}'| grep -s ':'`
do
ip=`/usr/sbin/ifconfig $i|grep -s 'inet'|awk '{print $2}'`
parent=`echo $i|cut -d : -f 1,1 `
vnic="${i},${parent},${ip} ${vnic}"
done
#create output
echo "Device\t IP\t\tMAC\t\t Hostname in /etc/hosts"
echo "-------------------------------------------------------------------------------"
for i in $nic_mac_ip $vnic
do
nic=`echo $i|cut -d , -f 1,1`
mac=`echo $i|cut -d , -f 2,2`
ip=`echo $i|cut -d , -f 3,3`
name=`grep "^${ip}[ ]" /etc/hosts | awk '{print $2}' | sort -u`
printf "%-9s%-15s%-19s %s\n" ${nic} ${ip} ${mac} ${name:=NONE}
done | sort
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2004 05:19 PM
11-18-2004 05:19 PM
Re: lan and card information
Great script.
In my book you deserve 20 points.
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
11-18-2004 09:10 PM
11-18-2004 09:10 PM
Re: lan and card information
I am with SEP's list of commands here
"lanscan -v" is quite usefull. But there is no be-all and end all. The fun starts if you are using trunked vlans to your machine ;)
I took twangs script and added in a bit not nearly as gracefull though and it still does not give everything. Twang great script I hope its kewl that I added a bit.
Outputs the following
HWPath Device IP MAC Hostname in /etc/hosts
-------------------------------------------------------------------------------
0/0/0/0 lan0 NONE 00:30:6E:1C:30:93 NONE
0/6/0/0 lan1 192.6.2.1 00:30:6E:0F:99:1D NONE
#!/usr/bin/sh
# Purpose: laninfo.sh: consolidate network info
# find physical networks
p_nics=`/usr/sbin/lanscan -ia | awk '{print $2","$1}'`
#clean up mac address
for i in $p_nics
do
addr=`echo $i|cut -dx -f 2,2`
o1=`echo $addr|cut -c 1-2`
o2=`echo $addr|cut -c 3-4`
o3=`echo $addr|cut -c 5-6`
o4=`echo $addr|cut -c 7-8`
o5=`echo $addr|cut -c 9-10`
o6=`echo $addr|cut -c 11-12`
clean_addr="${o1}:${o2}:${o3}:${o4}:${o5}:${o6}"
nic=`echo $i|cut -d , -f 1,1`
clean_nics="${nic},${clean_addr} $clean_nics"
done
#add primary ip addresses
for i in $clean_nics
do
nic=`echo $i|cut -d , -f 1,1`
ip=`/usr/sbin/ifconfig $nic 2>/dev/null |grep -s 'inet'|awk '{print $2}'`
nic_mac_ip="${i},${ip:=NONE} ${nic_mac_ip}"
done
#add virtual interfaces, if any
for i in `netstat -in |awk '{print $1}'| grep -s ':'`
do
ip=`/usr/sbin/ifconfig $i|grep -s 'inet'|awk '{print $2}'`
parent=`echo $i|cut -d : -f 1,1 `
vnic="${i},${parent},${ip} ${vnic}"
done
#create output
echo "HWPath\t Device\t IP\t\t\tMAC\t Hostname in /etc/hosts"
echo "--------------------------------------------------------------------------
-----"
for i in $nic_mac_ip $vnic
do
nic=`echo $i|cut -d , -f 1,1`
mac=`echo $i|cut -d , -f 2,2`
ip=`echo $i|cut -d , -f 3,3`
path=`/usr/sbin/lanscan | grep ${nic} | grep -v ${nic}: | awk '{print $1}'`
name=`grep "^${ip}[ ]" /etc/hosts | awk '{print $2}' | sort -u`
printf "%-10s%-9s%-15s%-19s %s\n" $path ${nic} ${ip} ${mac} ${name:=NONE}
done | sort
Regards
Gerhard