On 04/27/2018 06:39 PM, daggs wrote:
Greetings all,
I have a host machine that runs a router within a vm.
I want to allow a connection between the host and the guest so the host can connect to
the lan provided by the router vm.
I've created a dummy interface with these commands:
$ ip link add ens99-dummy type dummy
$ ip link set ens99-dummy address 52:54:00:1f:d0:ff
this resulted with this output:
$ ifconfig ens99-dummy
ens99-dummy Link encap:Ethernet HWaddr 52:54:00:1F:D0:FF
inet6 addr: fe80::84b5:24ff:fe62:c16d/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:899 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:321727 (314.1 KiB)
in my libvirt's xml file I have this entry:
<interface type='direct'>
<mac address='52:54:00:0c:cb:3e'/>
<source dev='ens99-dummy' mode='private'/>
<target dev='macvtap0'/>
<model type='e1000'/>
<alias name='net0'/>
<address type='pci' domain='0x0000' bus='0x02'
slot='0x01' function='0x0'/>
</interface>
MY first question would be "Why are you using macvtap?" This
unnecessarily complicates the plumbing, leading to more potential places
where it could fail.
The 2nd question is - Have you looked at the dhcp server running on the
guest to verify that it is indeed listening for DHCP requests on the
guest-side interface associated with the macvtap interface, and that it
is receiving those requests and sending a reply?
after the vm is up, I see the adapter in the vm and the host has one more entry:
$ ifconfig macvtap0
macvtap0 Link encap:Ethernet HWaddr 52:54:00:0C:CB:3E
inet6 addr: fe80::5054:ff:fe0c:cb3e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:889 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 B) TX bytes:320523 (313.0 KiB)
but when I try to request ip via dhcp from both macvtap0 and ens99-dummy I don't get
any.
any idea why?
Definitely you wouldn't be able to use the macvtap0 device, so if
anything you would want to be using ens99-dummy, but I'm not even
certain *that* would work, as I've never tried it.
You've provided no visibility into the configuration of the guest OS in
your virtual machine, but in general if you want a simple connection
between the host and guest that has *no other connections*, you can do
this with a bare tap device:
<interface type='ethernet'>
<model type='e1000'/>
</interface>
This will show up as a single device on the host and a single device in
the guest, not connected to a bridge or a macvtap device or anything,
and will not need any other "ip link blah blah" type setup on the host.
Simplifying your setup in this manner may make it easier to find the
source of your problem.