From: kraxel@suse.de
To: xen-devel@lists.xensource.com
Subject: [patch] Add support for "hostonly" xen bridges.
Date: Thu, 05 Oct 2006 10:48:58 +0200 [thread overview]
Message-ID: <20061005084855.290691000@suse.de> (raw)
[-- Attachment #1: bridge-hostonly.diff --]
[-- Type: text/plain, Size: 2125 bytes --]
Add support for "hostonly" networking, i.e. create a bridge without a
physical network device linked in. The virtual machines can see each
other and the host, but can't (directly) talk to the outside. Pass
"netdev=none" to the network-bridge script to activate this.
I'm using this on a laptop which has different network connections at
different times (wired / wireless), so it is inconvinient to add the
physical device into the bridge. In case the laptop is offline the
virtual network still works just fine. It also avoids the problem that
bridging doesn't work with wireless due to being limited to one mac
address then.
dom0 on that laptop also runs a dhcp server for the virtual network.
Guests can talk to the internet via apache configured as http proxy.
Another possible approach for guest internet access is NATing the
virtual network.
---
tools/examples/network-bridge | 37 +++++++++++++++++++++++++++++++++++--
1 file changed, 35 insertions(+), 2 deletions(-)
Index: build-32-unstable-11624/tools/examples/network-bridge
===================================================================
--- build-32-unstable-11624.orig/tools/examples/network-bridge
+++ build-32-unstable-11624/tools/examples/network-bridge
@@ -269,6 +269,31 @@ op_stop () {
brctl delbr ${bridge}
}
+op_start_hostonly () {
+ if [ "${bridge}" = "null" ] ; then
+ return
+ fi
+ if link_exists "${bridge}"; then
+ return
+ fi
+
+ create_bridge ${bridge}
+ setup_bridge_port ${vif0}
+ add_to_bridge ${bridge} ${vif0}
+}
+
+op_stop_hostonly () {
+ if [ "${bridge}" = "null" ]; then
+ return
+ fi
+ if ! link_exists "$bridge"; then
+ return
+ fi
+
+ brctl delbr ${bridge}
+}
+
+
# adds $dev to $bridge but waits for $dev to be in running state first
add_to_bridge2() {
local bridge=$1
@@ -293,11 +318,19 @@ add_to_bridge2() {
case "$command" in
start)
- op_start
+ if test "$netdev" = "none"; then
+ op_start_hostonly
+ else
+ op_start
+ fi
;;
stop)
- op_stop
+ if test "$netdev" = "none"; then
+ op_stop_hostonly
+ else
+ op_stop
+ fi
;;
status)
--
next reply other threads:[~2006-10-05 8:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-05 8:48 kraxel [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-10-20 8:36 [patch] Add support for "hostonly" xen bridges kraxel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061005084855.290691000@suse.de \
--to=kraxel@suse.de \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.