我按照互联网上的资源为 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
我是不是搞砸了什么?如果您需要更多数据来指出错误,请随时询问。