大网数据广告活动
服务器运维问答

centos VM unable to access the internet from hyper-V network

· 52CE 我爱测

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…

问题原文

原帖链接 · Vasili Syrakis · CC BY-SA 4.0

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

社区高分解答

原帖链接 · Fax · CC BY-SA 4.0

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

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-03-12)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。