If you have more than 1 netwerkconnection (Nic) than my way of work is the
following:
Step 1: list all available network cards in the system which are detected by
SmartOS
dladm show-phys -m
This will show all nics with their unique MAC address.
Now there must be some command to see which of them is used as primary “admin”
nic by SmartOS, but I don’t know it.
But we can now look into /usbkey/config to see which one SMartOS has choosen.
Step 2: see the admin nic (and others)
Cat /usbkey/config
There you will see at least the admin nic with the MAC address of the nic it
uses
So we have found the admin nic and now know which Mac-addresses are free for
us to use.
Set 3: lets assign a free nic a config so that it will survive reboots of the
system
(do a dladm show-phys -m again, find the free MAC addresses and the
corresponding nic name)
Open /usbkey/config with your favorite editor
Let’s assume we want to use this nic for all VM’s of customer “LargeBonus”
So create these lines to /usbkey/config:
largebonus_nic=aa.bb.cc.dd.ee.ff
largebonus0_ip=dhcp
largebonus0_netmask=...
at the first line you specify the nic alias, in this case “largebonus”, at
aa.b.cc you fill in the real MAC address of the nic (see step 1)
the next two lines are needed and you may not forget the additional zero at
the end of the name!
You may specify a fixed IP-address instead of dhcp and add an extra line for
the gateway (largebonus0_gateway)
Step 4: save the config and update the system without reboot
Save the config file and after that enter “sysinfo -u” at the console.
Step 5: we now have the nic and his alias available for existing and new zones
Step 5a: adding the vnic to an existing virtual machine
Create a new file somewhere on the system, I always save them to something
like /opt/zonesetups, because the /opt will survive reboots)
Save the file as add_nic.json
Enter (at least) the following information:
{
"add_nics":[
{
"interface": "AAAA",
"mac": "BBBB",
"nic_tag": "largebonus",
"ip": "XXXX",
"netmask": "YYYY"
}
]
}
Change AAAA to the name of the interface that was shown in step 1. (like bge1,
nic2, eth4 or something)
Change BBBB to a random MAC-adress (do not use the same MAC address as the
hardware nics of step 1 !!!)
XXXX the IP address you want to assign to the machine
YYYY the subnet mask you want to assign to the machine
If you like you may want to assign a gateway, but that can disrupt the machine
when it already has a gateway on an other nic!
Save the file
Now very simple:
Run this command: cat add_nic.json | vmadm update ZZZZ
replace ZZZZ with the UUID of the zone you want to change
Step 5b: assign this nic to a new zone.
It is just as simple as any other zone creation procedure.
Only things to change are :
nic_tag: “largebonus”
interface: “bge1”
bge1 is an example! Lookup the real name as mentioned in step 1 and 5a
Van: Matthew Parsons [mailto:[email protected]]
Verzonden: vrijdag 2 juni 2017 20:04
Aan: [email protected]
Onderwerp: Re: [smartos-discuss] Etherstub and vnics for KVM machines
I could be missing something, but "vmadm update UUID -f /path/to/update.json"
should work. It's not immediately obvious, but the info is in the vmadm manpage.
In the case of nics and disks, there are 3 special objects:
add_disks || add_nics
remove_disks || remove_nics
update_disks || update_nics
For NICs for example, you can include an array of NIC objects with the
parameter add_nics in your input. Those NICs would get added to the VM.
For update you also pass in a new NIC object but only need to specify
the "mac" parameter (to identify which NIC to update) and the
properties that you want to change. If you need to change the MAC
address itself, you'll need to add a new NIC with the same properties
and a different MAC, and remove the existing one. To remove a NIC, the
remove_nics property should be an array of MAC addresses only (not NIC
objects).
For me, it helped to find examples, then started a small library of .json
files to use as templates.
On Fri, Jun 2, 2017 at 6:50 AM, Hanno Hirschberger
<[email protected] <mailto:[email protected]> >
wrote:
Hello everyone,
I'm currently using SmartOS (build: SmartOS 20160218T022556Z x86_64) for a
bunch of different KVM virtualized machines. Normally these machines are
getting a vnic on the external network interface to communicate with the
outside. Now I need to create two machines which are linked together in a
private network. I want to use an etherstub and two vnics (one for each
machine) linked to that etherstub to achieve this.
While this is no problem to do in a bash on SmartOS, I'd love to use a more
cleaner approach with the JSON machine descriptors - if possible! But I don't
know what to write in the machine settings JSON file. So maybe you can help me
out. Is that possible or do I have to do this outside of the 'vmadm' command?
Best regards
Hanno
smartos-discuss | <https://www.listbox.com/member/archive/184463/=now>
Archives <https://www.listbox.com/member/archive/rss/184463/27966043-4eecc9e4>
| <https://www.listbox.com/member/?&> Modify Your Subscription
<http://www.listbox.com>
-------------------------------------------
smartos-discuss
Archives: https://www.listbox.com/member/archive/184463/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184463/25769125-55cfbc00
Modify Your Subscription:
https://www.listbox.com/member/?member_id=25769125&id_secret=25769125-7688e9fb
Powered by Listbox: http://www.listbox.com