Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 09-08-2007, 04:27 PM   #1
Registered: Jun 2004
Location: PA
Distribution: Fedora (latest git kernel)
Posts: 458

Rep: Reputation: 30
[KVM] adding guest computer to the network

I'm trying to connect the guest to the same network as the host's. I'm using the KVM/Qemu.

kernel is 2.6.23-rc5
kvm/qemu userspace version is 36 (which is the newest version)

when i start the guest machine via a little script i wrote:
# start up for kvm and qem

$QEMU_BIN -net nic -net user -localtime -m 512 -soundhw all -usb -hda $WIN_QCOW 1>$BASE_NAME.log 2>$BASE_NAME.err
every works fine, I even have internet. However the ip address that is getting set is Which isn't in the subnet i want. My network is of 192.168.1.XXX. I was wondering if there is a way to set the ip address on startup, so i'm on the same subnet as the host.

I tried goggling and researching but nothing seem to work. talks about networking emulation options in qemu, but it doesn't say how to configure the ip address on startup or anything like that.

If anyone has any insight or tips on how to get this to work that would be very helpful.

Let me know if you need any other info.



Last edited by djgerbavore; 09-08-2007 at 04:29 PM.
Old 09-08-2007, 05:16 PM   #2
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975Reputation: 1975
sounds like it's doing natting and routing, not bridging, which is what you seem to be asking for. check here for bridging in kvm...
Old 09-08-2007, 09:19 PM   #3
Registered: Jun 2004
Location: PA
Distribution: Fedora (latest git kernel)
Posts: 458

Original Poster
Rep: Reputation: 30
acid_kewpie that is what I was looking for...Thanks. I thought I need bridging but wasn't sure.
However I'm having trouble configuring the bridge, and I don't know how to debug it.

Basically I created TUN/TAP device called tap0 with tunctl command.

Then I need to create a bridge via:
sudo /usr/sbin/brctl addbr kvm-brigde
Then I do: (where eth0 is my wired ethernet card.
sudo /sbin/ifconfig tap0 up
sudo /sbin/ifconfig eth0 up
Then add the two interfaces to the bridge
sudo /usr/sbin/brctl addif kvm-bridge tap0
sudo /usr/sbin/brctl addif kvm-bridge eth0
Everything looks good:
bash-3.2$ /usr/sbin/brctl show
bridge name     bridge id               STP enabled     interfaces
kvm-bridge              8000.0019db6d7272       no              eth0
virbr0          8000.000000000000       no
So i decide to get a new ip address for eth0 via:
bash-3.2$ sudo /etc/init.d/network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:
Determining IP information for eth0... done.
                                                           [  OK  ]
Which is a fedora core script. so i check to see if I have a new ip address:
eth0      Link encap:Ethernet  HWaddr 00:19:DB:6D:72:72
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::219:dbff:fe6d:7272/64 Scope:Link
          RX packets:120119 errors:0 dropped:0 overruns:0 frame:0
          TX packets:105029 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:78984845 (75.3 MiB)  TX bytes:2
But when I ping my router I get this:
bash-3.2$ ping
PING ( 56(84) bytes of data.
From icmp_seq=1 Destination Host Unreachable
From icmp_seq=4 Destination Host Unreachable
From icmp_seq=5 Destination Host Unreachable
I even ran tcpdump on eth0 and nothing show up when I'm pinging.

So I'm alittle confused how to debug this. my route looks like this:
bash-3.2$ /sbin/route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface     *        U     0      0        0 eth0   *        U     0      0        0 virbr0     *          U     0      0        0 eth0
default         UG    0      0        0 eth0
Is there something I'm missing in order to start the bridge?

To get my internet connection back I remove the eth0 from the brigde:
sudo /usr/sbin/brctl delif kvm-bridge eth0


Old 02-25-2009, 05:24 AM   #4
LQ Newbie
Registered: Jul 2005
Posts: 2

Rep: Reputation: 0
setting KVM guest IP

Did you solve your guest IP address with tthe bridging and how did you do it ?
Old 02-25-2009, 10:23 AM   #5
Registered: Jun 2004
Location: PA
Distribution: Fedora (latest git kernel)
Posts: 458

Original Poster
Rep: Reputation: 30
Unfortunately, I never got this to work. Are you having the same issue? What commands are you using? If we both are having the same problem we might be able to figure it out.


Old 06-10-2009, 03:01 PM   #6
Registered: Jul 2006
Location: New York, NY
Distribution: redhat,ubuntu,RHEL,fedora,centOS
Posts: 105

Rep: Reputation: 15
Even I am having same problem. I tried bridge, I tried editing XML file but no success. Please post here if you have solved it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding Linux Computer To Home Network StreetRacer0491 Linux - General 2 06-25-2006 06:48 PM
adding guest mode to x server? linuxmandrake Linux - Software 3 12-01-2005 08:19 AM
Adding more computer to my network djgerbavore Linux - Networking 5 08-16-2005 09:09 PM
Adding computer to network HadesThunder General 3 06-30-2004 04:14 AM
shutting down computer w/o KVM jonfa Linux - Networking 6 05-29-2001 06:48 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration