You are not logged in.

#1 2010-03-12 23:39:26

jb
Member
From: Florida
Registered: 2006-06-22
Posts: 466

Manually specifying mac for tap device used by qemu

I've followed the wiki entry on using tap networking and everything seems to be working fine.  However, it seems that tap0 is given a random mac address every time its run, and the network this server is on uses a mac address white list to get an ip.

I tried adding to the 4th line in /etc/qemu-ifup so that it looked like this:

sudo /sbin/ifconfig $1 0.0.0.0 promisc up hw ether 00:26:B9:43:9C:06

but that just caused the error "SIOCSIFHWADDR: Device or resource busy".  Has anyone accomplished this or know where it's possible to specify one?

Thanks.


...

Offline

#2 2010-03-26 18:43:26

jb
Member
From: Florida
Registered: 2006-06-22
Posts: 466

Re: Manually specifying mac for tap device used by qemu

Not to post bump, but I found a solution to the initial problem; one that implies I'll need to make a qemu-ifup for each vm.  Here's what I changed.

#!/bin/sh
#/etc/qemu-ifup
echo "Executing/etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
sudo /sbin/ifconfig $1 hw ether 00:26:B9:43:9C:08
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0..."
sudo /usr/sbin/brctl addif br0 $1
sleep 2
#!/bin/bash
#~/qemu-prototype
USERID=`whoami`
IFACE=`sudo tunctl -b -u $USERID`
qemu-kvm -net nic,macaddr=00:26:B9:43:9C:08 -net tap,ifname="$IFACE" -cpu kvm64 -m 512 -smp 2 -hda prototype.arch64.qcow2 -vnc :1
$*
sudo tunctl -d $IFACE # &> /dev/null

But now even with a white-listed mac address, I still can't get a network connection in the vm.  And by that, I mean /etc/rc.d/network fails to get an IP, and dhcpcd just reports a timeout.  Here's what the host's ifconfig output shows.  Anyone know if this is what should look like (or if further info is needed to answer)?

[cave@aperture ~]$ ifconfig                                                                                                                                             
br0       Link encap:Ethernet  HWaddr 00:26:B9:43:9C:02                                                                                                                 
          inet addr:163.118.<snip />  Bcast:163.118.<snip /> Mask:255.255.255.0                                                                                            
          inet6 addr: fe80::226:b9ff:fe43:9c02/64 Scope:Link                                                                                                            
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                            
          RX packets:26126236 errors:0 dropped:0 overruns:0 frame:0                                                                                                     
          TX packets:8243 errors:0 dropped:0 overruns:0 carrier:0                                                                                                       
          collisions:0 txqueuelen:0                                                                                                                                     
          RX bytes:2005110288 (1912.2 Mb)  TX bytes:1968718 (1.8 Mb)                                                                                                    
                                                                                                                                                                        
eth0      Link encap:Ethernet  HWaddr 00:26:B9:43:9C:02                                                                                                                 
          inet6 addr: fe80::226:b9ff:fe43:9c02/64 Scope:Link                                                                                                            
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                            
          RX packets:26126530 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8590 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:2475473294 (2360.7 Mb)  TX bytes:2049752 (1.9 Mb)
          Interrupt:36 Memory:da000000-da012800 

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:141 errors:0 dropped:0 overruns:0 frame:0
          TX packets:141 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:24816 (24.2 Kb)  TX bytes:24816 (24.2 Kb)

tap0      Link encap:Ethernet  HWaddr 00:26:B9:43:9C:08  
          inet6 addr: fe80::226:b9ff:fe43:9c08/64 Scope:Link
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:12 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1391112 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:500 
          RX bytes:4104 (4.0 Kb)  TX bytes:125533941 (119.7 Mb)

...

Offline

Board footer

Powered by FluxBB