Question

Cectos 7 No TCP/IP 4 gateway

Posted October 15, 2017 1.3k views
CentOS Networking

Hello,

After doing yum update my Centos 7 machine lost the eth0 gateway.
I need to access in from other server in the same zone, via the local IP and set back the gateway using the command like:

ip route replace default via X.Y.Z.1 dev eth0

How can I fix the setting so that the gate way it be all way define.
My IP is dynamic because I delete the server and restore a snapshot from time to time.

1 comment
  • my workaround was to add to rc.local the lines:

    export MYGATEWAY=$(curl -s http://169.254.169.254/metadata/v1/interfaces/public/0/ipv4/gateway)
    echo $MYGATEWAY
    ip route replace default via $MYGATEWAY dev eth0
    
0 answers
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!