Skip to content

Commit a9d832f

Browse files
committed
Update next step messages
1 parent 8aa677f commit a9d832f

10 files changed

Lines changed: 102 additions & 35 deletions

nmcli-cli-bond-add

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,21 @@ bond_add() {
7575
echo_or_execute nmcli connection add type bond-slave autoconnect yes ifname \"${IF_SLAVE}\" master \"${BOND_IF_NAME}\"
7676
done
7777

78-
echo
79-
echo "# Next, set IP address for \"${BOND_IF_NAME}\". e.g. nmcli-cli-ipv4 \"${BOND_IF_NAME}\" ..."
80-
echo "# Or, add a bridge interface for \"${BOND_IF_NAME}\". e.g. nmcli-cli-vlan-add \"${BOND_IF_NAME}.xxx\" xxx \"${BOND_IF_NAME}\""
78+
cat << _EOF_
79+
80+
# Next steps:
81+
# -> Check bond status
82+
# cat /proc/net/bonding/${BOND_IF_NAME}
83+
#
84+
# -> Set IP address
85+
# nmcli-cli-ipv4 "${BOND_IF_NAME}" ...
86+
# nmcli-cli-ipv6 "${BOND_IF_NAME}" ...
87+
#
88+
# -> Create a vlan interface:
89+
# nmcli-cli-vlan-add "${BOND_IF_NAME}.100" 100 "${BOND_IF_NAME}"
90+
# -> Create a bridge interface:
91+
# nmcli-cli-bridge-add br1 "${BOND_IF_NAME}"
92+
_EOF_
8193
}
8294

8395
# Main

nmcli-cli-bridge-add

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,16 @@ bridge_add() {
6969
# Slave
7070
echo_or_execute nmcli connection modify \"${IF_SLAVE}\" connection.slave-type bridge connection.master \"${BRDIGE_IF_NAME}\"
7171

72-
# Option: IP
73-
echo
74-
echo "# Next, set IP address for \"${BRDIGE_IF_NAME}\". e.g. nmcli-cli-ipv4 \"${BRDIGE_IF_NAME}\" ..."
72+
cat << _EOF_
73+
74+
# Next steps:
75+
# -> Check bridge status
76+
# brctl show
77+
#
78+
# -> Set IP address
79+
# nmcli-cli-ipv4 "${BRDIGE_IF_NAME}" ...
80+
# nmcli-cli-ipv6 "${BRDIGE_IF_NAME}" ...
81+
_EOF_
7582
}
7683

7784
# Main

nmcli-cli-bridge-delete

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ bridge_delete() {
5959
done
6060

6161
# Delete bridge interface
62-
echo nmcli connection delete \"${BRIDGE_NAME}\"
62+
echo_or_execute nmcli connection delete \"${BRIDGE_NAME}\"
6363
}
6464

6565
# Main

nmcli-cli-ipv4

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,19 @@ ipv4_set() {
113113
exit 1
114114
fi
115115

116-
echo
117-
echo "# Next, restart the interface. e.g. nmcli-cli-restart \"${IF_NAME}\""
116+
cat << _EOF_
117+
118+
# Next steps:
119+
# -> Restart the interface:
120+
# nmcli-cli-restart "${IF_NAME}"
121+
#
122+
# -> Create a bond interface:
123+
# nmcli-cli-bond-add bond1 mode=... "${IF_NAME}" "ens2f0"
124+
# -> Create a vlan interface:
125+
# nmcli-cli-vlan-add "${IF_NAME}.100" 100 "${IF_NAME}"
126+
# -> Create a bridge interface:
127+
# nmcli-cli-bridge-add br1 "${IF_NAME}"
128+
_EOF_
118129
}
119130

120131
# Main

