Skip to content

Commit 79951e1

Browse files
authored
Merge pull request #98040 from dfitzmau/OCPBUGS-59507
OCPBUGS-59507: Replace nmcli commands with YAML declarative for confi…
2 parents 94aa5b6 + b144720 commit 79951e1

File tree

1 file changed

+148
-71
lines changed

1 file changed

+148
-71
lines changed

modules/ipi-install-configuring-networking.adoc

Lines changed: 148 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,109 +6,186 @@
66
[id="configuring-networking_{context}"]
77
= Configuring networking
88

9-
Before installation, you must configure the networking on the provisioner node. Installer-provisioned clusters deploy with a bare-metal bridge and network, and an optional provisioning bridge and network.
9+
Before installation, you must configure networking settings for the provisioner node. Installer-provisioned clusters deploy with a bare-metal bridge and network resources, and an optional provisioning bridge and network resources.
1010

1111
image::210_OpenShift_Baremetal_IPI_Deployment_updates_0122_1.png[Configure networking]
1212

1313
[NOTE]
1414
====
15-
You can also configure networking from the web console.
15+
You can also configure networking settings from the {product-title} web console.
1616
====
1717

18-
.Procedure
18+
.Prerequisites
1919

20-
. Export the bare-metal network NIC name by running the following command:
21-
+
22-
[source,terminal]
23-
----
24-
$ export PUB_CONN=<baremetal_nic_name>
25-
----
20+
* You installed the `nmstate` package with the `sudo dnf install -y <package_name>` command. The package includes the `nmstatectl` CLI.
21+
22+
.Procedure
2623

2724
. Configure the bare-metal network:
2825
+
2926
[NOTE]
3027
====
31-
The SSH connection might disconnect after executing these steps.
28+
When configuring the bare-metal network and the secure shell (SSH) connection disconnects, NMState has a rollback mechanism that automatically reverts any configurations. You can also use the `nmstatectl gc` tool to generate configuration files for specified network state files.
3229
====
33-
34-
.. For a network using DHCP, run the following command:
3530
+
36-
[source,terminal]
31+
.. For a network using DHCP, run the following command to delete the `/etc/sysconfig/network-scripts/ifcfg-eth0` legacy style:
32+
+
33+
[source,yaml,subs="+quotes"]
34+
----
35+
$ nmcli con delete "System <baremetal_nic_name>"
3736
----
38-
$ sudo nohup bash -c "
39-
nmcli con down \"$PUB_CONN\"
40-
nmcli con delete \"$PUB_CONN\"
41-
# RHEL 8.1 appends the word \"System\" in front of the connection, delete in case it exists
42-
nmcli con down \"System $PUB_CONN\"
43-
nmcli con delete \"System $PUB_CONN\"
44-
nmcli connection add ifname baremetal type bridge <con_name> baremetal bridge.stp no <1>
45-
nmcli con add type bridge-slave ifname \"$PUB_CONN\" master baremetal
46-
pkill dhclient;dhclient baremetal
47-
"
48-
----
49-
<1> Replace `<con_name>` with the connection name.
50-
51-
.. For a network using static IP addressing and no DHCP network, run the following command:
5237
+
53-
[source,terminal]
38+
where:
39+
+
40+
`<baremetal_nic_name>`:: Replace `<baremetal_nic_name>` with the name of your network interface controller (NIC).
41+
+
42+
.. For a network that uses Dynamic Host Configuration Protocol (DHCP), create an NMState YAML file and specify the bare-metal bridge interface and any physical interfaces in the file:
43+
+
44+
.Example bare-metal bridge interface configuration that uses DHCP
45+
[source,yaml]
46+
----
47+
# ...
48+
interfaces:
49+
- name: <physical_interface_name>
50+
type: ethernet
51+
state: up
52+
ipv4:
53+
enabled: false
54+
ipv6:
55+
enabled: false
56+
- name: baremetal
57+
type: linux-bridge
58+
state: up
59+
ipv4:
60+
enabled: true
61+
dhcp: true
62+
bridge:
63+
options:
64+
stp:
65+
enabled: false
66+
port:
67+
- name: <physical_interface_name>
68+
# ...
69+
----
70+
+
71+
.. For a network using static IP addressing and no DHCP network, create an NMState YAML file and specify the bare-metal bridge interface details in the file:
72+
+
73+
.Example bare-metal bridge interface configuration that uses static IP addressing and no DHCP network
74+
[source,yaml]
75+
----
76+
# ...
77+
dns-resolver:
78+
config:
79+
server:
80+
- <dns_ip_address>
81+
routes:
82+
config:
83+
- destination: 0.0.0.0/0
84+
next-hop-interface: baremetal
85+
next-hop-address: <gateway_ip>
86+
interfaces:
87+
- name: <physical_interface_name>
88+
type: ethernet
89+
state: up
90+
ipv4:
91+
enabled: false
92+
ipv6:
93+
enabled: false
94+
- name: baremetal
95+
type: linux-bridge
96+
state: up
97+
ipv4:
98+
enabled: true
99+
dhcp: false
100+
address:
101+
- ip: <static_ip_address>
102+
prefix-length: 24
103+
bridge:
104+
options:
105+
stp:
106+
enabled: false
107+
port:
108+
- name: <physical_interface_name>
109+
# ...
54110
----
55-
$ sudo nohup bash -c "
56-
nmcli con down \"$PUB_CONN\"
57-
nmcli con delete \"$PUB_CONN\"
58-
# RHEL 8.1 appends the word \"System\" in front of the connection, delete in case it exists
59-
nmcli con down \"System $PUB_CONN\"
60-
nmcli con delete \"System $PUB_CONN\"
61-
nmcli connection add ifname baremetal type bridge con-name baremetal bridge.stp no ipv4.method manual ipv4.addr "x.x.x.x/yy" ipv4.gateway "a.a.a.a" ipv4.dns "b.b.b.b" <1>
62-
nmcli con add type bridge-slave ifname \"$PUB_CONN\" master baremetal
63-
nmcli con up baremetal
64-
"
65-
----
66-
<1> Replace `<con_name>` with the connection name. Replace `x.x.x.x/yy` with the IP address and CIDR for the network. Replace `a.a.a.a` with the network gateway. Replace `b.b.b.b` with the IP address of the DNS server.
111+
+
112+
where:
113+
+
114+
`<dns-resolver>`:: Defines the DNS server for your bare-metal system.
115+
`<server>`:: Replace `<dns_ip_address>` with the IP address for the DNS server.
116+
`<type>`:: Defines the bridge interface and its static IP configuration.
117+
`<gateway>`:: Replace `<gateway_ip>` with the IP address of the gateway.
118+
`<name>`:: Details the physical interface that you set as the bridge port.
67119

68-
. Optional: If you are deploying with a provisioning network, export the provisioning network NIC name by running the following command:
120+
. Apply the network configuration from the YAML file to the network interfaces for the host by entering the following command:
69121
+
70122
[source,terminal]
71123
----
72-
$ export PROV_CONN=<prov_nic_name>
124+
$ nmstatectl apply <path_to_network_yaml>
73125
----
74126

75-
. Optional: If you are deploying with a provisioning network, configure the provisioning network by running the following command:
127+
. Back up the network configuration YAML file by entering the following command:
76128
+
77129
[source,terminal]
78130
----
79-
$ sudo nohup bash -c "
80-
nmcli con down \"$PROV_CONN\"
81-
nmcli con delete \"$PROV_CONN\"
82-
nmcli connection add ifname provisioning type bridge con-name provisioning
83-
nmcli con add type bridge-slave ifname \"$PROV_CONN\" master provisioning
84-
nmcli connection modify provisioning ipv6.addresses fd00:1101::1/64 ipv6.method manual
85-
nmcli con down provisioning
86-
nmcli con up provisioning
87-
"
131+
$ nmstatectl show > backup-nmstate.yml
88132
----
133+
134+
. Optional: If you are deploying your cluster in a provisioning network, create or edit an NMState YAML file and specify the details in the file.
89135
+
90136
[NOTE]
91137
====
92-
The SSH connection might disconnect after executing these steps.
93-
94-
The IPv6 address can be any address that is not routable through the bare-metal network.
138+
The IPv6 address can be any address that does not route through the bare-metal network.
95139

96-
Ensure that UEFI is enabled and UEFI PXE settings are set to the IPv6 protocol when using IPv6 addressing.
140+
Ensure that you enabled Unified Extensible Firmware Interface (UEFI) and set UEFI PXE settings for the IPv6 protocol when using IPv6 addressing.
97141
====
98-
99-
. Optional: If you are deploying with a provisioning network, configure the IPv4 address on the provisioning network connection by running the following command:
100142
+
101-
[source,terminal]
102-
----
103-
$ nmcli connection modify provisioning ipv4.addresses 172.22.0.254/24 ipv4.method manual
104-
----
105-
106-
. SSH back into the `provisioner` node (if required) by running the following command:
143+
.Example NMState YAML file for a provisioning network
144+
[source,yaml]
145+
----
146+
# ...
147+
interfaces:
148+
- name: eth1
149+
type: ethernet
150+
state: up
151+
ipv4:
152+
enabled: false
153+
ipv6:
154+
enabled: false
155+
- name: provisioning
156+
type: linux-bridge
157+
state: up
158+
ipv4:
159+
enabled: true
160+
dhcp: false
161+
address:
162+
- ip: 172.22.0.254
163+
prefix-length: 24
164+
ipv6:
165+
enabled: true
166+
dhcp: false
167+
address:
168+
- ip: fd00:1101::1
169+
prefix-length: 64
170+
bridge:
171+
options:
172+
stp:
173+
enabled: false
174+
port:
175+
- name: eth1
176+
# ...
177+
----
178+
179+
. Optional: Establish an SSH connection into the `provisioner` node by running the following command:
107180
+
108181
[source,terminal]
109182
----
110-
# ssh kni@provisioner.<cluster-name>.<domain>
183+
# ssh kni@provisioner.<cluster_name>.<domain>
111184
----
185+
+
186+
where
187+
+
188+
`<cluster_name>.<domain>`:: Replace `<cluster_name>` with the name of your cluster and `<domain>` with the fully qualified domain name (FQDN) of your cluster.
112189

113190
. Verify that the connection bridges have been properly created by running the following command:
114191
+
@@ -120,10 +197,10 @@ $ sudo nmcli con show
120197
.Example output
121198
[source,terminal]
122199
----
123-
NAME UUID TYPE DEVICE
124-
baremetal 4d5133a5-8351-4bb9-bfd4-3af264801530 bridge baremetal
125-
provisioning 43942805-017f-4d7d-a2c2-7cb3324482ed bridge provisioning
126-
virbr0 d9bca40f-eee1-410b-8879-a2d4bb0465e7 bridge virbr0
127-
bridge-slave-eno1 76a8ed50-c7e5-4999-b4f6-6d9014dd0812 ethernet eno1
128-
bridge-slave-eno2 f31c3353-54b7-48de-893a-02d2b34c4736 ethernet eno2
200+
NAME UUID TYPE DEVICE
201+
baremetal 832f645a-9337-4afc-b48e-4a55c5779eab bridge baremetal
202+
provisioning e7756e01-d026-4a38-b460-129afaac0ec2 bridge provisioning
203+
Wired connection 1 49ff4c9c-db76-3139-8c18-c49fa7deb39a ethernet eth0
204+
Wired connection 2 c1fb12b1-88a6-3c07-93b9-187c99204c43 ethernet eth1
205+
lo aa030e0f-21ca-498f-b6ce-bac7d4d793f0 loopback lo
129206
----

0 commit comments

Comments
 (0)