-1

I want to replace ifconfig with /sbin/ip. Using ifconfig I can see lines like

inet addr:xx.xxx.x.xx  Bcast:xx.xxx.x.xx  Mask:255.255.255.0

and can easily parse this to find the netmask (255.255.255.0). How can I achieve this using /sbin/ip?

krisharmas
  • 211
  • 2
  • 5
  • 12

1 Answers1

0

Running ip a you'll get output similar to that which you get running ifconfig. Specifically, you'll see a line similar to yours:

inet xx.xxx.x.xx/24 brd xx.xxx.x.xx

The /24 denotes the subnet mask in slash notation.

Marco Tompitak
  • 648
  • 1
  • 5
  • 12