Updated: February 8th, 2017
Today I was setting up a new machine (running OpenSUSE 12.1, but it's not really important), and after switching the network configuration from DHCP to static IP, lost all connectivity, in and out. /etc/init.d/network restart seemed to list the right IP, yet I was getting
"Network is unreachable"
errors while pinging. I double and triple checked all the settings – DNS and gateway were set up right. I even rebooted, but nothing worked.
Then I vaguely remembered that I ran into the same issue a few years prior and also spent hours trying to figure out what was going wrong. The solution was so incredibly simple that my geek cred should have been docked 10 points. But what was it?.. And then it finally hit me.
Let's see… check ifconfig… yup, the network interface has no IP even though I set it and it even showed up during the network restart command.
Check ifconfig again – there it goes, and the network is finally operational. Damn you, whoever wrote the network start script, for not dealing with this situation properly or at least issuing a warning that the interface was not up.
Hopefully, I won't have to waste time solving this problem next time it occurs, if I remember that I already blogged about it. Perhaps it will save you some time too.
In the meantime, if you found this article useful, feel free to buy me a cup of coffee below.