How to set up static ip


1. First check out your interface using ifconfig

eno16777736: flags=4163  mtu 1500
        inet 192.168.217.135  netmask 255.255.255.0  broadcast 192.168.217.255
        inet6 fe80::20c:29ff:fe95:5b7c  prefixlen 64  scopeid 0x20
        ether 00:0c:29:95:5b:7c  txqueuelen 1000  (Ethernet)
        RX packets 25876  bytes 13611860 (12.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10922  bytes 1312372 (1.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


2. vi /etc/sysconfig/network-scripts/ifcfg-eno16777736

TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=c9a25a13-f2c0-478c-8893-6737f3ecbd38
DEVICE=eno16777736
ONBOOT=no
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes


  Now we must change BOOTPROTO from dhcp to static and add IPADDR, NETMASK, BROADCAST and NETWORK variables.


TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPADDR=192.168.217.135
NETMASK=255.255.255.0
BROADCAST=192.168.217.255
NETWORK=192.168.217.0
GATEWAY=192.168.217.2
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=eno16777736
UUID=c9a25a13-f2c0-478c-8893-6737f3ecbd38
DEVICE=eno16777736
ONBOOT=no
PEERDNS=yes
PEERROUTES=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes

3. If you want to change  DNS servers it's necessary edit vi /etc/resolv.conf

# Generated by NetworkManager
search localdomain
nameserver 192.168.217.2

Comments