Bug 1147238

Summary: [RFE] configure the IP for type='user' interface
Product: Red Hat Enterprise Linux 7 Reporter: lcheng
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.1CC: dyuan, hhuang, honzhang, huding, juzhang, mzhan, qiguo, rbalakri, virt-maint, xfu
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-05-15 11:44:14 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description lcheng 2014-09-28 10:36:37 UTC
Description of problem:
When a guest with two interfaces which are 'user' type, the two virtual NICs are assigned with the same ip in guest.


Version-Release number of selected component (if applicable):
libvirt-1.2.8-3.el7.x86_64
qemu-kvm-1.5.3-73.el7.x86_64
kernel-3.10.0-170.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. In host.
# virsh start a
Domain a started

# virsh dumpxml a | grep interface -A5
    <interface type='user'>
      <mac address='52:54:00:29:ae:b7'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <interface type='user'>
      <mac address='52:56:00:29:AE:99'/>
      <model type='virtio'/>
      <alias name='net1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </interface>
...

# ps -aux | grep qemu
...
-netdev user,id=hostnet0 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:29:ae:b7,bus=pci.0,addr=0x3 -netdev user,id=hostnet1 -device virtio-net-pci,netdev=hostnet1,id=net1,mac=52:56:00:29:ae:99,bus=pci.0,addr=0x6 
...

2. In guest.
[root@localhost ~]# ifconfig
eth38     Link encap:Ethernet  HWaddr 52:54:00:29:AE:B7
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::5054:ff:fe29:aeb7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:10178 (9.9 KiB)  TX bytes:1853 (1.8 KiB)

eth39     Link encap:Ethernet  HWaddr 52:56:00:29:AE:99
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::3656:ff:fe29:aeb7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1955 (1.9 KiB)  TX bytes:1358 (1.3 KiB)

...

Actual results:
As description.

Expected results:
The NICs are assigned with different ip in guest.

Comment 2 Vlad Yasevich 2014-10-01 20:31:55 UTC
This appears to be a configuration issue that is currently not supported by libvirt very well.  Qemu 'user' type network device, also known as SLIRP, has a  qemu built-in configuration that by default uses 10.0.2.0/24 network and provides
10.0.2.15 address to the guest.  This configuration can be changed throught
additional options passed to the '-netdev user' argument, but libvirt doesn't
currently support this.

You can try running this by hand and specifying:
   -netdev user,net=10.0.3.0/24,dhcpstart=10.0.3.15

Re-assigning to livirt for evaluation of support addtional slirp/user related options.

-vlad

Comment 4 Ján Tomko 2015-05-15 11:44:14 UTC

*** This bug has been marked as a duplicate of bug 1075520 ***