Jump to content

kvm and virtualbox no network connection


Recommended Posts

I reinstalled my whole system cuz I wanted some changes. So I reinstalled kvm and installed a virtual pc.

However I do not get a network connection, my virtualpc doesn't get an ip adress. I checked to see if kvm

created a bridge and it did:

 

virbr0 Link encap:Ethernet HWaddr 52:54:00:FB:2B:21

 

I tried creating a bridge manually that causing the loss of all my network connections but I made a backup

of the config file luckily. I then tried doing selecting a different virtual network card in kvm for my virtualpc.

Same results. I then thought, well let's try installing virtualbox again and see what happens. So I create

my virtual pc and install a system and I have the same thing, my virtual pc doesn't get an ip. Not in any

network setting. So I figured that the problem is not with kvm and not with virtualbox. But be something

else on my system, but find it strange after a fresh install this happens. I don't want an answer, cuz I'd

like to figure this out myself but just writing it out to think it through. Cuz I want to be able to learn

to fix things myself. So I know it's not the virtual software that's not working right, but have to look

somewhere towards my networkcard/network connection. You can reply for tips, but I'll post as

soon as I get a bit further.

Link to post
Share on other sites

What does ifconfig suggest about your network interfaces? Perhaps the bridge interfaces show up there, and there might be some useful information in that output.

Link to post
Share on other sites

