IP address: Difference between revisions
add RedHat example |
m Text replacement - "<(\/?)source" to "<$1syntaxhighlight" |
||
| Line 9: | Line 9: | ||
! Protocol !! using <code>ip</code> options !! "dumb" grep (no options to <code>ip</code>) | ! Protocol !! using <code>ip</code> options !! "dumb" grep (no options to <code>ip</code>) | ||
|- | |- | ||
| IPv4 || < | | IPv4 || <syntaxhighlight lang="bash">ip -4 addr show | awk '{ print $2 }'</syntaxhighlight> || <syntaxhighlight lang="bash">ip addr show | grep 'inet ' | awk '{ print $2 }'</syntaxhighlight> | ||
|- | |- | ||
| IPv4 and IPv6 || || < | | IPv4 and IPv6 || || <syntaxhighlight lang="bash">ip addr show | grep 'inet' | awk '{ print $2 }'</syntaxhighlight> | ||
|- | |- | ||
| IPv6 || < | | IPv6 || <syntaxhighlight lang="bash">ip -6 addr show | awk '{ print $2 }'</syntaxhighlight> || <syntaxhighlight lang="bash">ip addr show | grep 'inet6' | awk '{ print $2 }'</syntaxhighlight> | ||
|} | |} | ||
| Line 21: | Line 21: | ||
== Older == | == Older == | ||
On older systems you might need to use <code>ifconfig</code>, and specify the <code>/sbin</code> path because it's not in the standard path for regular users on RedHat. | On older systems you might need to use <code>ifconfig</code>, and specify the <code>/sbin</code> path because it's not in the standard path for regular users on RedHat. | ||
< | <syntaxhighlight lang="bash"> | ||
/sbin/ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | sort -n | awk '{print $1}' | /sbin/ifconfig | grep 'inet addr:' | grep -v '127.0.0.1' | cut -d: -f2 | sort -n | awk '{print $1}' | ||
</ | </syntaxhighlight> | ||
[[Category:System Administration]] | [[Category:System Administration]] | ||