View previous topic :: View next topic |
Author |
Message |
Tanktalus Tux's lil' helper
Joined: 27 Apr 2005 Posts: 86
|
Posted: Fri Nov 16, 2012 9:06 pm Post subject: KVM, NAT, ssh into VM |
|
|
I've got this setup with VirtualBox, but I'd like to try getting it to work with KVM instead, partly just to get rid of Oracle and partly just to learn more about KVM.
I run a VirtualBox VM which has another distro of Linux in it. Once it starts up, I can ssh into it (-p 2222, though it's on port 22 in the VM, and should only work from localhost) and run X apps through that ssh tunnel. The applications running in the VM have access to my real machine's VPN since it's using NAT.
So I've managed to get QEMU/KVM running the same VirtualBox disk image. If I ssh from that image to a machine behind the VPN, it seems to work using vde/slirpvde (but ping doesn't work?). However, I haven't yet figured out how to allow my real machine to ssh into the VM.
I'd also like to be able to expose my DNS server on my main machine to the VM, but without exposing it to any other machines on the network (since no other machine has access to the VPN, and that DNS server handles redirections to the internal network behind the VPN). If I can't get that to work, I'll just have the VM only use the VPN DNS (this works now), so it's not critical.
Any advice would be appreciated. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 21908
|
Posted: Fri Nov 16, 2012 10:02 pm Post subject: |
|
|
Please post the command line you use to start the VM. |
|
Back to top |
|
|
Tanktalus Tux's lil' helper
Joined: 27 Apr 2005 Posts: 86
|
Posted: Sat Nov 17, 2012 2:00 am Post subject: |
|
|
Not much to it. I think this means it gets to use 2 CPUs (I have 4) and 1GB RAM (also not an issue, I have 12GB).
Code: | qemu-kvm -net vde -net nic,macaddr=00:00:00:00:00:01 -smp 2 -m 1024 *.vdi |
|
|
Back to top |
|
|
toralf Developer
Joined: 01 Feb 2004 Posts: 3925 Location: Hamburg
|
Posted: Sat Nov 17, 2012 9:23 am Post subject: |
|
|
I'm using a TAP device : Code: | qemu-kvm --name foo -m 2047 -hda ~/virtual/kvm/foo.img -cdrom ~/Downloads/tails-i386.iso -boot d -smp 2 -net nic,vlan=0,model=virtio -net tap,vlan=0,ifname=tap3,script=no,downscript=no -vga qxl -spice port=5930,disable-ticketing | to start a KVM image on my host, then I'm able to ssh from the guest to my host.
The TAP device I created via gentoo's way : Code: | # /etc/conf.d/net
#
# KVM
#
bridge_br0="tap0 tap1 tap2 tap3"
config_br0="192.168.0.254/16"
brctl_br0="setfd 0
sethello 10
stp off"
rc_net_br0_need="net.tap0 net.tap1 net.tap2 net.tap3"
config_tap0="null"
tuntap_tap0="tap"
tunctl_tap0="-u tfoerste"
...
# LAN
#
config_eth0="null"
|
|
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|