How to check if interface is up

前端 未结 3 778
情歌与酒
情歌与酒 2020-12-31 15:19

Title pretty much says it all. If I run ifconfig, I get this:

eth0: flags=4163  mtu 1500
    inet -snip-           


        
3条回答
  •  爱一瞬间的悲伤
    2020-12-31 15:44

    If you care about the up/down state of the interface you might want to use the "IFF_RUNNING" flag instead of the "IFF_UP" flag provided by the current answer.

提交回复
热议问题