Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

one way communication with kvm+macvlan

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
20 posts • Page 1 of 1
Author
Message
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

one way communication with kvm+macvlan

  • Quote

Post by _______0 » Tue Jun 04, 2013 3:11 pm

hi,

host macvlan
guest macvtap

I can ssh from guest to host but no the other way around.

Anyone know the trick for this?

thanks.
Top
John R. Graham
Administrator
Administrator
User avatar
Posts: 10898
Joined: Tue Mar 08, 2005 3:39 pm
Location: Somewhere over Winder, Georgia, USA

  • Quote

Post by John R. Graham » Tue Jun 04, 2013 3:20 pm

Did you set up both of these (virtual?) machines?

- John
I can confirm that I have received between 0 and 499 National Security Letters.
Top
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

  • Quote

Post by _______0 » Tue Jun 04, 2013 3:25 pm

macvlan (host is not virtual)
mavtap (guest is vm)

I don't understand your question. But the answer is of course it's set up. How else would I be able to ssh from guest to host?

To clarify my confusion, what exactly and which part do you mean by 'set up'?
Top
John R. Graham
Administrator
Administrator
User avatar
Posts: 10898
Joined: Tue Mar 08, 2005 3:39 pm
Location: Somewhere over Winder, Georgia, USA

  • Quote

Post by John R. Graham » Tue Jun 04, 2013 3:35 pm

Sorry; wn a little bit more detail, what I meant was, did you install Gentoo on both of these machines and do you have control over both of them?

- John
I can confirm that I have received between 0 and 499 National Security Letters.
Top
papahuhn
l33t
l33t
User avatar
Posts: 626
Joined: Mon Sep 06, 2004 9:14 am

Re: one way communication with kvm+macvlan

  • Quote

Post by papahuhn » Tue Jun 04, 2013 8:26 pm

_______0 wrote:hi,

host macvlan
guest macvtap

I can ssh from guest to host but no the other way around.

Anyone know the trick for this?

thanks.
If you have established an ssh session, then this is already two way communication, and macvlan/macvtap is irrelevant. How about iptables?
Death by snoo-snoo!
Top
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

Re: one way communication with kvm+macvlan

  • Quote

Post by _______0 » Sat Jun 08, 2013 3:53 pm

papahuhn wrote:
_______0 wrote:... How about iptables?
I am all ears.

There was a mistake on my post. The connection was established over a router so the bridge mod in macvlan wasn't doing what's supposed to do.

Is it possible to have two nics have a conversation with each other on the same computer with iptables? What part gets involved in this, routing, iptables?

To be honest the popular bridging method I don't see very elegant as it kills flexibility.

I've been reading some documentation and this huge thread, http://markmail.org/message/vudd7mvq3c5ze3j6 , but the they are quite incloncusive.

I need VM's to be able to talk to each other as well to host without a router being involved. ssh'ing is better than bloated desktop, sometimes the kvm hangs and my mouse and keyboard get stuck inside and I have to reboot!!!

macvlan has three modes one which is bridge which is independent from external router/switch.

One guy claims it works, http://lists.gnu.org/archive/html/qemu- ... 02687.html ,
Right, but if I set IP(eth0) == IP(macvlan0), I'm able to communicate
between macvlan0 and mactapX, thus between guest and host. Just
re-checked here, still works (after resolving the usual MAC address mess
I caused by configuring manually).
Actually even with traditional method using brctl there's gotta be an ip in common where both interface are able to talk. The routing part perhaps?

I think I am not doing this properly, just assigning an ip to macvlans and setting them in bridge mode is not enough? Thinking about it makes sense an extra framework for communication.

thanks
Top
papahuhn
l33t
l33t
User avatar
Posts: 626
Joined: Mon Sep 06, 2004 9:14 am

  • Quote

Post by papahuhn » Sat Jun 08, 2013 6:15 pm

There was a mistake on my post. The connection was established over a router so the bridge mod in macvlan wasn't doing what's supposed to do.
Ok, this changes things. I just googled that your problem is "defined behaviour": http://wiki.libvirt.org/page/Guest_can_ ... _(macvtap)

I can't help you with this by other means than googling, sorry.

Actually even with traditional method using brctl there's gotta be an ip in common where both interface are able to talk. The routing part perhaps?
With a traditional bridge, the host needs a route on that bridge towards the networks that are configured inside the VMs - typically by assigning br0 an IP address from those networks.
Death by snoo-snoo!
Top
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

  • Quote

Post by _______0 » Wed Jun 19, 2013 4:29 pm

papahuhn wrote:With a traditional bridge, the host needs a route on that bridge towards the networks that are configured inside the VMs - typically by assigning br0 an IP address from those networks.
can you show an example or some steps for this?
Top
papahuhn
l33t
l33t
User avatar
Posts: 626
Joined: Mon Sep 06, 2004 9:14 am

  • Quote

Post by papahuhn » Wed Jun 19, 2013 4:50 pm

Code: Select all

root@host:~ ip a sh virbr1 | grep "inet "
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr1
root@host:~ brctl show
bridge name	bridge id		STP enabled	interfaces
virbr0		8000.047d7b9219be	no		eth0
virbr1		8000.fe54008b8897	no		vnet0
root@host:~ # vnet0 is the VMs host-side interface
root@host:~ # in this case, I don't bridge the VM with my physical network
root@host:~ # but with potential other VMs (currently not running)
root@host:~ route -n | grep virbr1
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 virbr1
root@host:~ ssh 192.168.122.124
root@192.168.122.124's password: 
Last login: Wed Jun 19 18:39:04 2013
[root@centos64 ~]# ip a sh eth0 | grep "inet "
    inet 192.168.122.124/24 brd 255.255.255.255 scope global eth0
[root@centos64 ~]# route -n
Kernel IP Routentabelle
Ziel            Router          Genmask         Flags Metric Ref    Use Iface
192.168.122.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0
0.0.0.0         192.168.122.1   0.0.0.0         UG    0      0        0 eth0
[root@centos64 ~]# 
Death by snoo-snoo!
Top
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

  • Quote

Post by _______0 » Wed Jun 19, 2013 11:14 pm

what about this claim that I found on two places?
Right, but if I set IP(eth0) == IP(macvlan0), I'm able to communicate
between macvlan0 and mactapX, thus between guest and host. Just
re-checked here, still works (after resolving the usual MAC address mess
I caused by configuring manually).
This implies something like this:

eth0 192.168.1.2
macvlan0 192.168.1.2

Is this correct? Even then, a place mentioned eth0 needed to have no routes, manually flushed, and guests have some weird thing about host's ip as route??

/me confused as hell.
Top
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

  • Quote

Post by _______0 » Fri Jun 21, 2013 4:39 pm

anyone?

thanks
Top
papahuhn
l33t
l33t
User avatar
Posts: 626
Joined: Mon Sep 06, 2004 9:14 am

  • Quote

Post by papahuhn » Fri Jun 21, 2013 6:20 pm

Nice, it works as described. You don't even need the IP on eth0, neither to set anything special within the VM.
Death by snoo-snoo!
Top
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

  • Quote

Post by _______0 » Fri Jun 21, 2013 8:57 pm

papahuhn wrote:Nice, it works as described. You don't even need the IP on eth0, neither to set anything special within the VM.
wait... Are you being sarcastic or something? What's working and how?? Plz tell me more!!
Top
papahuhn
l33t
l33t
User avatar
Posts: 626
Joined: Mon Sep 06, 2004 9:14 am

  • Quote

Post by papahuhn » Fri Jun 21, 2013 9:06 pm

I'm not sarcastic. I just followed the tip from your link.
- Create a macvlan0@eth0
- Move IP and routes from eth0 to macvlan0
- Use macvtap@eth0 in bridge mode for your VMs (I use virt-manager for configuration).
Death by snoo-snoo!
Top
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

  • Quote

Post by _______0 » Fri Jun 21, 2013 9:48 pm

papahuhn wrote:I'm not sarcastic. I just followed the tip from your link.
- Move IP and routes from eth0 to macvlan0

:"((( works for everyone except me.

Can you show the steps for that?

Also, it's important that this works unplugged. Try ssh both ways host and guest without the cable and tell me if it works.
Top
papahuhn
l33t
l33t
User avatar
Posts: 626
Joined: Mon Sep 06, 2004 9:14 am

  • Quote

Post by papahuhn » Sat Jun 22, 2013 7:44 am

_______0 wrote:Also, it's important that this works unplugged. Try ssh both ways host and guest without the cable and tell me if it works.
Right, that doesn't work for me either. The macvlan and macvtap go into a LOWERLAYERDOWN state. While VMs still can communicate with each other, they cannot communicate with the host.
Death by snoo-snoo!
Top
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

  • Quote

Post by _______0 » Sat Jun 22, 2013 11:18 am

papahuhn wrote:
_______0 wrote:Also, it's important that this works unplugged. Try ssh both ways host and guest without the cable and tell me if it works.
Right, that doesn't work for me either. The macvlan and macvtap go into a LOWERLAYERDOWN state. While VMs still can communicate with each other, they cannot communicate with the host.
hence the suggestion of:

ip eth0 = macvlan

???

dunno...
Top
papahuhn
l33t
l33t
User avatar
Posts: 626
Joined: Mon Sep 06, 2004 9:14 am

  • Quote

Post by papahuhn » Sat Jun 22, 2013 1:51 pm

The IPs don't matter here. The problem is with the link state. When the cable is unplugged, eth0's and macvlan's internal queueing discipline changes to noop [1].
In net/core/dev.c:dev_queue_xmit() a frame is then dropped by the noop qdisc, while macvlan transmission via macvlan_start_xmit() would be performed after.

So, the problem is not with receiving a frame from a VM but sending the response back to it on a practically DOWN interface.

Plugged:

Code: Select all

 2)               |        dev_queue_xmit() {
 2)               |          local_bh_disable() {
 2)   0.137 us    |            __local_bh_disable();
 2)   0.660 us    |          }
 2)   0.121 us    |          netdev_pick_tx();
 2)               |          _raw_spin_lock() {
 2)   0.085 us    |            add_preempt_count();
 2)   0.566 us    |          }
 2)               |          sch_direct_xmit() {
 2)               |            _raw_spin_unlock() {
 2)   0.077 us    |              sub_preempt_count();
 2)   0.612 us    |            }
 2)               |            dev_hard_start_xmit() {
 2)   0.155 us    |              netif_skb_features();
 2)               |              macvlan_start_xmit() {
Unplugged:

Code: Select all

 3)               |        dev_queue_xmit() {
 3)               |          local_bh_disable() {
 3)   0.120 us    |            __local_bh_disable();
 3)   0.638 us    |          }
 3)   0.118 us    |          netdev_pick_tx();
 3)               |          _raw_spin_lock() {
 3)   0.063 us    |            add_preempt_count();
 3)   0.591 us    |          }
 3)               |          noop_enqueue() {
 3)               |            kfree_skb() {
 3)               |              __kfree_skb() {
 3)               |                skb_release_head_state() {
 3)               |                  sock_wfree() {
 3)               |                    sock_def_write_space() {
 3)   0.058 us    |                      __rcu_read_lock();
 3)   0.060 us    |                      __rcu_read_unlock();
 3)   1.248 us    |                    }
 3)   1.944 us    |                  }
 3)   2.540 us    |                }
 3)               |                skb_release_data() {
 3)               |                  skb_free_head() {
 3)   0.190 us    |                    kfree();
 3)   0.679 us    |                  }
 3)   1.235 us    |                }
 3)   0.111 us    |                kmem_cache_free();
 3)   5.570 us    |              }
 3)   6.101 us    |            }
 3)   6.633 us    |          }

[1] http://ace-host.stuart.id.au/russell/fi ... h_noop.txt
Death by snoo-snoo!
Top
_______0
Guru
Guru
Posts: 521
Joined: Mon Oct 15, 2012 6:05 pm

  • Quote

Post by _______0 » Wed Jun 26, 2013 5:14 pm

mm... fuuu???


What about deleting OR instructing in net/core/dev.c NOT to change states?

Otherwise the next most simple setup would be to use VDE? To be honest the traditional bridging method somehow doesn't look very aesthetic.

thanks
Top
papahuhn
l33t
l33t
User avatar
Posts: 626
Joined: Mon Sep 06, 2004 9:14 am

  • Quote

Post by papahuhn » Wed Jun 26, 2013 6:46 pm

There is no OR instruction, and the state-update code is somewhere else. I think you should ask the netdev mailing list.
Death by snoo-snoo!
Top
Post Reply

20 posts • Page 1 of 1

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic