![尝试使用 VMWare 在 RedHat 6.5 中更改为静态 IP。现在无法访问互联网](https://linux22.com/image/55356/%E5%B0%9D%E8%AF%95%E4%BD%BF%E7%94%A8%20VMWare%20%E5%9C%A8%20RedHat%206.5%20%E4%B8%AD%E6%9B%B4%E6%94%B9%E4%B8%BA%E9%9D%99%E6%80%81%20IP%E3%80%82%E7%8E%B0%E5%9C%A8%E6%97%A0%E6%B3%95%E8%AE%BF%E9%97%AE%E4%BA%92%E8%81%94%E7%BD%91.png)
我按照互联网上的资源为 VMWare 中的 RedHat 6.5 安装分配静态 IP 地址。之后我无法访问互联网。我更改的文件的终端输出如下:
[Piyush@redhatcdh4_1 ~]$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:BE:52:B7
TYPE=Ethernet
UUID=8bd6e426-9bad-4f0c-a098-9345e1d51bfa
ONBOOT=no
NM_CONTROLLED=yes
BOOTPROTO=static
IPADDR=192.168.31.217
NETMASK=255.255.255.0
[Piyush@redhatcdh4_1 ~]$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=redhatcdh4_1
GATEWAY=192.168.31.2
NTPSERVERARGS=iburst
ifconfig命令的输出如下:
[Piyush@redhatcdh4_1 ~]$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:BE:52:B7
inet addr:192.168.31.217 Bcast:192.168.31.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:febe:52b7/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:3611 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:226739 (221.4 KiB) TX bytes:636 (636.0 b)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:601 errors:0 dropped:0 overruns:0 frame:0
TX packets:601 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:46796 (45.6 KiB) TX bytes:46796 (45.6 KiB)
。
[Piyush@redhatcdh4_1 ~]$ route -n; ping -c3 192.168.31.2; ping -c3 4.2.2.2; cat /etc/resolv.conf
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.31.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
PING 192.168.31.2 (192.168.31.2) 56(84) bytes of data.
From 192.168.31.217 icmp_seq=1 Destination Host Unreachable
From 192.168.31.217 icmp_seq=2 Destination Host Unreachable
From 192.168.31.217 icmp_seq=3 Destination Host Unreachable
--- 192.168.31.2 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 3003ms
pipe 3
connect: Network is unreachable
# Generated by NetworkManager
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
我是不是搞砸了什么?如果您需要更多数据来指出错误,请随时询问。