Cannot connect to the Internet on VM

Issues related to configuring your network
Post Reply
Dragon
Posts: 2
Joined: 2011/07/17 11:05:22

Cannot connect to the Internet on VM

Post by Dragon » 2011/07/17 12:27:50

I have just Installed the CENT OS 6.0 on Oracle VM VirtualBox 4.0.10.

The issue here is that I am not able to connect to the internet on the VM through CentOS. I have Server 2003 running on the same VM and it works fine.

On the VM, I have am using a Bridged Network and it shows my intel network driver there.

On the CentOS system, when I type /sbin/ifconfig eth0, it shows the following:-

eth0 Link encap:Ethernet HWaddr 08:00:27:8A:99:F9
inet6 addr: fe80::a00:27ff:fe8a:99f9/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1526 errors:0 dropped:0 overruns:0 frame:0
TX packets:385 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:499007 (487.3 KiB) TX bytes:46257 (45.1 KiB).

It is showing inet6 address.

I have disabled the firewall by using 1) # /etc/init.d/iptables save 2) # /etc/init.d/iptables stop.

Then tried it but still the same.

I tried doing service network stop and service network start but still no go.

I have also been to cd /etc/sysconfig/network-scripts and I did 'vi ifcfg-Eth0' and it brings up the following :-

TYPE=Ethernet
BOOTPROTO=none
IPADDR=116.75.166.122
PREFIX=18
GATEWAY=116.75.128.2
DNS1=156.154.70.22
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME=Eth0
UUID=f3a80989-038d-4e0f-b599-a1c1e4afa263
ONBOOT=yes


I cannot Ping my host to the VM and Vice Versa. Any Help would be Really Appreciated. Please tell me if I am missing something.


Regards,

Shashank Raj.

taylorkh
Posts: 534
Joined: 2010/11/24 15:08:33
Location: North Carolina, USA

Re: Cannot connect to the Internet on VM

Post by taylorkh » 2011/07/17 12:54:01

Hi Shashank Raj,

CentOS 6 installs with the network connection in manual mode by default. Why? Nobody seems to know. If you right click on the nm-applet icon (two PCs in the notification area of the panel) and "Edit Connections" you can set eth0 to automatically start. It will in my experience immediately start. You can also invoke Network Manager from the menu System; Preferences; Network Connections and make the change that way.

If that does not work, please report back and perhaps someone will have another idea.

Ken

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Cannot connect to the Internet on VM

Post by pschaff » 2011/07/17 21:06:32

Since ifcfg-eth0 has ONBOOT=yes and does not have NM_CONTROLLED="yes" NetworkManager does not seem to be the problem. The interface has an IPv6 address but no IPv4 address. How was it configured? Is a GUI installed? It appears to be configured for a static IP address. Is a DHCP server available? What is the NETMASK? Looks like a [url=http://en.wikipedia.org/wiki/Classful_network]class[/url] A IP address, but if it is configured as a class C subnet then the gateway is not on the subnet.

It might be helpful to see the results from "./getinfo.sh network" as explained in [url=http://www.centos.org/modules/newbb/viewtopic.php?topic_id=28723&forum=54]How to provide information about your system[/url].

Dragon
Posts: 2
Joined: 2011/07/17 11:05:22

Re: Cannot connect to the Internet on VM

Post by Dragon » 2011/07/18 06:07:58

HI Guys,


Thank you for replying to the post. There has been some recent developments. I upgraded my Virtual box version from 10 to 12 as it had some bug fixes. I was trying to use a static IP earlier as a dynamic one was not picking an Ip 4 address. But now i deleted it and I have configured the network back to Dynamic IP address. I am a home user this is a Single PC.

I still try to configure the IP but it doesn't work. I ran the getinfo.sh file and here is the output for network :-
[code]
== BEGIN ifconfig -a ==
eth1 Link encap:Ethernet HWaddr 08:00:27:8B:2D:75
inet6 addr: fe80::a00:27ff:fe8b:2d75/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:409 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:137130 (133.9 KiB) TX bytes:6624 (6.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:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)

== END ifconfig -a ==

== BEGIN route -n ==
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
== END route -n ==

== BEGIN cat /etc/resolv.conf ==
# Generated by NetworkManager
search linuxvm


# 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
== END cat /etc/resolv.conf ==

== BEGIN grep net /etc/nsswitch.conf ==
#networks: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files
netmasks: files
networks: files
netgroup: nisplus
== END grep net /etc/nsswitch.conf ==

== BEGIN chkconfig --list | grep -Ei 'network|wpa' ==
NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
wpa_supplicant 0:off 1:off 2:off 3:off 4:off 5:off 6:off
== END chkconfig --list | grep -Ei 'network|wpa' ==[/code]
[Moderator edit: Added [i]code[/i] tags to preserve formatting.]

My issue is not resolved yet. Any help would be appreciated.

Regards,

Shashank.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Cannot connect to the Internet on VM

Post by pschaff » 2011/07/18 18:38:30

Edit: You omitted some relevant information from the script output file. Please post the entire output.

You did not say if you are using a GUI environment, what the netmask is, nor how you are configuring the interface. You have both network and NetworkManager services running which was problematic for EL5 but is the default for EL6. The expectation seems to be to configure with nm-applet. Do you have other systems on the network that are getting IP addresses from DHCP? If so what are their settings for gateway and netmask?

gstaruk
Posts: 3
Joined: 2011/07/21 01:09:30

Re: Cannot connect to the Internet on VM

Post by gstaruk » 2011/07/21 02:15:50

# 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
== END cat /etc/resolv.conf ==




Sounds like a DNS issue, and from the above printout - shows you don't have DNS servers added to your eth0 config. I presume you can ping IP addresses and not hostnames like www.etc.com?

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Make sure you have a valid DNS server address in there somewhere, if not simply add:

DNS1=(primary DNS server IP address)
DNS2=(secondary dns server IP - if any)

Also, whilst you're there - you might want to check that 'onboot=yes' for eth0.
CentOS 6.0 seems to install with it defaulted off on boot.

pschaff
Retired Moderator
Posts: 18276
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America
Contact:

Re: Cannot connect to the Internet on VM

Post by pschaff » 2011/07/21 13:54:16

[quote]
gstaruk wrote:
....
Make sure you have a valid DNS server address in there somewhere, if not simply add:[/quote]
Or use DHCP, or configure it via editing the interface properties in the nm-applet GUI if applicable - still unknown what the OP is using.

[quote]
...
Also, whilst you're there - you might want to check that 'onboot=yes' for eth0.
CentOS 6.0 seems to install with it defaulted off on boot.[/quote]
[url=http://wiki.centos.org/FAQ/CentOS6#head-b67e85d98f0e9f1b599358105c551632c6ff7c90]CentOS 6 FAQ#2. Why does my Ethernet not work unless I log in and explicitly enable it?[/url]

Post Reply