H
H
heavyrail2014-01-24 13:40:23
linux
heavyrail, 2014-01-24 13:40:23

CentOS: Why is DHCP client ignoring given gateway address?

There is a machine with CentOS 6.5, a 4G modem is connected to it, Huawei drivers ensure that the modem is displayed as eth2. The task is to ensure the installation of all connection parameters via DHCP from the Yota provider.
The interface configuration file looks like this:

DEVICE=eth2
NM_CONTROLLED=no
ONBOOT=yes
BOOTPROTO=none

The last option is deliberately set to none, because at this stage, the initialization string has not yet been sent to the modem. The string AT^NDISDUP=1,1,"yota.ru" is sent by another script, after which it can be called separately:
dhclient eth2
As a result of such a call (from the superuser, of course), the eth2 interface receives an IP address, in /etc/resolv.conf the provider's DNS addresses are registered, but... the route to the gateway is not entered into the routing table. Analysis of the /var/lib/dhclient/dhclient.leases file shows that the provider passes the gateway address to us in the routers and dhcp-server-identifier options (the address is replaced with a fictitious one below, but in fact it is correct):
lease {
  interface "eth2";
  fixed-address 1.2.3.4;
  option subnet-mask 255.255.255.248;
  option dhcp-lease-time 518400;
  option routers 1.1.1.1;
  option dhcp-message-type 5;
  option dhcp-server-identifier 1.1.1.1;
  option domain-name-servers 94.25.128.74,94.25.208.74;
  option dhcp-renewal-time 259200;
  option dhcp-rebinding-time 453600;
  renew 6 2014/01/25 11:22:25;
  rebind 1 2014/01/27 19:05:59;
  expire 2 2014/01/28 13:05:59;
}

But why is this address not written into the route table?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
EvilMan, 2014-01-24
@EvilMan

Look at the dhtsp-client config.

Y
Yuriy Andamasov, 2014-01-25
@syncer

I don't know for sure, but perhaps you already have a default route?
if so, then I think the reason is this,
you can add DEFROUTE=yes to eth2
and actually DEFROUTE=no for eth0, it all depends on what you need at the output

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question