5.1. Assign static IP on master

5.1.1. Setting a static IP using ip

To temporarily set an IP you can simply set it via the ip command. The currently configured IP addresses will be shown by the ip addr command.

[root@master ~]# ip addr
...
3: eno3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
     link/ether de:ad:be:ef:08:40 brd ff:ff:ff:ff:ff:ff
...

To add or remove an IP address use the ip addr add or ip addr del command.

[root@master ~]# ip addr add 192.168.0.1/20 dev eno3
[root@master ~]# ip addr
...
3: eno3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether de:ad:be:ef:08:40 brd ff:ff:ff:ff:ff:ff
    inet 192.168.16.1/20 scope global ens4
      valid_lft forever preferred_lft forever
...

5.1.2. Persistent static IP configuration

While configuration with the ip is useful for experimentation, we want to make our configuration permanent. We again need to modify the appropiate interface file in the /etc/sysconfig/network-scripts/ folder.

Open that file for the management interface eno3 with a text editor and modify its contents to the following.

TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
NAME=eno3
DEVICE=eno3
ONBOOT=yes
IPADDR=192.168.0.1
PREFIX=20

This will configure the interface during boot with a static IP.

Delete the manual configuration if you still have it and restart the network service. Restarting this service will bring all interfaces down and back up, similar to ifdown and ifup.

[root@master ~]# ip addr del 192.168.0.1/20 dev eno3

Warning

The next command will fail on the Temple HPC masters, therefore, use ifdown eno3 and ifup eno3 to restart the connection.

[root@master ~]# ifdown eno3
[root@master ~]# ifup eno3
[root@master ~]# systemctl restart network
[root@master ~]# systemctl status network
      ● network.service - LSB: Bring up/down networking
   Loaded: loaded (/etc/rc.d/init.d/network; bad; vendor preset: disabled)
   Active: active (exited) since Mon 2019-02-04 15:34:20 EST; 12min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 13802 ExecStop=/etc/rc.d/init.d/network stop (code=exited, status=0/SUCCESS)
  Process: 14061 ExecStart=/etc/rc.d/init.d/network start (code=exited, status=0/SUCCESS)

Feb 04 15:34:19 master systemd[1]: Stopped LSB: Bring up/down networking.
Feb 04 15:34:19 master systemd[1]: Starting LSB: Bring up/down networking...
Feb 04 15:34:20 master network[14061]: Bringing up loopback interface:  [  OK  ]
Feb 04 15:34:20 master network[14061]: Bringing up interface enp1s1f0:  Connection successfully activated (D-Bus active path: /org/fr...ction/5)
Feb 04 15:34:20 master network[14061]: [  OK  ]
Feb 04 15:34:20 master network[14061]: Bringing up interface eno3:  Connection successfully activated (D-Bus active path: /org/fr...ction/6)
Feb 04 15:34:20 master network[14061]: [  OK  ]
Feb 04 15:34:20 master systemd[1]: Started LSB: Bring up/down networking.
Hint: Some lines were ellipsized, use -l to show in full.

Ensure the configuration is correct via ip addr and reboot to verify that the setting is persistent.

[root@master ~]# ip addr
...
3: eno3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether de:ad:be:ef:08:40 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.1/20 brd 192.168.15.255 scope global noprefixroute ens4
       valid_lft forever preferred_lft forever
    inet6 fe80::dcad:beff:feef:840/64 scope link
       valid_lft forever preferred_lft forever
...
../_images/cluster_assign_master_ips.png

Master with assigned IPs