4. External Network

Warning

Ignore these steps when setting up the Temple HPC master. This interface is already configured and should NOT be changed. These steps are necessary when working on the MHPC lab.

4.1. Getting an dynamic IP using DHCP

To connect to the outside world and have internet our first interface will have to obtain an IP via DHCP. ip addr will show you that the first interface (enp1s1f0) does not have an IP.

[root@master ~]# ip addr
...
2: enp1s1f0: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 00:14:4f:20:13:08 brd ff:ff:ff:ff:ff:ff
...

Run the DHCP client manually to ask for an IP:

[root@master ~]# dhclient enp1s1f0

After successful completion, you will see ip addr reporting the assigned IP.

[root@master ~]# ip addr
...
2: enp1s1f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:14:4f:20:13:08 brd ff:ff:ff:ff:ff:ff
    inet 172.16.2.102/16 brd 172.16.255.255 scope global dynamic enp1s1f0
       valid_lft 86390sec preferred_lft 86390sec
    inet6 fe80::214:4fff:fe20:1308/64 scope link
       valid_lft forever preferred_lft forever
...

4.2. Persistent dynamic IP configuration

Using dhclient direcly is only a temporary measure. If we reboot the system this configuration would be lost.

To make this permanent on RHEL/CentOS we need to modify files in the /etc/sysconfig/network-scripts/ folder. Each interface has a configuration file with the name ifcfg-INTERFACE, e.g., ifcfg-enp1s1f0. Open that file with a text editor and modify its contents to the following.

TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
NAME=enp1s1f0
DEVICE=enp1s1f0
ONBOOT=yes

This will configure the interface during boot with DHCP and obtain a dynamic IP. It will also grant us internet access.

Bring the interface down using the ifdown command.

[root@master ~]# ifdown enp1s1f0

To bring it up use the ifup command:

[root@master ~]# ifup enp1s1f0
Determining IP information for enp1s1f0... done.