Title pretty much says it all. If I run ifconfig, I get this:
ifconfig
eth0: flags=4163 mtu 1500 inet -snip-
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.