LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 03-22-2017, 10:51 PM   #1
end
Member
 
Registered: Aug 2016
Posts: 228

Rep: Reputation: Disabled
qemu network same ip


hy

i run qemu like this but for every machine he give same ip. xml file of virbr0 have dhcp range.

when i run with virsh i dont have this problem just when run like this

Code:
 qemu-system-x86_64 -vga std -nographic  -vnc :2 -m 1G -smp 4 -enable-kvm -drive format=raw,file=/home/ja/vm/kali.img -usbdevice tablet  -net bridge,br=virbr0  -net nic,model=virtio   &
 
Old 03-23-2017, 12:20 AM   #2
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Kako si bio moj prijatelj?

Do you have dnsmasq installed to act as your dhcp front-end?

You know I do love a good manual...

Virsh is chatting up libvirt, which has an internal dhcp capability.
 
Old 03-23-2017, 09:52 AM   #3
end
Member
 
Registered: Aug 2016
Posts: 228

Original Poster
Rep: Reputation: Disabled
re

good my frend good expect this kind of problems. how are you? where are you from by the way i need put you in some place on earth

i have problem with this dnsmasq i set it up and bind to virbr0, remove default.xml that virsh use. and when i start virsh net-start default he pull same config like xml is still there. is there another way to start virbr0 interface.

actualy dont bother with this.

new approach

if i create vlan like this https://wiki.archlinux.org/index.php/VLAN

how to use that interface in qemu command

Last edited by end; 03-23-2017 at 10:08 AM.
 
Old 03-23-2017, 02:10 PM   #4
end
Member
 
Registered: Aug 2016
Posts: 228

Original Poster
Rep: Reputation: Disabled
hy

in libvirt network default.xml i remove dhcp options, in dns masq.conf set interface to virbr0 and add dhcp-range. when run vm they dont get ip no problem i ad it manually have internet acces just these two machine canot ping or comunicate in any way.
 
Old 03-24-2017, 07:24 PM   #5
end
Member
 
Registered: Aug 2016
Posts: 228

Original Poster
Rep: Reputation: Disabled
what i try

kill all dnsmasq process, then

Code:
dnsmasq --interface=virbr0 --bind-interfaces --dhcp-range=192.168.122.2,192.168.122.10
start vm

Code:
 qemu-system-x86_64 -vga std -display none -vnc :1 -m 2G -smp 2 -enable-kvm -drive format=raw,file=/home/ja/vm/w7.img -usbdevice tablet  -net bridge,br=virbr0 -net nic,model=virtio
dhcp gives same ip to this vm and another. if i change it manually ping whant work.if i kill dnsmasq and start vm ip is not given.

then i try

Code:
qemu-system-x86_64 -vga std -nographic  -vnc :2 -m 1G -smp 4 -enable-kvm 
-drive format=raw,file=/home/ja/vm/kali.img -usbdevice tablet  -net 
bridge,br=virbr0,net=192.168.122.0/24,host=192.168.122.1,dhcpstart=192.168.122.10   
-net nic,model=virtio
when dnsmssq is on above code ignores ip setup and use dnsmasq, when dnsmasq is off above code again gives same ip.

then i try user mode

Code:
qemu-system-x86_64 -vga std -nographic  -vnc :2 -m 1G -smp 4 
-enable-kvm -drive format=raw,file=/home/ja/vm/kali.img -usbdevice 
tablet  -net 
user,net=192.168.122.0/24,host=192.168.122.1,dhcpstart=192.168.122.10   
-net nic,model=virtio
again give same ip if i change dhcpstart when running second vm to 192.168.122.9 again canot ping. i reed that in user mode network ping whant work, but i have some python scripts with tcp socket connection that i testing beatwen vm's from any script i canot make connections beatwen vm's. firewall off or on with forwarded options on virbr0 same problem.

note:

when i use virsh to start vm's no problem in communication in any way. but virsh slow down my comp with 2 vm's i cannot nothing.

Prichiated

edited:

now i created tap and tap1 interfacewith same subnet 192.168.1.1/24

in dnsmasq.conf i added

interface=tap
interface=tap1

dhcprange=iprange
dhcprange=iprange

again dnsmasq gives same ip to boath vm's. so defenetly problem with dnsmasq.

edited:

i can do thing like this

tap=192.168.1.1
tap1=192.168.2.1

dnsmasq

interface=tap
interface=tap1

dhcprange=192.168.1.2,192.168.1.10,12h
dhcprange=192.168.2.2,192.168.2.10,12h

Code:
iptables -I INPUT -i tap -j ACCEPT
iptables -I OUTPUT -o tap -j ACCEPT

iptables -I INPUT -i tap1  -j ACCEPT
iptables -I OUTPUT -o tap1  -j ACCEPT

iptables -I FORWARD -i tap -o tap1 -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
iptables -I FORWARD -i tap1 -o tap  -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
Code:
sudo   qemu-system-x86_64 -vga std -nographic  -vnc :2 -m 1G -smp 4 
-enable-kvm -drive format=raw,file=/home/ja/vm/kali.img -usbdevice 
tablet  -net nic,model=virtio -net 
tap,ifname=tap,script=no,downscript=no
this way comunication beatwen vm's work.

So if anyone know way dnsmasq giving same ip to two different machines i will prichiated. even i like most last solution, its complicating life beacouse i only test python scripts beatwen vm's. And maybe in future i will need dnsmasq to work proper.

thanks

Last edited by end; 03-24-2017 at 08:26 PM.
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Set up qemu-kvm-1.0+noroms as spice enabled qemu server vs qemu-kvm-spice on Ubuntu Precise LXer Syndicated Linux News 0 05-26-2012 08:41 AM
qemu network configuration jheengut Linux - Virtualization and Cloud 3 04-07-2012 02:21 AM
[SOLVED] Network driver for qemu network in linux 3.0.4 prushik Linux - Software 3 10-18-2011 08:36 AM
qemu network emulation vishesh Linux - Kernel 9 03-25-2009 06:36 AM
Qemu network setup. xode Linux - Networking 1 06-15-2006 03:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 03:53 AM.

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