nmcli-cli-ipv4-copy

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,10 @@ ipv4_copy() {
6161
local SRC_IF_NAME=${1:-}
6262
local DEST_IF_NAME=${2:-${SRC_IF_NAME}}
6363

64-
# IP
64+
# IP + Method
6565
SRC_IP_SUBNET=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.addresses:" | awk -e '{ print $2 }' | tr -d '-')
66-
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv4.addresses \"${SRC_IP_SUBNET}\"
67-
68-
# Method
6966
SRC_METHOD=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.method:" | awk -e '{ print $2 }' | tr -d '-')
70-
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv4.method \"${SRC_METHOD}\"
67+
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv4.addresses \"${SRC_IP_SUBNET}\" ipv4.method "${SRC_METHOD}"
7168

7269
# Gateway
7370
SRC_GATEWAY=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.gateway:" | awk -e '{ print $2 }' | tr -d '-')
@@ -77,9 +74,21 @@ ipv4_copy() {
7774
SRC_DNS=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv4.dns:" | awk -e '{ print $2 }' | tr -d '-')
7875
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv4.dns \"${SRC_DNS}\"
7976

80-
echo
81-
echo "# Next, change IP address for \"${SRC_IF_NAME}\"."
82-
echo "# And, restart interfaces. e.g. nmcli-cli-restart \"${SRC_IF_NAME}\"; nmcli-cli-restart \"${DEST_IF_NAME}\""
77+
cat << _EOF_
78+
79+
# Next steps:
80+
# -> Change IP address
81+
# nmcli-cli-ipv4 "$DEST_IF_NAME{}" ...
82+
# -> Restart the interface:
83+
# nmcli-cli-restart "${DEST_IF_NAME}"
84+
#
85+
# -> Create a bond interface:
86+
# nmcli-cli-bond-add bond1 mode=... "${DEST_IF_NAME}" "ens2f0"
87+
# -> Create a vlan interface:
88+
# nmcli-cli-vlan-add "${DEST_IF_NAME}.100" 100 "${DEST_IF_NAME}"
89+
# -> Create a bridge interface:
90+
# nmcli-cli-bridge-add br1 "${DEST_IF_NAME}"
91+
_EOF_
8392
}
8493

8594
# Main

nmcli-cli-ipv6

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Usage:
3131
Examples:
3232
$0 eno1 auto
3333
$0 eno1 dhcp
34-
$0 eno1 static 2001:db8:1::101/48 2001:db8:1::1 "2001:4860:4860::8888,2001:4860:4860::8844"
34+
$0 eno1 static 2001:db8:1::101/48 2001:db8:1::1 "2001:db8:1::1,2001:db8:1::2"
3535
$0 eno1 static 2001:db8:1::101/48
3636
$0 eno1 link-local
3737
$0 eno1 disable
@@ -109,8 +109,19 @@ ipv6_set() {
109109
exit 1
110110
fi
111111

112-
echo
113-
echo "# Next, restart the interface. e.g. nmcli-cli-restart \"${IF_NAME}\""
112+
cat << _EOF_
113+
114+
# Next steps:
115+
# -> Restart the interface:
116+
# nmcli-cli-restart "${IF_NAME}"
117+
#
118+
# -> Create a bond interface:
119+
# nmcli-cli-bond-add bond1 mode=... "${IF_NAME}" "ens2f0"
120+
# -> Create a vlan interface:
121+
# nmcli-cli-vlan-add "${IF_NAME}.100" 100 "${IF_NAME}"
122+
# -> Create a bridge interface:
123+
# nmcli-cli-bridge-add br1 "${IF_NAME}"
124+
_EOF_
114125
}
115126

116127
# Main

nmcli-cli-ipv6-copy

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,8 @@ ipv6_copy() {
6363

6464
# IP
6565
SRC_IP_SUBNET=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.addresses:" | awk -e '{ print $2 }' | tr -d '-')
66-
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv6.addresses \"${SRC_IP_SUBNET}\"
67-
68-
# Method
6966
SRC_METHOD=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.method:" | awk -e '{ print $2 }' | tr -d '-')
70-
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv6.method "${SRC_METHOD}"
67+
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv6.addresses \"${SRC_IP_SUBNET}\" ipv6.method "${SRC_METHOD}"
7168

7269
# Gateway
7370
SRC_GATEWAY=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.gateway:" | awk -e '{ print $2 }' | tr -d '-')
@@ -77,9 +74,21 @@ ipv6_copy() {
7774
SRC_DNS=$(nmcli connection show "${SRC_IF_NAME}" | grep "^ipv6.dns:" | awk -e '{ print $2 }' | tr -d '-')
7875
echo_or_execute nmcli connection modify \"${DEST_IF_NAME}\" ipv6.dns \"${SRC_DNS}\"
7976

80-
echo
81-
echo "# Next, change IP address for \"${SRC_IF_NAME}\"."
82-
echo "# And, restart interfaces. e.g. nmcli-cli-restart \"${SRC_IF_NAME}\"; nmcli-cli-restart \"${DEST_IF_NAME}\""
77+
cat << _EOF_
78+
79+
# Next steps:
80+
# -> Change IP address
81+
# nmcli-cli-ipv4 "${DEST_IF_NAME}" ...
82+
# -> Restart the interface:
83+
# nmcli-cli-restart "${DEST_IF_NAME}"
84+
#
85+
# -> Create a bond interface:
86+
# nmcli-cli-bond-add bond1 mode=... "${DEST_IF_NAME}" "ens2f0"
87+
# -> Create a vlan interface:
88+
# nmcli-cli-vlan-add "${IF_NAME}.100" 100 "${DEST_IF_NAME}"
89+
# -> Create a bridge interface:
90+
# nmcli-cli-bridge-add br1 "${DEST_IF_NAME}"
91+
_EOF_
8392
}
8493

8594
# Main

nmcli-cli-slave-list

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ Usage:
1414
1515
Examples:
1616
$0 bond1
17-
$0 br1
1817
$0 vlan.100
18+
$0 br1
1919
2020
_EOF_
2121
}

nmcli-cli-vlan-add

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,19 @@ vlan_add() {
6666
con-name \"${VLAN_IF_NAME}\" ifname \"${VLAN_IF_NAME}\" dev \"${IF_NAME}\" \
6767
id ${VLAN_ID}
6868

69-
echo
70-
echo "# Next, set IP address for \"${VLAN_IF_NAME}\". e.g. nmcli-cli-ipv4 \"${VLAN_IF_NAME}\" ..."
69+
cat << _EOF_
7170
72-
IF_TYPE=$(nmcli connection show "${IF_NAME}" | grep connection.type | awk -e '{ print $2 }')
73-
if [[ "${IF_TYPE}" != "bridge" ]]; then
74-
echo "# Or, add a bridge interface for \"${VLAN_IF_NAME}\". e.g. nmcli-cli-bridge-add \"br.${VLAN_ID}\" \"${VLAN_IF_NAME}\""
75-
fi
71+
# Next steps:
72+
# -> Check vlan status
73+
# cat /proc/net/vlan/${VLAN_IF_NAME}
74+
#
75+
# -> Set IP address
76+
# nmcli-cli-ipv4 "${VLAN_IF_NAME}" ...
77+
# nmcli-cli-ipv6 "${VLAN_IF_NAME}" ...
78+
#
79+
# -> Create a bridge interface:
80+
# nmcli-cli-bridge-add br1 "${VLAN_IF_NAME}"
81+
_EOF_
7682
}
7783

7884
# Main

nmcli-cli-vlan-delete

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ Usage:
2929
-x Run command (Default: echo only)
3030
3131
Examples:
32-
$0 bond1
32+
$0 eno1.100
33+
$0 bond1.100
34+
$0 vlan.100
3335
3436
_EOF_
3537
}

0 commit comments

Comments
 (0)