Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #186054

Create virtual ethernet devices on Debian 9 stretch ?

From Zenaan Harkness <zenaan@freedbms.net>
Newsgroups linux.debian.user
Subject Create virtual ethernet devices on Debian 9 stretch ?
Date 2017-08-28 07:00 +0200
Message-ID <ujkjw-Z2-21@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Riffing on the recent thread, here's the one I thought that was, and
wanted it to be. Alas, twas not so, and thus the inordinately
difficult and challanging task of creating a new thread is weighty
upon my shoulders.  So this is it :)


Have done quite a bit of research over the last couple months,
there's a -lot- of tech, plenty of it "fairly new" too.

Some years back, I ran openvpn to connect a few computers "securely"
(for wild "I hope this works as I cross my fingers" values of
"securely").  I have some vague recollection of creating tap and tun
devices.


"Right now" my aim is to run virt-manager or qemu, with kvm
underneath, with a host-only virtual network to which I shall connect
two virtual machines, and the host machine, and run some nfs or samba
thing to share folders between all 3.


My requisite is to have a sense of full control over my virtual
networking - this means setup and tear down primarily via
/etc/network/interfaces unless some other mechanism were more highly
recommended
- this means not relying on say the virt-manager gui

However, I'd also like to learn how to use the virt-manager gui to
create a single "host-only virtual network" instance for a virtual
machine (or two :)


The reason I want to learn how to do this virtual host-only network
with virt-manager gui, is so I can teach others, most of whom are
really only comfortable with a gui.

The reason I must learn how to do this virtual host-only network via
/e/n/i is for skills transfer - so that when I must manage a remote
host or VM in the future, I can readily do what I need to do via an
SSH cmd line (i.e. text only) interface.



Here are the examples/ snippets I've gleaned in the last few months:

## temporary ssh vpn:
iface tun0 inet static
   pre-up sleep 3
   address 10.3.3.1
   netmask 255.255.255.255
   pointopoint 10.3.3.3
   #up arp -sD 10.3.3.3 eth0 pub # perhaps just do NAT, eg, on
   server:
   up iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
   up echo "1" /proc/sys/net/ipv4/ip_forward
   down iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
   down echo "0" /proc/sys/net/ipv4/ip_forward
# alternative routing:
   #up ip route add 10.3.3.0/24 dev tun0 # this happens
   automatically
   up ip route add 10.1.1.0/24 dev tun0
   up ip route add 10.1.2.0/24 dev tun0
   down ip route del 10.1.1.0/24
   down ip route del 10.1.2.0/24


# Simple case; man bridge-utils-interfaces(5)
# Bridge interface to make VMs bridge to specific networks
auto br0
iface br0 inet dhcp
   bridge-ports eth0
   bridge-ports ve0
   bridge-ports all # WARNING, bridges all ethernet interfaces!


# Not so simple; virtual switch with host as gateway
# See http://debian-handbook.info/browse/stable/sect.virtualization.html
# Virtual interface
auto tap0
iface tap0 inet manual
  vde2-switch -t tap0


# Bridge for containers
auto br0
iface br0 inet static
  bridge-ports tap0
  address 10.0.0.1
  netmask 255.255.255.0


# See http://wiki.debian.org/QEMU#Host_and_guests_on_same_network
auto br0
iface br0 inet dhcp
   pre-up ip tuntap add dev tap0 mode tap user <username>
   pre-up ip link set tap0 up
   bridge_ports all tap0
   bridge_stp off
   bridge_maxwait 0
   bridge_fd      0
   post-down ip link set tap0 down
   post-down ip tuntap del dev tap0 mode tap


# qemu/kvm host only or private/ internal network:
#  - it's a form of "bridge" network - apt-get install bridge-utils
#  - ho0 is the (random) name chosen for this bridge device,
#    e.g. "hostonly0" might be a better memory jog
#  - 10.13.13.1 is the (random) host address for this network
auto ho0
iface ho0 inet static
   address     10.13.13.1
   netmask     255.255.255.0
   pre-up      brctl addbr ho0
   post-down   brctl delbr ho0



See also attached snippets file, with links and my initial notes
regarding differences of different virt networking systems.

AIUI I don't need any exotic networking to try to extract the last
few cycles of CPU performance, just functional, flexible, cmd-line/
text config style virtual networking to link a few virtual machines,
with an eye to remote admin of a host and/ or a few VMs.

Given so many options, and so many variations, I feel completely lost
at this point in time :(

Any suggestions as to which pathway/ program etc would be a
reasonably balanced pathway to follow, would be greatly appreciated.

TIA,
Zenaan

Back to linux.debian.user | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Create virtual ethernet devices on Debian 9 stretch ? Zenaan Harkness <zenaan@freedbms.net> - 2017-08-28 07:00 +0200
  Re: Create virtual ethernet devices on Debian 9 stretch ? Reco <recoverym4n@gmail.com> - 2017-08-28 15:20 +0200

csiph-web