0

I am using CentOS7 with multiple interfaces (ens161, ens192, ens224, ens256). The box has all static IP's with the exception of one interface that is set up to DHCP (ens192). ens192 is set up as onboot=no. I have a static route set in /etc/sysconfig/network. This works fine. The issue is if I want to bring up ens192 and use the default gateway that it is given by DHCP. I delete the static route that is set in /etc/sysocnfig/network by doing

ip route del 0/0

I then do ifup ens192 the interface will come up with an IP however when I do:

route

I will not see the default gw that the server gives out. The only way to get this to work is to start the NetworkManager process. The reason I have it disabled by default is because for some reason when NetworkManager is running if I do a

 service network restart

it does not honor the

onboot=no

that I have set up in ifcfg-ens192.

The only current solution I see to get his working is to write a script that will do:

ip route del 0/0
echo ''> /etc/sysconfig/network
service network restart
ip route del 0/0
ifup ens192

That's the only thing that seems to work which is a bit "hackey".

Dovid Bender
  • 397
  • 1
  • 6
  • 16

0 Answers0