1

Problem

Cannot access the internet. CentOS guest isn't receiving incoming traffic.

Private network is fully accessible.

Scratching my head here... I don't have this problem on Debian/Ubuntu/Windows! :(

Configuration:

  • Hyper-V host (192.168.137.1)
  • Freshly built CEntOS guest (192.168.137.16)
  • Guest resides on Internal Network with Internet Connection Sharing(ICS) enabled
  • Address is assigned by DHCP server on the host
  • Address range: 192.168.137.0/24
  • DNS is set to my ISP's public nameservers (resolv.internode.on.net)

Additional Configuration

  • iptables is stopped
  • SELinux is disabled

Some info that may be useful

ifconfig

eth0      Link encap:Ethernet  HWaddr 00:15:5D:C8:34:5A
          inet addr:192.168.137.16  Bcast:192.168.137.255  Mask:255.255.255.0
          inet6 addr: fe80::215:5dff:fec8:345a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:111 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12748 (12.4 KiB)  TX bytes:1788 (1.7 KiB)

eth1      Link encap:Ethernet  HWaddr 00:15:5D:C8:34:5C
          inet addr:192.168.137.15  Bcast:192.168.137.255  Mask:255.255.255.0
          inet6 addr: fe80::215:5dff:fec8:345c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:147 errors:0 dropped:0 overruns:0 frame:0
          TX packets:117 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:14087 (13.7 KiB)  TX bytes:14587 (14.2 KiB)
          Interrupt:9 Base address:0x2000

netstat -rn

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.137.0   0.0.0.0         255.255.255.0   U         0 0          0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 eth0
0.0.0.0         192.168.137.1   0.0.0.0         UG        0 0          0 eth0

cat /etc/resolv.conf

; generated by /sbin/dhclient-script
nameserver 192.231.203.132
nameserver 192.231.203.3

cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0
HWADDR=00:15:5D:C8:34:5A
TYPE=Ethernet
UUID=b4fefb4d-1d42-4a28-84b3-9a70b6ea65ca
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=dhcp

cat /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=puppet-free.vm.pe
GATEWAY=192.168.137.1

cat /etc/udev/rules.d/70-persistent-net-rules

# net device ()
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:c8:34:5a", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x1011:0x0009 (tulip)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:15:5d:c8:34:5c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

Questions I've already looked at to answer my own (in vain)

Unable to ping or access internet

Connect to the internet with CENTOS 5

Centos internet not working

My CentOS 5.7 server can't access the internet

Vasili Syrakis
  • 4,435
  • 3
  • 21
  • 29

5 Answers5

7

I had no internet connection on a fresh Centos 7 install. In my case it was because eth0 was down.

Check the status of your devices with

nmcli device

If the ethernet device (usually eth0) is "disconnected", bring it up with

nmcli connection up eth0
Uwe Keim
  • 2,370
  • 4
  • 29
  • 46
Fax
  • 171
  • 1
  • 3
0

Can machine with IP address 192.168.137.1 forward traffic from network 192.168.137.0/24 to the internet?

If this machine is Linux, it has to have allow forwarding, try to see /etc/sysctl.conf file.

On routing machine can be denied forwarding by iptables (try exec iptables -L -n and check rules in the FORWARD chain).

You can try to install tshark (or tcpdump or tethereal) utility even on the new host even on the routing machine and watch packets. Then you can on the new machine exec ping 4.4.4.4, for example, and you will see, if router can forward packet to the next hop correctly.

If you have another router in the network: know this another router, that your first router (with one of IP address 192.168.137.1) routing this network? Try to check it by running command ping 192.168.137.1 on this next router (preferably border router). If this ping don't work, you have to set static route, somethink like this: ip route add 192.168.137.0/24 via x.x.x.x, where x.x.x.x is IP address of router, which have as another address 192.168.137.1.

I'm very sory about my English, but I believe, that this post can help to you...

Jan Marek
  • 2,120
  • 1
  • 13
  • 14
  • The Hyper-V host is `192.168.137.1` and can forward traffic to and from the internet. Each machine on the `192.168.137.0/24` network can communicate with each other without a problem. What do I look for inside the `sysctl.conf` file? – Vasili Syrakis Mar 12 '14 at 08:07
  • You have to have in this file somethink like `net.ipv4.ip_forward=1` (it's depend on the version of kernel). – Jan Marek Mar 12 '14 at 08:43
  • I edited my `sysctl.conf` and it did not seem to change anything. I checked on wireshark and it looks like the guest can send traffic outgoing, but nothing comes back. iptables is disabled. – Vasili Syrakis Mar 12 '14 at 11:12
0

I think your problem lies with your VM Guest configuration in Hyper-V, and not the OS itself. I'm no expert - but i vaguely recall similar problems a long time ago that were related to which type of virtualized network interface I had selected in my HyperV configuration.

The solution for me was to remove the network adapter configured by default, and add a 'Legacy Network' adapter. After that it seemed to work.

tdk2fe
  • 600
  • 2
  • 13
0

Fixed!

Okay, so I found out what it was.

I do not expect anyone to ever have guessed this!

I have two network adapters:

  • 1x Ethernet Network Adapter - 192.168.1.13
  • 1x Wireless Adapter - 192.168.1.3

The Hyper-V Internal network was running on the Wireless Adapter with Internet Connection Sharing (ICS) enabled.

Packets were successfully going out, but upon coming back in they would go to my Ethernet card and they would have no clue where to go from there, hence, my VMs did not receive anything back.

I've now split my network in two, so I have my Wireless card on 192.168.1.0/24 and my Ethernet card on 10.1.1.0/24.

This configuration now works.

Hurrah!

Vasili Syrakis
  • 4,435
  • 3
  • 21
  • 29
0

I had a similar issue with getting out to the internet with my CentOS 7 server (KVM guest). I had to configure the Network default gateway in /etc/sysconfig/Network by adding my router's IP address (must be in the same subnet as the NIC you are using for internet traffic). I was able to ping my router (gateway) at this point, but still could not get to to the public internet (pings to google.com were unsuccessful). I made sure I had my dns server's defined in /etc/resolv.conf, but still could not get out. I checked the services that were running using systemctl list-unit-files | grep enabled and saw that NetworkManager was enabled. I stopped this service, then disabled and BINGO! I was able to get out to the Wild Wild West! Pings to google.com were successful.

Hope this helps.

Xiong Chiamiov
  • 2,874
  • 2
  • 26
  • 30