Change network config on CentOS 7

Just for me to record the things that worked for me changing ip addresses, gateways etc.. 😉

* vi /etc/sysconfig/network-scripts/ifcfg-(name of interface) <- get this via ifconfig.
* add METRIC if needed or have multiple interfaces
* service network restart , to restart the network

Gateway:

* ip route show
* ip route replace default via 192.168.91.10 dev eth0 (if needed to change the default gateway)
* add/change gateway=ip.address.gateway. to /etc/sysconfig/network (for permanent changes, or change the ifcfg file in  /etc/sysconfig/network-scripts dir)

Example /etc/sysconfig/network-scripts/ifcg file:

HWADDR=00:0C:29:51:EC:FC
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=172.16.216.148
PREFIX=21
GATEWAY=172.16.216.254
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=Office
UUID=15b8b9fb-68ff-3246-a4ec-3116d3ab3b96
ONBOOT=yes
AUTOCONNECT_PRIORITY=-999
DNS1=10.100.12.249
DNS2=10.100.14.249
PEERDNS=no
METRIC=100

 

Geef een antwoord

Het e-mailadres wordt niet gepubliceerd.

Deze site gebruikt Akismet om spam te verminderen. Bekijk hoe je reactie-gegevens worden verwerkt.