How to configure static IP on linux

Method 1 = Network Configuration Using a Text User Interface (nmtui)

 

# yum install NetworkManager-tui
and then just type: #nmtui (for semi graphic interface)

Method 2 = edit the configuration file :
RHEL / Red hat / Fedora / CentOS Linux eth0 config file. 

#nano /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
BOOTPROTO="static"
ONBOOT="yes"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
GATEWAY=192.168.1.1
# Your primary public IP address
# The netmask is taken from the PREFIX (where 24 is a public IP, 17 is a private IP)
IPADDR0=192.168.1.5
PREFIX0="24"
# To add a second public IP address:
IPADDR1=172.16.1.10
PREFIX1="24"
DOMAIN=example.com

DNS1=8.8.8.8
DNS2=8.8.4.4

Good Luck :)



Leave a Reply

Your email address will not be published. Required fields are marked *