8

Simple Linux Network interface configuration mapper

 2 years ago
source link: https://dev.to/vkg23/linux-network-interface-configuration-mapper-41
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Cover image for Simple Linux Network interface configuration mapper

Simple Linux Network interface configuration mapper

Sep 4

・1 min read

There are many questions to answer when it comes to a physical machine-related Network interface configuration that has multiple interfaces for individual use.

. Which card is active?
. Is that part of bonding?
. What is its mac address?
. What is its permanent mac if part of Bonding?
. What's the speed of device and what is its state now?
. What all ip address its holding now ?

While ifconfig provides you some info , new 'ip' command does it much more better yet don't have all the representations. Then you end up looking at some other config files/device files to further map information.

Give this a try, Just copy and run.

To keep it simple and portable as possible for admins I did it in my fav awk programming.

Sample output

#awk -f Netinfo.awk
Filter IPV4(-4) : No
______________________________________________________________________________________________________________
Device     Name        Bond        Mac                     Mac(perm)           State       IP/Net
______________________________________________________________________________________________________________  
/          lo                                                                  UNKNOWN()   127.0.0.1/8
02:01      eno1        bond0       92:6a:64:43:d5:c1      92:6a:64:43:d5:c1    UP(10G) 
02:02      eno2        bond0       92:6a:64:43:d5:c1      92:6a:64:43:d5:c5    UP(10G)
02:03      eno3                    92:6a:64:12:d3:12                           DOWN(10G)   192.168.0.11/24,fdb4:a9d0:15e6:a052::/64
           bond0                   92:6a:64:12:d3:13                                        192.168.0.12/24,192.168.0.20/24
_____________________________________________________________________________________________________________
Enter fullscreen modeExit fullscreen mode

Refer to my Github page for more details.
Link Github/vkg23/Netinfo.awk

Tested for RHEL/CENTOS 6/7/8 Versions.

Hope it helps the Linux Community.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK