This guide will show basic steps for changing network mask for an active network interface.
Summary
Changes to active network configuration could result in various services becoming unavailable temporarily and so it is recommended that these changes are planned in advance and disruptions anticipated. If changes require a change to default gateway, it is quite likely that at least some services will need to be restarted. This article offers recommendations for which services should be restarted after the changes are made and validated.
Steps
-
First, identify which interface will be altered. Interface Address state should be ok, if it is anything other than ok, remaining steps may fail.
# ipadm show-addr
# ipadm show-addrprop admin0/v4
ADDROBJ TYPE STATE ADDR
admin0/v4
static
ok 192.168.8.2/24
-
Adjust the subnet mask by changing the value of the prefixlen parameter, which in this example is set to /26.
# ipadm set-addrprop -p prefixlen=26 admin0/v4
-
Confirm change was made successfully.
# ipadm show-addr admin0/v4
ADDROBJ TYPE STATE ADDR
admin0/v4
static
ok 192.168.8.2/26
-
If changes to default gateway are required we need to first identify currently configured default gateway, delete it, and add new entry.
# netstat -rn | awk '/^default/ {print $2}'
192.168.8.10
-
Remove this default gateway. Make sure you are connected to system via console or SSH from same network, or via an interface that is other than one being changed.
# route delete default `netstat -rn | awk '/^default/ {print $2}'`
-
Set new default route, and make it persistent. In this example we are going to use 192.168.8.1.
# route add default 192.168.8.1
# echo 192.168.8.1 > /etc/defaultrouter
-
Finally we should restart services as mentioned previously. The following will loop through services and restart them with a short pause between each. Make sure the state is reported as online. If state reports something other than that, after a few moments run svcs <name-of-service> to see if state is online. If not, reach out to RackTop Support for further assistance.
# for s in myrackd datareplicationd bsrupdated name-service-cache ; do svcadm restart $s ; sleep 1 ; svcs $s; done
STATE STIME FMRI
online 8:26:44 svc:/racktop/myrackd:
default
STATE STIME FMRI
online 8:26:45 svc:/racktop/datareplicationd:
default
STATE STIME FMRI
online 8:26:46 svc:/racktop/bsrupdated:
default
STATE STIME FMRI
online 8:26:48 svc:/system/name-service-cache:
default