Re: tap interfaces disappears after bhyve guests shutdowns

2017-02-14 Thread Stephen Stuart
On Feb 14, 2017 05:42, "C. L. Martinez"  wrote:

On Tue, Feb 14, 2017 at 01:26:49PM +, C. L. Martinez wrote:
> On Tue, Feb 14, 2017 at 01:29:57PM +0100, Miroslav Lachman wrote:
> > C. L. Martinez wrote on 2017/02/14 12:57:
> > > On Mon, Feb 13, 2017 at 02:02:48PM +0100, Daniel Niculescu wrote:
> >
> > >
> > > Thanks Daniel. I have tried what you say, but ping doesn't works
between host and guest. If I put an ip to the bridge works ok, but not when
I assign an ip to tap interface.
> > >
> > > Any idea why??
> >
> > Are you using IPs from the same subnet on host and in a guests? What IP
did
> > you assign to tap / bridge?
> >
> > Miroslav Lachman
>
> Yes. For host: 172.22.55.1/24 and for guest 172.22.55.29/24. When I
assign IP 172.22.55.1 to the bridge on host side, host and guest can
communicate. But when I assign 172.22.55.1 to a tap interface on the host
and create a bridge with host's tap interface and guest's tap interface,
there is no comms between them ... And I don't understand why ...
>
>
> --
> Greetings,
> C. L. Martinez

