Red Hat Training

A Red Hat training course is available for Red Hat Virtualization

4.10. nic

The nic resource type groups network interface resources in a Red Hat Virtualization environment. These resources acts as sub-resources for both host and vm resources but are defined differently for each. This section contains two tables with parameters for each.

Table 4.24. Host network interface parameters

Name Type Description Required User Creatable User Updatable
--network-id|name
 string
A reference to the network, if any, that the interface is attached.
Yes
Yes
Yes
--name
 string
The name of the host network interface, e.g. eth0.
Yes
Yes
Yes
--bonding-slaves-host_nic
 collection
A collection of slave network interfaces that form a bonded interface.
No
Yes
Yes
--bonding-options-option
 collection
A list of options for a bonded interface. Each option contains property name and value attributes.
No
Yes
Yes
--ip-gateway
 string
The IP address for the network's gateway.
No
Yes
Yes
--boot_protocol
 string
The protocol for IP address assignment when the host is booting, such as dhcp or static.
No
Yes
Yes
--mac
 string
The MAC address of the interface.
No
Yes
Yes
--ip-address
 string
The IP address of the interface.
No
Yes
Yes
--ip-netmask
 string
The netmask for the interface's IP address.
No
Yes
Yes
--ip-mtu
int
The maximum transmission unit for the interface.
No
No
Yes

Table 4.25. Virtual Machine network interface parameters

Name Type Description Required User Creatable User Updatable
--network-id|name
 string
A reference to the network, if any, that the interface is attached.
Yes
Yes
Yes
--name
 string
The name of the interface, e.g. eth0.
Yes
Yes
Yes
--mac-address
 string
The MAC address of the interface.
No
Yes
Yes
--interface
 string
Defines the interface type, such as e1000, virtio, rtl8139 and rtl8139_virtio.
No
Yes
Yes
--port_mirroring-networks-network
 collection
Defines a set of networks to copy (mirror) network data from the network interface.
No
Yes
Yes
The --bonding-slaves-host_nic parameter is a collection that uses the sub-parameters in the following table.

Table 4.26. --bonding-slaves-host_nic

Name Type Description
host_nic.id|name
string
A reference to another host NIC to bond.
The --bonding-options-option parameter is a collection that uses the sub-parameters in the following table.

Table 4.27. --bonding-options-option

Name Type Description
option.name
string
The bonding option name.
option.value
string
The bonding option value.
type
string
The bonding option type.
The --port_mirroring-networks-network parameter is a collection that uses the sub-parameters in the following table.

Table 4.28. --port_mirroring-networks-network

Name Type Description
network.id
string
A reference to the network to mirror.
The following table lists additional NIC options for resource-based commands.

Table 4.29. Additional command options

Option Description
--host-identifier Adds the NIC to a host as a sub-resource.
--vm-identifier Adds the NIC to a vm as a sub-resource.

Example 4.25. Creating a new network interface on a virtual machine

[RHEVM shell (connected)]# add nic --vm-identifier MyVM1 --name eth0 --network-name MyNetwork

Example 4.26. Updating a network interface on a virtual machine

[RHEVM shell (connected)]# update nic eth0 --vm-identifier MyVM1 --ip-address 10.5.68.123

Example 4.27. Deleting a network interface on a virtual machine

[RHEVM shell (connected)]# remove nic eth0 --vm-identifier MyVM1

Example 4.28. Configuring network bonding on a host

[RHEVM shell (connected)]# add nic --host-identifier MyHost1 --name bond1 --network-name MyNetwork --bonding-slaves-host_nic host_nic.name=eth0 --bonding-slaves-host_nic host_nic.name=eth1

Example 4.29. Assigning a logical network to a host network interface

[RHEVM shell (connected)]# action nic eth0 attach --host-identifier MyHost1 --network-name MyNetwork
The following table lists actions for a host NIC resource.

Table 4.30. Host NIC actions

Action Description
attach Attach a NIC to a host.
detach Detach a NIC from a host.
The following table lists actions for a virtual machine NIC resource.

Table 4.31. Virtual machine NIC actions

Action Description
activate Activate a NIC on a virtual machine.
deactivate Deactivate a NIC on a virtual machine.