Re: QEMU networking quirkiness on 7.0
On Thu, Apr 17, 2008 at 1:40 PM, Mario Lobo [EMAIL PROTECTED] wrote: On Thursday 17 April 2008, Jim Stapleton wrote: Sorry for the delayed reply, I didn't see this sent. On Thursday 10 April 2008 22:01:32 Mario Lobo wrote I have a virtual Linux (Fedora 5) and winedows (XP) machines in QEMU and they are both network functional. I use qemu-launch because it does everything you need to create a virtual machine. Here are my pertinent configs: 1) # rc.conf ifconfig_re0=up polling - no IP here ! autobridge_interfaces=bridge0 autobridge_bridge0=tap0 re0 - important even if tap0 does not exist yet cloned_interfaces=bridge0 # the bridge gets the IP ifconfig_bridge0=inet 10.10.10.2 netmask 255.255.255.0 To verify, the 10.10.10.2 is the IP that everyone sees my host as on the network, correct? That's the IP that used to be set on re0? exactly ! 2) tell QEMU launch to open a tap device Open a TUN/TAP interface in the network interface configuration yes 3) tap up script to run when invoking the machine(s). # qemu-net #!/usr/local/bin/bash $1 = tap ifac created /sbin/ifconfig $1 up # test if tap is already added TEST=`ifconfig -a | grep -A 6 bridge | grep $1` if [ $TEST == ]; then /sbin/ifconfig bridge0 addm $1 fi # add a route to the virtual machine /sbin/route add -host 10.10.10.100 -iface bridge0 This is the tun/tap configuration script, the IP on the last line is the IP I want the guest to look like to the network (i.e. 192.168.1.85)? correct ! You will configure the guest's network interface with this IP. Thanks, I'll play with this more when I get home (I don't want to mess with my machine's network configuration while I've only got network access). This worked so fine fine for me that I left the bridge as my main interface for good. Even if QEMU is not up. It works just as well as re0 itself. Thanks, -Jim Stapleton ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] You're welcome ! OK, I finally got to test it last night. It almost worked. I ran it from the console, and it spit out the command line. Something on the command line looked obviously off to me (I think it was the iface= part of the network section), anyway, I copied pasted it, added the tap0 reference, and it works perfectly. Thanks again, -Jim Stapleton ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
OK, I finally got to test it last night. It almost worked. I ran it from the console, and it spit out the command line. Something on the command line looked obviously off to me (I think it was the iface= part of the network section), anyway, I copied pasted it, added the tap0 reference, and it works perfectly. Thanks again, -Jim Stapleton All right, Jim !! Great ! if you use X, I think you could consider using qemu-launch. It is really handy. And it saves the configs for every particular guest you have and you can call any of them up at the tip of the mouse. -- Mario Lobo Segurança de Redes - Desenvolvimento e Análise IPAD - Instituto de Pesquisa e Apoio ao Desenvolvimento Tecnológico e Científico ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
Sorry for the delayed reply, I didn't see this sent. On Thursday 10 April 2008 22:01:32 Mario Lobo wrote I have a virtual Linux (Fedora 5) and winedows (XP) machines in QEMU and they are both network functional. I use qemu-launch because it does everything you need to create a virtual machine. Here are my pertinent configs: 1) # rc.conf ifconfig_re0=up polling - no IP here ! autobridge_interfaces=bridge0 autobridge_bridge0=tap0 re0 - important even if tap0 does not exist yet cloned_interfaces=bridge0 # the bridge gets the IP ifconfig_bridge0=inet 10.10.10.2 netmask 255.255.255.0 To verify, the 10.10.10.2 is the IP that everyone sees my host as on the network, correct? That's the IP that used to be set on re0? 2) tell QEMU launch to open a tap device Open a TUN/TAP interface in the network interface configuration 3) tap up script to run when invoking the machine(s). # qemu-net #!/usr/local/bin/bash $1 = tap ifac created /sbin/ifconfig $1 up # test if tap is already added TEST=`ifconfig -a | grep -A 6 bridge | grep $1` if [ $TEST == ]; then /sbin/ifconfig bridge0 addm $1 fi # add a route to the virtual machine /sbin/route add -host 10.10.10.100 -iface bridge0 This is the tun/tap configuration script, the IP on the last line is the IP I want the guest to look like to the network (i.e. 192.168.1.85)? Thanks, I'll play with this more when I get home (I don't want to mess with my machine's network configuration while I've only got network access). Thanks, -Jim Stapleton ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
On Thursday 17 April 2008, Jim Stapleton wrote: Sorry for the delayed reply, I didn't see this sent. On Thursday 10 April 2008 22:01:32 Mario Lobo wrote I have a virtual Linux (Fedora 5) and winedows (XP) machines in QEMU and they are both network functional. I use qemu-launch because it does everything you need to create a virtual machine. Here are my pertinent configs: 1) # rc.conf ifconfig_re0=up polling - no IP here ! autobridge_interfaces=bridge0 autobridge_bridge0=tap0 re0 - important even if tap0 does not exist yet cloned_interfaces=bridge0 # the bridge gets the IP ifconfig_bridge0=inet 10.10.10.2 netmask 255.255.255.0 To verify, the 10.10.10.2 is the IP that everyone sees my host as on the network, correct? That's the IP that used to be set on re0? exactly ! 2) tell QEMU launch to open a tap device Open a TUN/TAP interface in the network interface configuration yes 3) tap up script to run when invoking the machine(s). # qemu-net #!/usr/local/bin/bash $1 = tap ifac created /sbin/ifconfig $1 up # test if tap is already added TEST=`ifconfig -a | grep -A 6 bridge | grep $1` if [ $TEST == ]; then /sbin/ifconfig bridge0 addm $1 fi # add a route to the virtual machine /sbin/route add -host 10.10.10.100 -iface bridge0 This is the tun/tap configuration script, the IP on the last line is the IP I want the guest to look like to the network (i.e. 192.168.1.85)? correct ! You will configure the guest's network interface with this IP. Thanks, I'll play with this more when I get home (I don't want to mess with my machine's network configuration while I've only got network access). This worked so fine fine for me that I left the bridge as my main interface for good. Even if QEMU is not up. It works just as well as re0 itself. Thanks, -Jim Stapleton ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] You're welcome ! -- Mario Lobo Segurança de Redes - Desenvolvimento e Análise IPAD - Instituto de Pesquisa e Apoio ao Desenvolvimento Tecnológico e Científico ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
OK, my stupid jokes aside, I got this result: # ifconfig re0: flags=8943UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST metric 0 mtu 1500 options=98VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM ether 00:1a:70:12:bc:55 inet 192.168.1.84 netmask 0xff00 broadcast 192.168.1.255 inet 192.168.1.85 netmask 0x broadcast 192.168.1.85 media: Ethernet autoselect (100baseTX full-duplex) status: active lo0: flags=8049UP,LOOPBACK,RUNNING,MULTICAST metric 0 mtu 16384 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 inet6 ::1 prefixlen 128 inet 127.0.0.1 netmask 0xff00 tap0: flags=8903UP,BROADCAST,PROMISC,SIMPLEX,MULTICAST metric 0 mtu 1500 ether 00:bd:cd:fd:1a:00 bridge0: flags=8802BROADCAST,SIMPLEX,MULTICAST metric 0 mtu 1500 ether 8e:31:f1:19:61:13 id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200 root id 00:00:00:00:00:00 priority 0 ifcost 0 port 0 member: re0 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP member: tap0 flags=143LEARNING,DISCOVER,AUTOEDGE,AUTOPTP # cat WinXP\ VM #!/bin/sh qemu -boot c -net nic -net tap -hda /data/WinXP.img -m 512 -soundhw es1370 -localtime -smb /data/ # ./WinXP\ VM warning: could not open /dev/tap4 (No such file or directory): no virtual network emulation Could not initialize device 'tap' [EMAIL PROTECTED] 02:11:26 (1) ~/Desktop ls -lh /etc/ | grep qemu; cat /etc/qemu-ifup -rwxr-xr-x 1 root wheel 18 Apr 10 11:35 qemu-ifup* ifconfig ${1} up I tried to create tap4 to fix this, then it complained about tap5 not existing. It creates the /dev/tap device it wants when there is an error. I figure I made a mistake (obviously), any ideas what? Thanks, -JIm Stapleton ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
Hi Mario, 1) # rc.conf ifconfig_re0=up polling - no IP here ! autobridge_interfaces=bridge0 autobridge_bridge0=tap0 re0 - important even if tap0 does not exist yet cloned_interfaces=bridge0 # the bridge gets the IP ifconfig_bridge0=inet 10.10.10.2 netmask 255.255.255.0 2) tell QEMU launch to open a tap device 3) tap up script to run when invoking the machine(s). # qemu-net #!/usr/local/bin/bash $1 = tap ifac created /sbin/ifconfig $1 up # test if tap is already added TEST=`ifconfig -a | grep -A 6 bridge | grep $1` if [ $TEST == ]; then /sbin/ifconfig bridge0 addm $1 fi # add a route to the virtual machine /sbin/route add -host 10.10.10.100 -iface bridge0 Set the gateway on both machines to the same gateway of the host. That's all. This works perfectly for me. If I want both virtual machines up, I have to add another route to the IP of the second machine through the bridge. I don't really understand why you need routing here. In my understanding a bridge works like a layer 2 switch so there should be no need for any routing. Cheers, Andrew -- accid.net ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
On Friday 11 April 2008 07:17:21 you wrote: Hi Mario, 1) # rc.conf ifconfig_re0=up polling - no IP here ! autobridge_interfaces=bridge0 autobridge_bridge0=tap0 re0 - important even if tap0 does not exist yet cloned_interfaces=bridge0 # the bridge gets the IP ifconfig_bridge0=inet 10.10.10.2 netmask 255.255.255.0 2) tell QEMU launch to open a tap device 3) tap up script to run when invoking the machine(s). # qemu-net #!/usr/local/bin/bash $1 = tap ifac created /sbin/ifconfig $1 up # test if tap is already added TEST=`ifconfig -a | grep -A 6 bridge | grep $1` if [ $TEST == ]; then /sbin/ifconfig bridge0 addm $1 fi # add a route to the virtual machine /sbin/route add -host 10.10.10.100 -iface bridge0 Set the gateway on both machines to the same gateway of the host. That's all. This works perfectly for me. If I want both virtual machines up, I have to add another route to the IP of the second machine through the bridge. I don't really understand why you need routing here. In my understanding a bridge works like a layer 2 switch so there should be no need for any routing. Cheers, Andrew I don't know exactly why. What I know is if I don't, it doesn't work. I think it's because the virtual machine is on the same subnet of the bridge and the host is not configured as a gateway. -- Mario Lobo http://www.mallavoodoo.com.br FreeBSD since version 2.2.8 [not Pro-Audio YET!!] (99,7% winedows FREE) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
Yes, this needs to be setup on the host system. The way a bridge is configured has changed on 7. Here are the steps assuming that your external interface is em0: # ifconfig tap0 create # ifconfig tap0 up # ifconfig em0 up # ifconfig bridge0 create # ifconfig bridge0 addm tap0 addm em0 Now tap0 and em0 are bridged together. You should configure your external IP on the bridge instead of em0 as you normally would. If you use DHCP then: # dhclient bridge0 Forgot to add that you'll also need to create the /etc/qemu-ifup script, otherwise this won't work. That's what the script should look like: #!/bin/sh ifconfig ${1} up Don't forget to make it executable: # chmod 755 /etc/qemu-ifup And start qemu: # qemu -boot c -net nic -net tap -hda path_to_your_disk_image Now the VM should be able to see your LAN and get an IP from DHCP (if that's what you use on your LAN) -- accid.net ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
Hi Jim, I just CPed a huge section and tacked it on to the end of this mail. It says to do this within the emulator, but the emulator is supposedly running win2k. I take it this is done on the host system? Yes, this needs to be setup on the host system. The way a bridge is configured has changed on 7. Here are the steps assuming that your external interface is em0: # ifconfig tap0 create # ifconfig tap0 up # ifconfig em0 up # ifconfig bridge0 create # ifconfig bridge0 addm tap0 addm em0 Now tap0 and em0 are bridged together. You should configure your external IP on the bridge instead of em0 as you normally would. If you use DHCP then: # dhclient bridge0 And start qemu: # qemu -boot c -net nic -net tap -hda path_to_your_disk_image Now the VM should be able to see your LAN and get an IP from DHCP (if that's what you use on your LAN) Hope this helps, Andrew -- accid.net ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
Yes, this needs to be setup on the host system. The way a bridge is configured has changed on 7. Here are the steps assuming that your external interface is em0: Well, it seems pretty calm, and hasn't tried to cut itself yet... But I think I can adapt. # ifconfig tap0 create # ifconfig tap0 up # ifconfig em0 up # ifconfig bridge0 create # ifconfig bridge0 addm tap0 addm em0 Could I mimic this in RC.conf? Or is this saved between restarts? Also, for the bridge, could I do this, correct? #existing rc.conf hostname=elrond.var-dev.net ifconfig_re0=inet 192.168.1.84 netmask 255.255.255.0 ifconfig_re0_alias0=192.168.1.85 netmask 255.255.255.255 defaultrouter=192.168.1.1 #adding... Should I use an IP not aliased by re0? ifconfig_bridge0=inet 192.168.1.85 netmask 255.255.255.0 Thanks for your help, -Jim Stapleton ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
On Thursday 10 April 2008 12:33:29 Jim Stapleton wrote: Yes, this needs to be setup on the host system. The way a bridge is configured has changed on 7. Here are the steps assuming that your external interface is em0: Well, it seems pretty calm, and hasn't tried to cut itself yet... But I think I can adapt. # ifconfig tap0 create # ifconfig tap0 up # ifconfig em0 up # ifconfig bridge0 create # ifconfig bridge0 addm tap0 addm em0 Could I mimic this in RC.conf? Or is this saved between restarts? Also, for the bridge, could I do this, correct? #existing rc.conf hostname=elrond.var-dev.net ifconfig_re0=inet 192.168.1.84 netmask 255.255.255.0 ifconfig_re0_alias0=192.168.1.85 netmask 255.255.255.255 defaultrouter=192.168.1.1 #adding... Should I use an IP not aliased by re0? ifconfig_bridge0=inet 192.168.1.85 netmask 255.255.255.0 Thanks for your help, -Jim Stapleton ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED] I have a virtual Linux (Fedora 5) and winedows (XP) machines in QEMU and they are both network functional. I use qemu-launch because it does everything you need to create a virtual machine. Here are my pertinent configs: 1) # rc.conf ifconfig_re0=up polling - no IP here ! autobridge_interfaces=bridge0 autobridge_bridge0=tap0 re0 - important even if tap0 does not exist yet cloned_interfaces=bridge0 # the bridge gets the IP ifconfig_bridge0=inet 10.10.10.2 netmask 255.255.255.0 2) tell QEMU launch to open a tap device 3) tap up script to run when invoking the machine(s). # qemu-net #!/usr/local/bin/bash $1 = tap ifac created /sbin/ifconfig $1 up # test if tap is already added TEST=`ifconfig -a | grep -A 6 bridge | grep $1` if [ $TEST == ]; then /sbin/ifconfig bridge0 addm $1 fi # add a route to the virtual machine /sbin/route add -host 10.10.10.100 -iface bridge0 Set the gateway on both machines to the same gateway of the host. That's all. This works perfectly for me. If I want both virtual machines up, I have to add another route to the IP of the second machine through the bridge. I did not need to set up samba to access the local drives because I already have a samba server on the gateway and both the host and the guests can see it, and of course, is one less thing to set up at the host. My 2 cents. Hope it helps ! -- Mario Lobo http://www.mallavoodoo.com.br FreeBSD since version 2.2.8 [not Pro-Audio YET!!] (99,7% winedows FREE) ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
Hi Jim, The QEmu VM can access the web (I'm typing this out now in WindowsXP running safely in it's cage, for example). But it cannot VPN into work (timeout) or ping anything. I suspect it has to do with the way that QEmu is given network access. Is there any way to set up QEmu to access the network through an aliased IP address, and hence look like any other machine on my network, rather than to hide behind my BSD box? Is there another route I should take?+ I connect my qemu boxes via the tap interface and then bridge it to the external interface so it works like just another box on the LAN. It's quite easy to setup and works pretty well, checkout: http://people.freebsd.org/~maho/qemu/qemu.html Give us a shout if you get stuck. Andrew. -- accid.net ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
On Wed, 9 Apr 2008 10:18:59 +0100 Andrew Cid [EMAIL PROTECTED] wrote: Hi Jim, The QEmu VM can access the web (I'm typing this out now in WindowsXP running safely in it's cage, for example). But it cannot VPN into work (timeout) or ping anything. I suspect it has to do with the way that QEmu is given network access. Is there any way to set up QEmu to access the network through an aliased IP address, and hence look like any other machine on my network, rather than to hide behind my BSD box? Is there another route I should take?+ I connect my qemu boxes via the tap interface and then bridge it to the external interface so it works like just another box on the LAN. It's quite easy to setup and works pretty well, checkout: http://people.freebsd.org/~maho/qemu/qemu.html ping fails because the qemu process runs as an ordinary user and ping requires root privileges (the ping binary runs setuid). The VPN problem may be simply due to qemu's use of NAT. I would suggest you familiarise yourself with any NAT/firewall issues for your VPN before switching to tap. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
Re: QEMU networking quirkiness on 7.0
On Wed, Apr 9, 2008 at 9:18 AM, Andrew Cid [EMAIL PROTECTED] wrote: Hi Jim, The QEmu VM can access the web (I'm typing this out now in WindowsXP running safely in it's cage, for example). But it cannot VPN into work (timeout) or ping anything. I suspect it has to do with the way that QEmu is given network access. Is there any way to set up QEmu to access the network through an aliased IP address, and hence look like any other machine on my network, rather than to hide behind my BSD box? Is there another route I should take?+ I connect my qemu boxes via the tap interface and then bridge it to the external interface so it works like just another box on the LAN. It's quite easy to setup and works pretty well, checkout: http://people.freebsd.org/~maho/qemu/qemu.html I just CPed a huge section and tacked it on to the end of this mail. It says to do this within the emulator, but the emulator is supposedly running win2k. I take it this is done on the host system? Thanks, -Jim Stapleton Networking Default, network is configured inside of the emulator; not visible from outside. This is not absolutely confotable! There are pros and cons: you must be the root and your qemu virtual machine is visible from outside. Assume you know your network interface name. In my case this is fxp0. you can check this by: % dmesg | grep Ethernet First, as root, # kldload bridge.ko # sysctl net.link.ether.bridge_cfg=fxp0,tap0 net.link.ether.bridge_cfg: - fxp0,tap0 # sysctl net.link.ether.bridge.enable=1 net.link.ether.bridge.enable: 0 - 1 create /etc/qemu-ifup script as #!/bin/sh ifconfig ${1} 0.0.0.0 and make this script runnable. # chmod 755 /etc/qemu-ifup To do this at every boot time, write /etc/sysctl.conf net.link.ether.bridge_cfg=fxp0,tap0 net.link.ether.bridge.enable=1 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]
QEMU networking quirkiness on 7.0
I'm not sure if this is QEmu or FreeBSD. I have a fairly boring 7.0/i386 setup. The QEmu VM can access the web (I'm typing this out now in WindowsXP running safely in it's cage, for example). But it cannot VPN into work (timeout) or ping anything. I suspect it has to do with the way that QEmu is given network access. Is there any way to set up QEmu to access the network through an aliased IP address, and hence look like any other machine on my network, rather than to hide behind my BSD box? Is there another route I should take?+ Thanks, -Jim Stapleton ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to [EMAIL PROTECTED]