Ok, I think I have found the problem (but not the solution :( ) ...

prodif: flags=8843 metric 0 mtu 1500
ether 02:bc:f9:66:98:01
nd6 options=9
groups: bridge
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: tap11 flags=143
ifmaxaddr 0 port 7 priority 128 path cost 200
member: tap10 flags=143
ifmaxaddr 0 port 6 priority 128 path cost 200
pubif: flags=8843 metric 0 mtu 1500
ether 02:bc:f9:66:98:02
nd6 options=9
groups: bridge
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: tap21 flags=143
ifmaxaddr 0 port 9 priority 128 path cost 200
member: tap20 flags=143
ifmaxaddr 0 port 8 priority 128 path cost 200
tap10: flags=8943 metric 0
mtu 1500
options=8
ether 00:bd:1d:15:f7:0a
nd6 options=29
media: Ethernet autoselect
status: active
groups: tap
Opened by PID 79946
tap11: flags=8943 metric 0
mtu 1500
options=8
ether 00:bd:24:15:f7:0b
inet 172.22.55.1 netmask 0xffe0 broadcast 172.22.55.31
nd6 options=29
media: Ethernet autoselect
status: no carrier
groups: tap
tap20: flags=8943 metric 0
mtu 1500
options=8
ether 00:bd:2b:15:f7:14
nd6 options=29
media: Ethernet autoselect
status: active
groups: tap
Opened by PID 79946
tap21: flags=8943 metric 0
mtu 1500
options=8
ether 00:bd:31:15:f7:15
inet 172.30.77.1 netmask 0xfff8 broadcast 172.30.77.7
nd6 options=29
media: Ethernet autoselect
status: no carrier
groups: tap

 .. As you can see with tap21 and tap11 (tap interfaces assigned to host)
status is: no carrier ... ¿ Why?? Both are assigned to bridges ...


Those tap interfaces have no carrier because they have not been opened by a
guest VM and paired with a vtnet interface.

A tap interface is how the vtnet interface inside the guest VM shows up on
the host side. No guest VM, no tap.

If you want the host to be able to exchange IP packets with the guest VM
locally, the bridge (on the host) and vtnet interface (in the guest VM)
need to be numbered in the same prefix. The tap interfaces don't get IP
address assignments, the corresponding vtnet interfaces inside the VMs do.

Stephen
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"

Re: tap interfaces disappears after bhyve guests shutdowns

2017-02-14 Thread C. L. Martinez
On Tue, Feb 14, 2017 at 01:26:49PM +, C. L. Martinez wrote:
> On Tue, Feb 14, 2017 at 01:29:57PM +0100, Miroslav Lachman wrote:
> > C. L. Martinez wrote on 2017/02/14 12:57:
> > > On Mon, Feb 13, 2017 at 02:02:48PM +0100, Daniel Niculescu wrote:
> > 
> > > 
> > > Thanks Daniel. I have tried what you say, but ping doesn't works between 
> > > host and guest. If I put an ip to the bridge works ok, but not when I 
> > > assign an ip to tap interface.
> > > 
> > > Any idea why??
> > 
> > Are you using IPs from the same subnet on host and in a guests? What IP did
> > you assign to tap / bridge?
> > 
> > Miroslav Lachman
> 
> Yes. For host: 172.22.55.1/24 and for guest 172.22.55.29/24. When I assign IP 
> 172.22.55.1 to the bridge on host side, host and guest can communicate. But 
> when I assign 172.22.55.1 to a tap interface on the host and create a bridge 
> with host's tap interface and guest's tap interface, there is no comms 
> between them ... And I don't understand why ...
> 
> 
> -- 
> Greetings,
> C. L. Martinez

Ok, I think I have found the problem (but not the solution :( ) ...

prodif: flags=8843 metric 0 mtu 1500
ether 02:bc:f9:66:98:01
nd6 options=9
groups: bridge 
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: tap11 flags=143
ifmaxaddr 0 port 7 priority 128 path cost 200
member: tap10 flags=143
ifmaxaddr 0 port 6 priority 128 path cost 200
pubif: flags=8843 metric 0 mtu 1500
ether 02:bc:f9:66:98:02
nd6 options=9
groups: bridge 
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: tap21 flags=143
ifmaxaddr 0 port 9 priority 128 path cost 200
member: tap20 flags=143
ifmaxaddr 0 port 8 priority 128 path cost 200
tap10: flags=8943 metric 0 mtu 
1500
options=8
ether 00:bd:1d:15:f7:0a
nd6 options=29
media: Ethernet autoselect
status: active
groups: tap 
Opened by PID 79946
tap11: flags=8943 metric 0 mtu 
1500
options=8
ether 00:bd:24:15:f7:0b
inet 172.22.55.1 netmask 0xffe0 broadcast 172.22.55.31 
nd6 options=29
media: Ethernet autoselect
status: no carrier
groups: tap 
tap20: flags=8943 metric 0 mtu 
1500
options=8
ether 00:bd:2b:15:f7:14
nd6 options=29
media: Ethernet autoselect
status: active
groups: tap 
Opened by PID 79946
tap21: flags=8943 metric 0 mtu 
1500
options=8
ether 00:bd:31:15:f7:15
inet 172.30.77.1 netmask 0xfff8 broadcast 172.30.77.7 
nd6 options=29
media: Ethernet autoselect
status: no carrier
groups: tap

 .. As you can see with tap21 and tap11 (tap interfaces assigned to host) 
status is: no carrier ... ¿ Why?? Both are assigned to bridges ...

-- 
Greetings,
C. L. Martinez
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"

Re: tap interfaces disappears after bhyve guests shutdowns

2017-02-14 Thread C. L. Martinez
On Tue, Feb 14, 2017 at 01:29:57PM +0100, Miroslav Lachman wrote:
> C. L. Martinez wrote on 2017/02/14 12:57:
> > On Mon, Feb 13, 2017 at 02:02:48PM +0100, Daniel Niculescu wrote:
> 
> > 
> > Thanks Daniel. I have tried what you say, but ping doesn't works between 
> > host and guest. If I put an ip to the bridge works ok, but not when I 
> > assign an ip to tap interface.
> > 
> > Any idea why??
> 
> Are you using IPs from the same subnet on host and in a guests? What IP did
> you assign to tap / bridge?
> 
> Miroslav Lachman

Yes. For host: 172.22.55.1/24 and for guest 172.22.55.29/24. When I assign IP 
172.22.55.1 to the bridge on host side, host and guest can communicate. But 
when I assign 172.22.55.1 to a tap interface on the host and create a bridge 
with host's tap interface and guest's tap interface, there is no comms between 
them ... And I don't understand why ...


-- 
Greetings,
C. L. Martinez
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: tap interfaces disappears after bhyve guests shutdowns

2017-02-14 Thread Miroslav Lachman

C. L. Martinez wrote on 2017/02/14 12:57:

On Mon, Feb 13, 2017 at 02:02:48PM +0100, Daniel Niculescu wrote:




Thanks Daniel. I have tried what you say, but ping doesn't works between host 
and guest. If I put an ip to the bridge works ok, but not when I assign an ip 
to tap interface.

Any idea why??


Are you using IPs from the same subnet on host and in a guests? What IP 
did you assign to tap / bridge?


Miroslav Lachman
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: tap interfaces disappears after bhyve guests shutdowns

2017-02-14 Thread C. L. Martinez
On Mon, Feb 13, 2017 at 02:02:48PM +0100, Daniel Niculescu wrote:
> 
> 
> On 02/13/17 13:37, Miroslav Lachman wrote:
> > C. L. Martinez wrote on 2017/02/13 13:09:
> > 
> > >   Why when a bhyve guest shutdowns or reboot tap interfaces goes
> > > down and lost IP assigned address?. I need to use same tap interface
> > > for several guests and assign an IP to this tap interface to act as
> > > a router for these guests.
> > > 
> IP address is set on the guest, so as long as you have the network set up
> the IP address will be persistent.
> What you need is a bridge to which you add all your tap interfaces.
> 
> Set the kernel state as advised by Martinez and make sure you have it also
> in /etc/sysctl.conf:
> #sysctl net.link.tap.up_on_open=1
> #echo "net.link.tap.up_on_open=1" >> /etc/sysctl.conf
> 
> Create a bridge interface:
> #ifconfig bridge0 create
> 
> Add your host interface if you want external connectivity for your guests:
> #ifconfig bridge0 addm em0
> 
> Create the tap interfaces for the guests:
> #ifconfig tap0 create
> #ifconfig tap1 create
> 
> Add them to the bridge:
> #ifconfig bridge0 addm tap0 addm tap1
> 
> After booting the guests, they will be both bridged with your physical
> interface em0 (replace em0 with your actual interface):
> 
> #ifconfig bridge0
> bridge0: flags=8843 metric 0 mtu
> 1500
> description: vm-local
> ether 02:ed:0d:ca:74:00
> nd6 options=1
> groups: bridge
> id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
> maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
> root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
> member: tap1 flags=143
> ifmaxaddr 0 port 5 priority 128 path cost 200
> member: tap0 flags=143
> ifmaxaddr 0 port 4 priority 128 path cost 200
> member: em0 flags=143
> ifmaxaddr 0 port 1 priority 128 path cost 2
> 
> Perhaps you could use an utility to manage the VMs, like vm-bhyve, iohyve,
> etc.
> 
> 

Thanks Daniel. I have tried what you say, but ping doesn't works between host 
and guest. If I put an ip to the bridge works ok, but not when I assign an ip 
to tap interface.

Any idea why??

-- 
Greetings,
C. L. Martinez
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: tap interfaces disappears after bhyve guests shutdowns

2017-02-13 Thread The Doctor
On Mon, Feb 13, 2017 at 12:09:38PM +, C. L. Martinez wrote:
> Hi all,
> 
>  Why when a bhyve guest shutdowns or reboot tap interfaces goes down and lost 
> IP assigned address?. I need to use same tap interface for several guests and 
> assign an IP to this tap interface to act as a router for these guests.
> 
>  How can I do a "persistent tap" interface??
> 
> Thanks.
> I
> -- 
> Greetings,
> C. L. Martinez

Here is wht I do in my /etc/rc.local file


/sbin/ifconfig tap8 inet 204.209.81.52 netmask 0xff00
/sbin/ifconfig tap0 inet 204.209.81.53 netmask 0xff00
/sbin/ifconfig tap1 inet 204.209.81.54 netmask 0xff00
/sbin/ifconfig tap7 inet 204.209.81.55 netmask 0xff00
/sbin/ifconfig tap2 inet 204.209.81.56 netmask 0xff00
/sbin/ifconfig tap4 inet 204.209.81.57 netmask 0xff00
/sbin/ifconfig tap3 inet 204.209.81.58 netmask 0xff00
/sbin/ifconfig tap6 inet 204.209.81.59 netmask 0xff00
/sbin/ifconfig bridge0 alias 204.209.81.60 netmask 0xff00
/sbin/ifconfig tap5 inet 204.209.81.61 netmask 0xff00
/sbin/ifconfig tap9 inet 204.209.81.62 netmask 0xff00
/sbin/ifconfig tap10 inet 204.209.81.63 netmask 0xff00
/sbin/ifconfig tap11 inet 204.209.81.64 netmask 0xff00
/sbin/ifconfig tap12 inet 204.209.81.65 netmask 0xff00
/sbin/ifconfig tap13 inet 204.209.81.66 netmask 0xff00
/sbin/ifconfig tap14 inet 204.209.81.67 netmask 0xff00
/sbin/ifconfig tap15 inet 204.209.81.68 netmask 0xff00


You can do something similar in /etc/rc.conf 


> ___
> freebsd-virtualization@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to 
> "freebsd-virtualization-unsubscr...@freebsd.org"

-- 
Member - Liberal International This is doctor@@nl2k.ab.ca Ici doctor@@nl2k.ab.ca
Yahweh, Queen & country!Never Satan President Republic!Beware AntiChrist rising!
http://www.fullyfollow.me/rootnl2k  Look at Psalms 14 and 53 on Atheism
God is dead! Yahweh lives! Jesus his only begotten Son is the Risen Saviour!!
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: tap interfaces disappears after bhyve guests shutdowns

2017-02-13 Thread Daniel Niculescu



On 02/13/17 13:37, Miroslav Lachman wrote:

C. L. Martinez wrote on 2017/02/13 13:09:

  Why when a bhyve guest shutdowns or reboot tap interfaces goes down 
and lost IP assigned address?. I need to use same tap interface for 
several guests and assign an IP to this tap interface to act as a 
router for these guests.


IP address is set on the guest, so as long as you have the network set 
up the IP address will be persistent.

What you need is a bridge to which you add all your tap interfaces.

Set the kernel state as advised by Martinez and make sure you have it 
also in /etc/sysctl.conf:

#sysctl net.link.tap.up_on_open=1
#echo "net.link.tap.up_on_open=1" >> /etc/sysctl.conf

Create a bridge interface:
#ifconfig bridge0 create

Add your host interface if you want external connectivity for your guests:
#ifconfig bridge0 addm em0

Create the tap interfaces for the guests:
#ifconfig tap0 create
#ifconfig tap1 create

Add them to the bridge:
#ifconfig bridge0 addm tap0 addm tap1

After booting the guests, they will be both bridged with your physical 
interface em0 (replace em0 with your actual interface):


#ifconfig bridge0
bridge0: flags=8843 metric 0 mtu 
1500

description: vm-local
ether 02:ed:0d:ca:74:00
nd6 options=1
groups: bridge
id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
member: tap1 flags=143
ifmaxaddr 0 port 5 priority 128 path cost 200
member: tap0 flags=143
ifmaxaddr 0 port 4 priority 128 path cost 200
member: em0 flags=143
ifmaxaddr 0 port 1 priority 128 path cost 2

Perhaps you could use an utility to manage the VMs, like vm-bhyve, 
iohyve, etc.




  How can I do a "persistent tap" interface??


I think you need this sysctl:

# sysctl -d net.link.tap.up_on_open
net.link.tap.up_on_open: Bring interface up when /dev/tap is opened
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


Re: tap interfaces disappears after bhyve guests shutdowns

2017-02-13 Thread Miroslav Lachman

C. L. Martinez wrote on 2017/02/13 13:09:


  Why when a bhyve guest shutdowns or reboot tap interfaces goes down and lost 
IP assigned address?. I need to use same tap interface for several guests and 
assign an IP to this tap interface to act as a router for these guests.

  How can I do a "persistent tap" interface??


I think you need this sysctl:

# sysctl -d net.link.tap.up_on_open
net.link.tap.up_on_open: Bring interface up when /dev/tap is opened
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"


tap interfaces disappears after bhyve guests shutdowns

2017-02-13 Thread C. L. Martinez
Hi all,

 Why when a bhyve guest shutdowns or reboot tap interfaces goes down and lost 
IP assigned address?. I need to use same tap interface for several guests and 
assign an IP to this tap interface to act as a router for these guests.

 How can I do a "persistent tap" interface??

Thanks.
I
-- 
Greetings,
C. L. Martinez
___
freebsd-virtualization@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
To unsubscribe, send any mail to 
"freebsd-virtualization-unsubscr...@freebsd.org"