eth0  	Link encap:Ethernet  HWaddr F4:6D:04:E5:A7:9B
     	inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
     	inet6 addr: fe80::f66d:4ff:fee5:a79b/64 Scope:Link
     	UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
     	RX packets:1414 errors:0 dropped:0 overruns:0 frame:0
     	TX packets:1381 errors:0 dropped:0 overruns:0 carrier:0
     	collisions:0 txqueuelen:1000
     	RX bytes:894019 (873.0 KiB)  TX bytes:248959 (243.1 KiB)
     	Interrupt:56 Base address:0xa000
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   TX bytes:480 (480.0 
virbr0	Link encap:Ethernet  HWaddr 52:54:00:FB:2B:21
     	inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
     	UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
     	RX packets:0 errors:0 dropped:0 overruns:0 frame:0
     	TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
     	collisions:0 txqueuelen:0
     	RX bytes:0 (0.0   TX bytes:3909 (3.8 KiB)

 

I did look it through but couldn't find anything strange

Link to post
Share on other sites

Hmmm... particular odd that virbr0 claims to have an IP address! Is it just the guest that won't get an IP address? Can you configure the guest manually with the given IP address there to get network access (it might be a KVM/VirtualBox DHCP server not running perhaps?)?

Link to post
Share on other sites

Hmmm... particular odd that virbr0 claims to have an IP address! Is it just the guest that won't get an IP address? Can you configure the guest manually with the given IP address there to get network access (it might be a KVM/VirtualBox DHCP server not running perhaps?)?

 

Nope won't work either.Yeah it's just the guest not getting an ip

Still find it strange that it was working and after a fresh install it no longer worked huh.png And on top of that now

whenever I bootup a virtualbox machine my whole system crashes so I removed virtualbox and continuing

with kvm.

 

I did check my virtual networks in kvm and it shows the following:

 

device name: default

device: vbr0

 

network: 192.168.122.0/24

dhcp start: 192.168.122.2

dhcp stop: 192.168.122.254

 

fowarding NAT

 

 

So the bridge is getting an ip, it's not able to distribute an ip for some reason. Will look some more for a virtual dhcp service.

Link to post
Share on other sites

I did try setting a static ip and when I restart my network my ip shows up but I get no network connection. Setup in the same network as my host/desktop but with a different ip.

So I know now that the virtual network card is working. The bridge gets an ip, but it's not giving out ip's. I did check /etc/sysconfig/network-scripts and there's no

ifcfg-br0 file there, which I find strange cuz I would think the bridge needs that file. But if the bridge wasn't setup right by kvm it shouldn't get an ip either.

Something to think about for myself.

Link to post
Share on other sites

I found a useful post which brought me to the following information

 

http://wiki.centos.org/HowTos/KVM#head-8424c473b52c407c62d08e8a37406821d05f5862

 

And I came across the original kvm network document which looks similar to the centos.

 

http://www.linux-kvm.org/page/Networking

 

Will try it out and post the results.

Link to post
Share on other sites

I went through the kvm quickstart one more time and this time I did it correctly. My birdge is working. I thought it wasn't at first cuz as soon as you setup the brige. The network icon shows there's no network connection. Because I have it setup right now I have a network/internet connection now and my bridge is activated.

 

~]$ ifconfig
br0 Link encap:Ethernet HWaddr F4:6D:04:E5:A7:9B
inet addr:192.168.1.100 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::f66d:4ff:fee5:a79b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2036979 errors:0 dropped:0 overruns:0 frame:0
TX packets:1236322 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2998738923 (2.7 GiB) TX bytes:70024709 (66.7 MiB)
eth0 Link encap:Ethernet HWaddr F4:6D:04:E5:A7:9B
inet6 addr: fe80::f66d:4ff:fee5:a79b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2569702 errors:0 dropped:0 overruns:0 frame:0
TX packets:1526141 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:3813388370 (3.5 GiB) TX bytes:91151406 (86.9 MiB)
Interrupt:56 Base address:0xe000
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:10494 errors:0 dropped:0 overruns:0 frame:0
TX packets:10494 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6680624 (6.3 MiB) TX bytes:6680624 (6.3 MiB)
virbr0 Link encap:Ethernet HWaddr 52:54:00:D9:96:19
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0  TX bytes:4167 (4.0 KiB)
vnet0 Link encap:Ethernet HWaddr FE:54:00:D7:2F:58
inet6 addr: fe80::fc54:ff:fed7:2f58/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0  TX bytes:850 (850.0 
~]$ netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 br0
192.168.122.0 * 255.255.255.0 U 0 0 0 virbr0
link-local * 255.255.0.0 U 0 0 0 br0
default 192.168.1.1 0.0.0.0 UG 0 0 0 br0

 

Only I setup my vm network card too and rebooted the network on the vm. Still get no ip on my vm though. At least I'm one step further now. Will look into it more later.

Link to post
Share on other sites

Seems like I didn't understand kvm quite correctly. I mentioned on SLF and seems like I have two bridges now br0(made by me, direct bridge to internet) and vbr0(made by kvm, uses nat).

I have two options, I can use vbr0 or br0. Since vbr0 is the default one made by kvm. I'm going to delete the one I made by restore the file ifcfg-eth0 and removing ifcfg-br0. Then restart

networking. Then I'll just have to play around with the vm nic settings as far as I understanding it correctly. Here's the post for those who are interested.

Link to post
Share on other sites

I got it to work with some help from SLF people and using the redhat deployment guide. The important thing to know is that when you install kvm and related software it automatically makes a bridge named(virbr0), this bridge uses NAT networking. So you can connect to internet but others can't connect to your vm. The second bridge is a bridge that's directly connected to your host nic. You can assign this bridge to a vm and others on your network will be able to connect to your vm. Here's the guide how to set that up. The other important thing is how you setup your vm nic. I tried setting up a static but couldn't get that to work and I was confused about nic network configuration. So I got the Red Hat Deployment Guide to help me out. I got it setup and reboot my vm network and now I have network/internet connection. Also I had to # out a rule in my /etc/sysconfig/iptables cuz it blocked my vm from accessing the network on my host.

 

This line: -A FORWARD -j REJECT --reject-with icmp-host-prohibited

 

I'm still going to figure out to get it to work with static ip just to know how to do it. But I can assign ip's to mac's in my router. So not much of a problem.

It took a while and some help but I did learn from it smile.png

 

here's to post on the SLF

 

Cheers!!

Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...