Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple NICs with configured addresses #10

Open
5 tasks
gtz42 opened this issue Jan 16, 2019 · 7 comments
Open
5 tasks

Support for multiple NICs with configured addresses #10

gtz42 opened this issue Jan 16, 2019 · 7 comments

Comments

@gtz42
Copy link

gtz42 commented Jan 16, 2019

Make sure to follow and check these boxes before submitting an issue! Thank you.

  • Supply print(libioc.VERSION)
  • Supply the commands used, along with any steps to recreate it.
  • Provide the output from the command you issued.
  • Supply what you expected the result or output to be
  • Checked that the problem has not already been fixed on master if using
    a stable release.
@gronke
Copy link
Member

gronke commented Jan 16, 2019

This is already supported.

>>> import libioc
>>> jail = libioc.Jail("myjail")
>>> jail.config["ip4_addr"] = "vnet0|192.168.23.2/24,vnet1|192.168.42.2/24"
>>> jail.config["ip4_addr"]
{'vnet0': AddressSet({IPv4Interface('192.168.23.2/24')}), 'vnet1': AddressSet({IPv4Interface('192.168.42.2/24')})}
>>> jail.save()

You can have multiple IP addresses on each interface as well as DHCP (or rtadv for IPv6).

Please keep in mind that you also need to configure your vnet interfaces before starting the jail:

>>> jail.config["interfaces"] = "vnet0:bridge0,vnet1:bridge1"
>>> jail.config["interfaces"]
{'vnet0': <libioc.BridgeInterface.BridgeInterface object at 0x8025230f0>, 'vnet1': <libioc.BridgeInterface.BridgeInterface object at 0x802523128>}

@gronke gronke closed this as completed Jan 16, 2019
@igalic
Copy link
Collaborator

igalic commented Jan 16, 2019

This should go directly into the handbook.
And probably can, verbatim.

@gronke gronke transferred this issue from bsdci/libioc Jan 16, 2019
@igalic igalic reopened this Jan 16, 2019
@gtz42
Copy link
Author

gtz42 commented Jan 16, 2019

Intended to add more information, as the described process does not work: (using the ioc command line tool):

root@mgr01:~ # ioc list
+-----+-----------+---------+--------------+------------------------------------------------+
| JID | FULL_NAME | RUNNING |   RELEASE    |                    IP4_ADDR                    |
+=====+===========+=========+==============+================================================+
| 1   | bastion   | yes     | 12.0-RELEASE | vnet0|192.168.11.249/24,vlan1|192.168.100.2/24 |
+-----+-----------+---------+--------------+------------------------------------------------+
root@mgr01:~ # ioc console bastion
...
root@bastion:~ # ifconfig -a
...
vnet0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
...
	inet 192.168.11.249 netmask 0xffffff00 broadcast 192.168.11.255
...
vnet1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=8<VLAN_MTU>
	ether 02:ff:60:f2:43:d9
	hwaddr 02:e4:12:c2:12:0b
	inet6 fe80::e4:12ff:fec2:120b%vnet1 prefixlen 64 scopeid 0x3
	groups: epair
	media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
	status: active
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

While vnet0 has an IP, vnet1 does not.

root@mgr01:~ # ioc --version
ioc, version 0.4.2 2019/01/10

Let's update to the git version of libioc from the weekend (#d83a24bb56012d69bfe3ff3a8ac647d899540e23)

Successfully installed libioc-0.5.0

Using the Python interface the config is correct:

root@mgr01:/usr/local/src/libioc # python3.6
Python 3.6.7 (default, Jan  1 2019, 01:23:50)
[GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final 335540)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import libioc
>>> jail = libioc.Jail("bastion")
>>> jail.config["ip4_addr"]
{'vnet0': AddressSet({IPv4Interface('192.168.11.249/24')}), 'vlan1': AddressSet({IPv4Interface('192.168.100.2/24')})}

But it's still not configured.

@gronke
Copy link
Member

gronke commented Jan 16, 2019

@gtz42 could you please post the output of the following command:

ioc get all bastion

The second device in your ip4_configuration is named vlan1, although the ifconfig output contains vnet1, so I would be particularly interested in the interfaces configuration.

@gtz42
Copy link
Author

gtz42 commented Jan 16, 2019

Thanks for spotting my typo. Once I do it correctly, with 'vnet1'. It works, sorry.

I should have scrapped my jail and do it from scratch.

What I actually would like to do is push interfaces from the host in to the jail (in the experiment a vlan interface), but that fails with (lib)ioc, as the syntax check expects "$interface_name:$brindge_name".

sorry for the noise.

@gronke
Copy link
Member

gronke commented Jan 16, 2019

Currently ioc requires a bridge interface where it can assign the epair device of the jail to. So you would require a bridge interface created on the host for each VLAN.

@igalic
Copy link
Collaborator

igalic commented Jan 16, 2019

We don't support any kind of passthru?
like with other devices?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants