What does it mean when it says BOOTPROTO=none
in the /etc/sysconfig/network-scripts/ifcfg-eth0
file.
I remember there used to be BOOTPROTO=static
and it was very clear and straight-forward in telling us that if an IPADDR=<x.x.x.x>
is given, the server will come up with the IP address specified. Likewise, BOOTPROTO=dhcp
will look for a DHCP server to obtain a dynamic IP address. Redhat says:
BOOTPROTO=protocol
where protocol is one of the following:
none — No boot-time protocol should be used.
bootp — The BOOTP protocol should be used.
dhcp — The DHCP protocol should be used.
-
Does it mean if we don't specify the IP in ifcfg-eth0 file, it will look for a DHCP server and if an IP is specified, it will pick up that static IP?
-
What are the chances that it will look for a DHCP server and modify /etc/resolv.conf even if an IP address is specified with
IPADDR=
when BOOTPROTO is set to none?
Context:- We moved datacenters and had to change IP addresses in many of the servers. We had modified /etc/resolv.conf
with the IP addresses of the new DNS servers, but for some reason, in some of the servers the /etc/resolv.conf
got blanked out, or came up with old DNS IP addresses. In the /etc/init.d/network
script I see it is calling /etc/sysconfig/network-scripts/network-functions
which has this function. Is this the culprit?
# Invoke this when /etc/resolv.conf has changed:
change_resolv_conf ()
{
s=$(/bin/grep '^[\ \ ]*option' /etc/resolv.conf 2>/dev/null);
if [ "x$s" != "x" ]; then
s="$s"$'\n';
fi;
if [ $# -gt 1 ]; then
n_args=$#;
while [ $n_args -gt 0 ];
do
if [[ "$s" = *$1* ]]; then
shift;
n_args=$(($n_args-1));
continue;
fi;
s="$s$1";
shift;
if [ $# -gt 0 ]; then
s="$s"$'\n';
fi;
n_args=$(($n_args-1));
done;
elif [ $# -eq 1 ]; then
if [ "x$s" != "x" ]; then
s="$s"$(/bin/grep -vF "$s" $1);
else
s=$(cat $1);
fi;
fi;
(echo "$s" > /etc/resolv.conf;) >/dev/null 2>&1;
r=$?
if [ $r -eq 0 ]; then
[ -x /sbin/restorecon ] && /sbin/restorecon /etc/resolv.conf >/dev/null 2>&1 # reset the correct context
/usr/bin/logger -p local7.notice -t "NET" -i "$0 : updated /etc/resolv.conf";
[ -e /var/lock/subsys/nscd ] && /usr/sbin/nscd -i hosts; # invalidate cache
fi;
return $r;
}
Under what cicumstances are this function called?
I know that setting PEERDNS
to no
will prevent the /etc/resolv.conf from changing, however, I would like to know whether our server had started looking for a DHCP server even though BOOTPROTO
was set to none
and an IP address was specified? if yes, why?
I rebooted the servers issues with this issue a few times to replicate the issue again, but the contents of /etc/resolv.conf
is not changing now. What could've caused the /etc/resolv.conf to be changed in the first reboot?
Can we use BOOTPROTO=static
? I read its deprecated. Our machines are all RHEL 6.5
Best Answer
If you read
/etc/sysconfig/network-scripts/ifup-eth
you'll see that networking uses DHCP ifBOOTPROTO
is set todhcp
orbootp
, otherwise it's not used:Further down, if
DYNCONFIG
is not null (anddhclient
is available) then the scripts attempts to use DHCP otherwise static IP addressing is attempted.Using
grep -r BOOTPROTO *
within/etc
doesn't show anything other than the above snippet, suggesting you could use anything inBOOTPROTO
as long as it isn't one of the two above.You could use
BOOTPROTO=static
, but if we're told it's unsupported then you cannot guarantee that it will work like this in the future. Additionally, it won't make a difference to your issue -static
ornone
will cause the script not to use DHCP.