1753808 Members
7996 Online
108805 Solutions
New Discussion юеВ

ifconfig -a

 
hpuxrox
Respected Contributor

ifconfig -a

Has anyone written an HP equivalent to "ifconfig -a"?

so far I have,

# for i in `lanscan | awk '{print $5}' | grep lan`
> do
> ifconfig $i
> done
lan0: flags=1843
inet 4.248.207.179 netmask fffff800 broadcast 4.248.207.255
ifconfig: no such interface
ifconfig: no such interface
ifconfig: no such interface


But this does not show any of the virtual interfaces like the one I have on lan0:801


5 REPLIES 5
Court Campbell
Honored Contributor

Re: ifconfig -a

maybe you should try grep'ing for INTERFACE_NAME in /etc/rc.config.d/netconf, then pull the lan* string out. But this would not work for vitual ip's from serviceguard packages.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"
Sandman!
Honored Contributor

Re: ifconfig -a

Try the awk construct below:

# netstat -in | awk 'NR>1 {print $1}' | xargs -n1 ifconfig
Jeff_Traigle
Honored Contributor

Re: ifconfig -a

This one should be fairly comprehensive. There's a * at the end of redundant NICs for SG in the netstat output, which cause ifconfig to give the "no such interface" error.

for LAN in $(netstat -in | awk 'NR>1 {print $1}' | sed 's/*//')
do
ifconfig $LAN
done
--
Jeff Traigle
Sandman!
Honored Contributor

Re: ifconfig -a

Actually Jeff is spot on about the asterisk at the end of the standby NICs. So use the tweaked awk code below:

# netstat -in | awk 'NR>1{printf("%s\n",$1~/\*/?z[split($1,z,"*")-1]:$1)}' | xargs -n1 ifconfig
Court Campbell
Honored Contributor

Re: ifconfig -a

I learn something new everyday.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"