OpenSuSE: ping: unknown host, and connect: network is unreachable

WAIT: Read the whole post before applying any changes. You will know why once you’re done!
Note: Seems like it’s kind of common for SuSE, but you can easily modify the few specific lines to work with your distro. Most commands are common Linux stuff.

This is not my first day with SuSE, really, but since I’ve been considering an enterprise distro for a few servers at work, and the fact that I rather have my jewels stabbed with a sharp icepick instead of touching REHL I started playing around with OpenSuSE 11.1. This is what I’ve been running into pretty much all day today AFTER I changed DHCP to static. Here is what I did: First edited my resolv.conf to add my DNS servers:
nano /etc/resolv.conf

added the following lines:
nameserver <internal DNS server IP>
domain <FQDN>
search <FQDN>

Fixed, right? Not quite. Now it can resolve internal servers’ hostnames, but when I trie to ping an external site I started getting “connect: network is unreachable error”. I looked at my ifconfig and noticed IPv6 crap showing up. I went ahead and disabled IPv6. You can either add the following lines to your /etc/modprobe.conf and reload modules, or just do them in shell directly:
echo "alias net-pf-10 off" >> /etc/modprobe.conf
echo "alias ipv6 off" >> /etc/modprobe.conf

Here I am, standing in front of a bowl of mashed potatoes with no pants on… this SuSE experiment has been a pain in the neck so far. A quick spark made me try:
ip route show all

and it returned: dev eth0 proto kernel scope link src dev eth0 scope link dev lo scope link

Oh, snap! Seems like there is no default gateway setup on the system, while I have the line in my /etc/sysconfig/network/ifcfg-eth0. I went ahead with the following command:
route add default gw

and booya! This is what “ip route show all” returns at the moment: dev eth0 proto kernel scope link src dev eth0 scope link dev lo scope link
default via dev eth0

I’m happy… feelin’ glad :P, but my enjoyment is short lived. It lost the gateway after a reboot and same headache was about to start, but now I know how to fix that one! Tried:
nano /etc/sysconfig/network/routes

and added the line:

Rebooted and it seems like I’m golden this time. Note that can go ahead and create the file if it does not already exist.

Note: It wasn’t IPv6’s fault after all, but since I don’t need it I left it disabled. Now I’m leaving everything here, just in case. You just pick what you need, or perform from the bottom up (that’s what she said!)

2 thoughts on “OpenSuSE: ping: unknown host, and connect: network is unreachable

  1. Lady says:

    Thank you, thank you, thank you!!!!!!!!! This fixed my BM which was running Debian. I thought I had the network settings wrong for the VM, I never thought about the default gateway!! 😀

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.