rancher / os

Tiny Linux distro that runs the entire OS as Docker containers
https://rancher.com/docs/os/v1.x/en/
Apache License 2.0
6.44k stars 655 forks source link

Always get the nameservers from DHCP even if DHCP is disabled #2525

Open Jason-ZW opened 6 years ago

Jason-ZW commented 6 years ago

RancherOS Version: (ros os version) v1.4.1 Where are you running RancherOS? (docker-machine, AWS, GCE, baremetal, etc.) vFusion Description I disabled DHCP by adding kernel param rancher.network.interfaces.eth0.dhcp=false, After ros startup, I found some error or warning log in cloud-init-save.log, it seems ROS always fetch nameservers form DHCP.

cat cloud-init-save.log  | grep dhcp
time="2018-10-18T08:30:58Z" level=debug msg="Running cmd: [dhcpcd -MA4 -U eth0], output: "
time="2018-10-18T08:30:58Z" level=warning msg="Failed to run cmd: [dhcpcd -MA4 -U eth0], error: exit status 1"
time="2018-10-18T08:30:58Z" level=debug msg="Running cmd: [dhcpcd -MA4 -U eth0], output: "
time="2018-10-18T08:30:58Z" level=warning msg="Failed to run cmd: [dhcpcd -MA4 -U eth0], error: exit status 1"
time="2018-10-18T08:30:58Z" level=info msg="Read from "interface.0.dhcp": ""
time="2018-10-18T08:30:58Z" level=info msg="Read from "interface.0.dhcp": ""
time="2018-10-18T08:30:58Z" level=debug msg="Running cmd: [dhcpcd -MA4 -U eth0], output: "
time="2018-10-18T08:30:58Z" level=warning msg="Failed to run cmd: [dhcpcd -MA4 -U eth0], error: exit status 1"
time="2018-10-18T08:30:58Z" level=debug msg="Running cmd: [dhcpcd -MA4 -U eth0], output: "
time="2018-10-18T08:30:58Z" level=warning msg="Failed to run cmd: [dhcpcd -MA4 -U eth0], error: exit status 1"
Jason-ZW commented 6 years ago

Another process will also trigger this log:

It will check interface's dhcp lease, if dhcp lease not empty, ros will release the dhcp lease

https://github.com/rancher/os/blob/e8b6c69fbfff12646dbc308b50747376bef5ca51/pkg/netconf/netconf_linux.go#L267 https://github.com/rancher/os/blob/e8b6c69fbfff12646dbc308b50747376bef5ca51/pkg/netconf/netconf_linux.go#L218 https://github.com/rancher/os/blob/e8b6c69fbfff12646dbc308b50747376bef5ca51/pkg/netconf/netconf_linux.go#L230