当前位置: 技术问答>linux和unix
虚拟机下linux网络不通
来源: 互联网 发布时间:2017-02-06
本文导语: 红帽5.5版的 真实机器没问题 #ifconfig eth0 Link encap:Ethernet HWaddr 00:0C:29:B9:D6:2D inet addr:192.168.1.222 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::20c:29ff:feb9:d62d/64 Scope:Link ...
红帽5.5版的 真实机器没问题
#ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:B9:D6:2D
inet addr:192.168.1.222 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feb9:d62d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:385 (385.0 b) TX bytes:5624 (5.4 KiB)
Interrupt:67 Base address:0x2024
------------------------------------
但是 ping 网关192.168.1.1
网卡设置文件如下:
DEVICE=eth0
HWADDR=00:0C:29:B9:D6:2D
IPADDR=192.168.1.222
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
NETWORK=192.168.1.235
ONBOOT=yes
BOOTPROTO=none
-----------------------
问题在哪?
#ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:B9:D6:2D
inet addr:192.168.1.222 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:feb9:d62d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3 errors:0 dropped:0 overruns:0 frame:0
TX packets:40 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:385 (385.0 b) TX bytes:5624 (5.4 KiB)
Interrupt:67 Base address:0x2024
------------------------------------
但是 ping 网关192.168.1.1
网卡设置文件如下:
DEVICE=eth0
HWADDR=00:0C:29:B9:D6:2D
IPADDR=192.168.1.222
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
NETWORK=192.168.1.235
ONBOOT=yes
BOOTPROTO=none
-----------------------
问题在哪?
|
桥接网卡
|
开桥接就得了,你是怎么连接的?
|
你虚拟机的NAT功能开了么?开了的话应该可以自动就可以。不开NAT选桥接也行,只是这样配置复杂些。
试试这个命令(如果nat开了的话)dhclient eth0
试试这个命令(如果nat开了的话)dhclient eth0