Last active
January 14, 2019 22:20
-
-
Save psammarco/9c3f1c39e3ae3fc74c103d026b4f9d0d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| This howto will show you how to create a etherstub and add a vnic on top of it. See a etherstub as a virtswitch which is indipendent from the phsycal NICs. | |
| 1. Create a ETHERSTUB | |
| NB: ETHSTUBNAME must end with a number; for instance a valid name would be happyether69 | |
| # nictagadm add -l ETHSTUBNAME | |
| 2. Now lets create a dummy VNIC on the ETHERSTUB | |
| # dladm create-vnic -l ETHSTUBNAME VNICNAME -m MACADDR | |
| - The end result should be the following: | |
| >>> | |
| [root@homelab ~]# dladm show-vnic | |
| LINK OVER SPEED MACADDRESS MACADDRTYPE VID ZONE | |
| net0 bnx2 0 72:bw:20:79:9a:aa fixed 0 4da9efe9-4904-cacd-d4ac-c3a34b119472 | |
| ovpn1 int_ovpn1 0 8:0:27:c1:50:1a fixed 0 -- | |
| <<< | |
| 3. Add the newly create VNIC to an existant zone | |
| 1a. Create a file somewhere in /opt/ and call it something like "add_dummy_vnic.json" | |
| 2a. Add the following in it: | |
| >>> | |
| { | |
| "add_nics": [ | |
| { | |
| "interface": "VNICNAME", | |
| "nic_tag": "ETHSTUBNAME", | |
| "mac": "c9:aa:q5:8d:1c:qf", | |
| "model": "e1000", | |
| "mtu": "9000" | |
| } | |
| ] | |
| } | |
| <<< | |
| 3a. Assuming the zone is already powered off, proceed adding the new VNIC | |
| # cat /opt/vmadm_templates/add_dummy_vnic.json | vmadm update UUIDNAME-925c-e35e-e5a2-874630dee577 | |
| 4. If all went well a similar output should be expected: | |
| >>> | |
| # vmadm get UUIDNAME-925c-e35e-e5a2-874630dee577 |json nics | |
| [ | |
| { | |
| "interface": "eth0", | |
| "mac": "12:a8:0f:lb:01:bb", | |
| "nic_tag": "admin", | |
| "gateway": "172.12.0.1", | |
| "gateways": [ | |
| "172.12.0.1" | |
| ], | |
| "netmask": "255.255.255.0", | |
| "ip": "172.12.0.210", | |
| "ips": [ | |
| "172.12.0.210/24" | |
| ], | |
| "primary": true | |
| }, | |
| { | |
| "interface": "eth1", | |
| "mac": "c9:aa:q5:8d:1c:qf", | |
| "nic_tag": "ETHSTUBNAME", | |
| "allow_ip_spoofing": true, | |
| "mtu": 9000 | |
| } | |
| ] | |
| <<< | |
| For more info see | |
| https://smartos.org/man/1m/dladm | |
| https://smartos.org/man/1m/vmadm | |
| Job done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment