Below are basic configuration instructions to setup static IP address on Redhat Enterprise Linux ( RHEL7 ). First, list your network interfaces with ip command:
# ip addr show
2: enp0s3:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:15:38:b7 brd ff:ff:ff:ff:ff:ff
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe15:38b7/64 scope link 
       valid_lft forever preferred_lft forever

Make a note of network interface you would like to set with static IP address. Next, locate a corresponding script to the network interface name. In our case this is enp0s3 located at /etc/sysconfig/network-scripts/ifcfg-enp0s3. Open this file and enter the following information. Note that your HWADDR,DEVICE,UUID will be different:
DEVICE="enp0s3"
NETBOOT="yes"
HWADDR="08:00:27:15:38:B7"
TYPE="Ethernet"
BOOTPROTO="none"
NAME="enp0s3"
UUID="462f4834-4fe7-43a7-84e7-83b2722e94c1"
ONBOOT="yes"
IPADDR="10.1.1.110"
NETMASK="255.0.0.0"
GATEWAY="10.1.1.1"
The above will set our enp0s3 network interface with static IP address 10.1.1.110. Once you have made the necessary changes restart RHEL7's system networking:
# systemctl restart network
Confirm that your IP address has been updated:
# ip addr show
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:15:38:b7 brd ff:ff:ff:ff:ff:ff
    inet 10.1.1.110/8 brd 10.255.255.255 scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 fe80::a00:27ff:fe15:38b7/64 scope link 
       valid_lft forever preferred_lft forever


Free Linux eBooks

Go to top