Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have given static IP on my Vmware CEntoS virtual machine.

My internet was working fine. but after restarting machine

This is my ifcfg-eth0 file

DEVICE="eth0"
NM_CONTROLLED="no"
#ONBOOT="no"

NM_CONTROLLED="no"
ONBOOT="yes"
#BOOTPROTO="dhcp"
BOOTPROTO="static"
IPADDR=192.168.0.200
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
PEERDNS="no"

DNS1=8.8.8.8
DNS2=8.8.8.4

I am trying to ping the gateway 192.168.0.1 and i get

PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
From 192.168.0.200 icmp_seq=2 Destination Host Unreachable
From 192.168.0.200 icmp_seq=3 Destination Host Unreachable

which things can cause error

UPDATE: I am using vmware workstation 10 on window 7 as host with bridged network state

I tried Adding second network card in bridges mode and this is result. etho is NAT and eth1 is bridged

sudo service network restart
Shutting down interface eth0:  Device state: 3 (disconnected)
                                                           [  OK  ]
Shutting down interface eth1:  Device state: 3 (disconnected)
                                                           [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/11
state: activated
Connection activated
                                                           [  OK  ]
Bringing up interface eth1:  Active connection state: activating
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/12
state: activated
Connection activated
                                                           [  OK  ]
[14:39][cento:~]$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:9E:40:3C  
          inet addr:192.168.229.130  Bcast:192.168.229.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe9e:403c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:262 errors:0 dropped:0 overruns:0 frame:0
          TX packets:228 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:34499 (33.6 KiB)  TX bytes:75950 (74.1 KiB)

eth1      Link encap:Ethernet  HWaddr 00:0C:29:9E:40:46  
          inet6 addr: fe80::20c:29ff:fe9e:4046/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:168 errors:0 dropped:0 overruns:0 frame:0
          TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:22071 (21.5 KiB)  TX bytes:5598 (5.4 KiB)

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:75 errors:0 dropped:0 overruns:0 frame:0
          TX packets:75 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:5425 (5.2 KiB)  TX bytes:5425 (5.2 KiB)
share|improve this question
    
The host is unreachable, CentOS isn't recognising it has a network connection. Have you tried ifup eth0 and/or service network start? –  TessellatingHeckler Mar 9 at 5:06
    
@TessellatingHeckler , i have updated the question . i tried adding new network card from workstation and then i get this. i still have not got ip on eth1 –  Moorage Mar 9 at 6:42

3 Answers 3

You have to make sure what kind of network mode your guest is in. It is NAT mode by default,so the IP address should be got from a DHCP server, A.K.A the virtual adapter in your host machine. So you may comment all the configuration about static IP, and set it to DHCP mode, then restart your adapter.

share|improve this answer
    
The mode is bridged , and ip is static , i tried resyrating vm , host , network , there is no firewall. it only hapopened after my computer shutdown unexpectedly –  Moorage Mar 9 at 4:29
    
try this my reference. If you want to use /etc/resolv.conf then PEERDNS –  UnixAgain Mar 9 at 4:32
    
i ahve seen that if i choose NAT then my internet works but if i choose bridged then it dont work. i am using vitrual box on same compuer with bridged config is that can be the case –  Moorage Mar 9 at 5:10
    
Now I have the answer. When in bridge mode, your guest should be configured as your host because they are in the same net, so check your host's configuration first. –  UnixAgain Mar 9 at 5:23
    
i didn't get , what do i need to cehck in host confgi –  Moorage Mar 9 at 5:32

try this my reference I haven't seen DNS1=8.8.8.8 here before, if you want to use /etc/resolv.conf then PEERDNS="no", if you want to overwrite /etc/resolv.conf then PEERDNS="yes", However, in both situations there is no DNS1= item.

share|improve this answer
    
that setting worked for me for many months without anny issue –  Moorage Mar 9 at 4:47
    
Well, sorry about that, then I should expect another man to help us out. –  UnixAgain Mar 9 at 5:04

You need to configure an interface configuration for eth1. Take the configuration you posted and save it as ifcfg-eth1. Change the DEVICE line to match eth1 and make sure you configure an IP address that is unused.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.