How to modify subnet configurations of a content host using hammer CLI in Red Hat Satellite 6?
Environment
- Red Hat Satellite 6.
Issue
- How to modify subnet configurations of a content host using hammer CLI?
Resolution
The following commands should help in modifying the subnet configuration of the content host(s) associated with Red Hat Satellite:
-
Interface Specific:
Modify subnet configurations for a particular interface out of the multiple interfaces on the content host(s).
-
Get the subnet details and their ids using the below command:
[root@satellite ~]# hammer subnet list
-
ID | NAME | NETWORK ADDR | NETWORK PREFIX | NETWORK MASK | VLAN ID | BOOT MODE | GATEWAY ADDRESS
-|-|-|-|-|-|-|-
1 | satellite-subnet | 192.168.7.0 | 24 | 255.255.255.0 | | DHCP | 192.168.7.1
-|-|-|-|-|-|-|-
- Get the interface details for a particular host using the below command:
[root@satellite ~]# hammer host info --name client.example.com
<--truncated output-->
Network interfaces:
1) Id: 1
Identifier: eth0
Type: interface (primary, provision)
MAC address: 00:11:22:33:44:55
IPv4 address: 192.168.7.102
FQDN: client.example.com
<--truncated output-->
- Set subnet on the host for any particular interface.
[root@satellite ~]# hammer host update --interface "id=1,subnet_id=1" --name client.example.com
Host updated.
- Unset/Remove subnet on the content host for any particular interface.
[root@satellite ~]# hammer host update --interface "id=1,subnet_id=NIL" --name client.example.com
Host updated.
-
Interface unspecific:
Modify/Assign the same subnet configurations for all assigned interfaces on the content host(s).
NOTE: To assign the same subnet to all the interfaces on the content host(s), it is necessary that all the interfaces have the IP address that belongs to the same subnet else the command will fail with
Could not update the host: Ip does not match selected subneterror. In this case, you can use the commands mentioned in the Interface Specific section above to modify the subnet for each particular interface individually.-
Get the subnet details and their ids using the below command:
[root@satellite ~]# hammer subnet list
-
ID | NAME | NETWORK ADDR | NETWORK PREFIX | NETWORK MASK | VLAN ID | BOOT MODE | GATEWAY ADDRESS
-|-|-|-|-|-|-|-
1 | satellite-subnet | 192.168.7.0 | 24 | 255.255.255.0 | | DHCP | 192.168.7.1
-|-|-|-|-|-|-|-
- Set subnet of the content host directly regardless of interfaces.
[root@satellite ~]# hammer host update --subnet-id 1 --name client.exmaple.com
Host updated.
- Unset/Remove subnet on the content host directly regardless of interfaces.
[root@satellite ~]# hammer host update --subnet=NIL --name client.example.com
Host updated.
NOTE: You can create a loop to update subnet configuration on multiple content hosts.
For more KB articles/solutions related to Red Hat Satellite 6.x hammer Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x hammer-related Issues
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.