Ubuntu 12.04 Server ping gateway responds with destination host unreachable
I consider myself fairly avid with Ubuntu and Linux, but this one has me stumped. I built up a Xen Server using Ubuntu 12.04 as the base operating system. It has multiple domUs running on it. My home network has a statically defined network where I got all the network connectivity going peachy. The server was moved to a permanent home this morning. So, the network configuration on the main system had to change. Again, another static network, but now I can’t ping the upstream gateway from the host. As the VMs use this NIC over a bridge, they too are broken. Ping responds with «destination host unreachable.» I simplified the networking down to a simple static network as seen below (no bridge or anything) just to get it to work. Here’s the contents of my /etc/network/interfaces file:
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 216.7.188.228 gateway 216.7.188.225 netmask 255.255.255.240 broadcast 216.7.188.255 network 216.7.188.0 dns-nameservers 8.8.8.8 8.8.4.4
0.0.0.0 216.7.188.225 0.0.0.0 UG 100 0 0 eth0 216.7.188.224 0.0.0.0 255.255.255.240 U 0 0 0 eth0
PING 216.7.188.225 (216.7.188.225) 56(84) bytes of data. From 216.7.188.228 icmp_seq=1 Destination Host Unreachable From 216.7.188.228 icmp_seq=1 Destination Host Unreachable From 216.7.188.228 icmp_seq=1 Destination Host Unreachable
Again, this worked in one network flawlessly (obviously with different parameters in the interfaces file). I did try using eth1 (as there are two NICS on the server (in case the MAC address got flipped on bootup). No success there. Yes, the cable is in the right port now 🙂 Any thoughts? I appreciate the help! Further investigation resulted in finding out the following characteristics. Grub gives you two main boot options after xen is installed. One for the vanilla kernel without Xen, and one with Xen. The default is to use the Xen boot configuration. If I use the vanilla kernel option, with no Xen, networking is just fine. If I use the Xen option, networking breaks. I compared the routing tables for the two setups with «route -n» and they are identical. The /etc/network/interfaces file hasn’t changed. So, it must be something to do with the way the bridge is setup, or Xen performs it’s network initialization. This is diving into an area I’m unfamiliar with. Can anyone give me an idea how to proceed solving this problem? Otherwise, I have to bail on Xen (which I don’t want to do) and try VirtualBox instead. This is horribly frustrating.
«Destination Host Unreachable» and ssh » No route to host»
На центосе стоит 2 сетевые карты с этими айпи. И нету подключения к интернету.
При попытке пинга с Убунты локальной машины центос пишет
Чего? Ты с локальной машины с убунтой пингуешь сам себя и тебе отвечает центос?
Я с Убунты(192.168.8.101) пытаюсь пинговать центос(192.168.100.166 и 192.168.8.1) На центосе установлены 2 сетевые карты с такими айпи. К 166 подключен кабель от глобальной сетки, а со второй карты идет кабель в роутер и от роутера второй кабель идет в убунту.
Не судите, но тут думаю есть проблема.
route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.8.0 0.0.0.0 255.255.255.0 U 100 0 0 enp2s1 192.168.8.1 192.168.100.166 255.255.255.255 UGH 0 0 0 enp2s5 192.168.8.101 192.168.100.166 255.255.255.255 UGH 0 0 0 enp2s5 192.168.100.0 0.0.0.0 255.255.255.0 U 100 0 0 enp2s5 192.168.100.166 192.168.100.254 255.255.255.255 UGH 0 0 0 enp2s5
Ну так у Вас просто сеть не работает.
Начинать надо сначала — приведите список и параметры сетевых интерфейсов на локальной машине (команда ifconfig), а также таблицу маршрутизации (команда ip route).
Ну и проверьте, есть ли сеть физически (в логах dmesg должны быть строчки, что сетевые интерфейсы подняты).
Это с какой машины таблица маршрутизации?
ifconfig enp2s5 Link encap:Ethernet HWaddr 00:16:e6:66:3d:f2 inet addr:192.168.8.101 Bcast:192.168.8.255 Mask:255.255.255.0 inet6 addr: fe80::9d31:3207:5516:4f24/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:21420 errors:0 dropped:1 overruns:0 frame:0 TX packets:12467 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:8616229 (8.6 MB) TX bytes:1984494 (1.9 MB) Interrupt:21 lo Link encap:Локальная петля (Loopback) inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:2153 errors:0 dropped:0 overruns:0 frame:0 TX packets:2153 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:300690 (300.6 KB) TX bytes:300690 (300.6 KB) ip route default via 192.168.8.1 dev enp2s5 proto static metric 100 169.254.0.0/16 dev enp2s5 scope link metric 1000 192.168.8.0/24 dev enp2s5 proto kernel scope link src 192.168.8.101 metric 100
ifconfig enp2s1: flags=4163 mtu 1500 inet 192.168.8.1 netmask 255.255.255.0 broadcast 192.168.8.255 ether 00:1e:58:2b:f3:d8 txqueuelen 1000 (Ethernet) RX packets 10877 bytes 1691073 (1.6 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 35 bytes 3226 (3.1 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 enp2s5: flags=4163 mtu 1500 inet 192.168.100.166 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::216:e6ff:fe66:3830 prefixlen 64 scopeid 0x20 ether 00:16:e6:66:38:30 txqueuelen 1000 (Ethernet) RX packets 21222 bytes 3227539 (3.0 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 7336 bytes 1019089 (995.2 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 21 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1 (Local Loopback) RX packets 8204 bytes 1397066 (1.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 8204 bytes 1397066 (1.3 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 ip route 192.168.8.0/24 dev enp2s1 proto kernel scope link src 192.168.8.1 metric 100 192.168.8.1 via 192.168.100.166 dev enp2s5 scope link 192.168.8.101 via 192.168.100.166 dev enp2s5 scope link 192.168.100.0/24 dev enp2s5 proto kernel scope link src 192.168.100.166 metric 100 192.168.100.166 via 192.168.100.254 dev enp2s5
Ping failing «Destination Host Unreachable»
I am trying to set up a static IP address for my Debian virtual machines. In my /etc/networking/interfaces file I added:
iface ens33 inet static address 192.168.75.XXX gateway 192.168.0.1 netmask 255.255.255.0
In the /etc/resolv.conf file I have added nameserver 8.8.8.8 . I believe my issue is that unless I have the NetworkManager service enabled nothing shows up when I run route or ip route show . I tried adding a route to the routing table by running the following command: ip route add 192.168.75.0/24 via 192.168.75.XXX (my static ip) dev ens33 . This populates the routing table and the table now looks like:
Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.75.0 0.0.0.0 255.255.255.0 U 0 0 0 ens33
do you have an internal router to route between .75.x and .0.x? your default gateway really should be an address on the IP network the the interface is on, or you need a route to reach it. if you don’t have a router, those two IPs can’t talk unless you open up the mask to 255.255.0.0 and treat all 192.168.x.y addresses as a single network. also, why are you trying to add a route for the local network? that is generally auto-detected. be more concerned about how to get from .75.x to .0.x.
So I have changed the gateway to be on the same ip network. I’ve changed it to 192.168.75.1 but also tried 192.168.75.0 but I still get the same results. Could this have to do with the Network configuration of the VM. I forgot to mention these are Virtual machines. I’ve tried the NAT and bridged connection but so far no change
do you have a router with an interface assigned the address 192.168.75.1, and an interface on 192.168.0.0/24? you can’t just put in an address, it has to be an address on a router, with a pathway between both networks. If you don’t have a router, just put your VMs in the 192.168.0.0/24 network. Personally I recommend using Bridged network connections unless you really want to get into the nitty-gritty of virtual networking, but you could make it work either way.
Hey thank you for all your help. I changed the network to ‘bridged ‘ and i am now able to ping successfully. Thanks again for all your help.
2 Answers 2
In /etc/networking/interfaces , in each section, you set a netmask that defines the subnet your machine belongs to. Here: 255.255.255.0 means /24. IOW, the adresses on your subnet go from 192.168.75.1 to 192.168.75.254.
The gateway line specifies the address of the router that must be used to reach a machine that is outside that subnet. Obviously, the router must be a machine that is on the same subnet, i.e. that has an IP address between 192.168.75.1 to 192.168.75.254.
You have specified gateway 192.168.0.1 . That means that the router is outside the subnet. That’s why you cannot ping any machine outside your sub-network 192.168.75.0/24 («Destination Host Unreachable»).
You are using VMs. Your router is probably the IP address of your host. It depends on the configuration of your VM.
ip route add 192.168.75.0/24 via 192.168.75.XXX (my static ip) dev ens33
is wrong. If you want to declare a router manually (as opposed to the interfaces file) then use this command:
ip route add default via 192.168.75.YYY (the IP of your router) dev ens33
(default means «any address that has no known route»)
Destination host unreachable is a common ICMP error message when the ping packets from your machine could not find the destination machine.
It looks like some settings on your machine are blocking the ping packets from discovering the route to the destination IP.
Well, I see you fixed the problem by changing the network type to bridge mode. So I think I better write a general answer since your issue is solved.
The common reason to get the ping reply Destination Host Unreachable is due to the overprotective settings on the firewall. Unless you are running a bridging firewall, a simple misconfiguration can block proper ping packet working.
You can verify it by disabling the firewall and ping the destination IP again.
The second common reason is a loose network connection. Referred from this source.
We can fix this, by disconnecting both power cables and Ethernet cables from the modem, router, and PC. Reconnect them again and power on the devices. It is called power cycling.