LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 07-07-2017, 07:06 AM   #1
Semant1ka
LQ Newbie
 
Registered: Jul 2017
Posts: 3

Rep: Reputation: Disabled
Question Why Qemu brings tap interface down after exit


I want to set up tap device and then use this device instead of calling network setup script everytime qemu starts.

Code:
#!/bin/sh

sudo ip tuntap add tap0 mode tap
sudo ip link set dev tap0 up
sudo ip addr add 192.168.1.1/24 dev tap0
After tap0 created I start qemu like this:

Code:
$QEMU -m 768 -machine vexpress-a15 -serial stdio -net nic -net tap,ifname=tap0,script=no,downscript=no $user_flags -kernel $image_path/$image_name
However, after I am closing qemu tap0 interface goes down with its ip address removed from ip table, so instead of calling script above one time, I have to pass it as argument.

I wonder why so? How can I create persistent (at least till next reboot) tap interface for qemu? Qemu even doesn't have rights to change OS network settings, so it seems that OS itself switches off tap device.
My current OS is Debian Jessie.
 
Old 07-07-2017, 09:16 AM   #2
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
Because, for persistent changes you must edit /etc/network/interfaces. And probably disable network-manager. Explained here: https://wiki.debian.org/QEMU.
 
Old 07-07-2017, 10:02 AM   #3
Semant1ka
LQ Newbie
 
Registered: Jul 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
This device is not managed by network manager I guess

Code:
sudo nmcli dev status       
eth0    ethernet  connected     Wired connection 2 
eth1    ethernet  disconnected  --                 
wlan0   wifi      disconnected  --                 
lo      loopback  unmanaged     --                 
tap0    tap       unmanaged     --
I also added lines below to /etc/network/interfaces and this didn't help, maybe I forgot to add something

Code:
allow-hotplug tap0
iface tap0 inet manual
 pre-up ip tuntap add tap0 mode tap user root
 pre-up ip addr add 192.168.1.1/24 dev tap0
 up ip link set dev tap0 up
 
Old 07-07-2017, 10:23 AM   #4
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
How about following that wiki article step by step? Did you install bridge-utils package? And then change your configuration to match that on the wiki.
 
Old 07-07-2017, 11:04 AM   #5
Semant1ka
LQ Newbie
 
Registered: Jul 2017
Posts: 3

Original Poster
Rep: Reputation: Disabled
Maybe I am missing something from the wiki but I do not need and even do not want bridge or VDE, and can't see how repeating steps with bridge will help. And letting qemu to my company's network will be super bad and unwanted step, I need local network between qemu and host.
 
Old 07-07-2017, 01:09 PM   #6
dejank
Member
 
Registered: May 2016
Location: Belgrade, Serbia
Distribution: Debian
Posts: 229

Rep: Reputation: Disabled
Without bridging, you can not do it like that, or at least I do not know how. Perhaps if you add some settings into the /etc/qemu-ifup, but not sure about it. You could do it with bridging, but without connecting your network device ( eth0 for example ) to the bridge. That should allow connection within host and guests connected to the bridge, but guests will not be able to see outside of that "localized" network.
 
  


Reply



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
[SOLVED] qemu tun/tap problem running from qemu on slackware 14.2 64bit timsoft Slackware 5 09-25-2016 07:46 PM
[SOLVED] Switching to TUN / TAP for KVM / QEMU - need some help fruitwerks Gentoo 2 09-21-2014 08:16 PM
[SOLVED] Bridging tap interface with ethernet interface rjm1 Linux - Networking 9 09-13-2013 09:29 AM
[SOLVED] KVM Qemu instance bridged tap interface disconnects, cutting me off from the guest rylan76 Linux - Virtualization and Cloud 1 11-07-2012 06:35 AM
Bridge between ethernet interface and tap interface jayadhanesh Linux - Networking 3 04-12-2009 11:32 PM

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

All times are GMT -5. The time now is 12:11 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
Open Source Consulting | Domain Registration