ifconfig - How to extract netmask using /sbin/ip? -
i want replace ifconfig /sbin/ip. using ifconfig can see lines
inet addr:xx.xxx.x.xx bcast:xx.xxx.x.xx mask:255.255.255.0 and can parse find netmask (255.255.255.0). how can achieve using /sbin/ip?
running ip a you'll output similar running ifconfig. specifically, you'll see line similar yours:
inet xx.xxx.x.xx/24 brd xx.xxx.x.xx the /24 denotes subnet mask in slash notation.
Comments
Post a Comment