Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

network.interfaces: "mac=..." doesn't work; dhcp: false is ignored #2521

Closed
michael-brade opened this issue Oct 16, 2018 · 7 comments
Closed

Comments

@michael-brade
Copy link

michael-brade commented Oct 16, 2018

RancherOS Version: v1.4.2-rc1

Where are you running RancherOS? qemu/kvm using virt-manager

Preparation:

I am currently trying to install RancherOS in a virtual machine using virt-manager. Booting the ISO works without any problems. I then partition the disk and install RancherOS it using

ros install -d /dev/sda -p /dev/sda1 -c /mnt/cloud-config.yml -t generic --append "rancher.password=secret"

My cloud-config.yml:

hostname: server
rancher:
    environment:
    console: debian
    docker:
        tls: false
    network:
        interfaces:
            "mac=52:54:00:BC:CF:40":
                address: 172.17.0.91
                gateway: 172.17.0.1
                dhcp: false
        dns:
            nameservers:
                - 10.124.0.254
    services:
        zfs:
            restart: always

Installation works, no issues. Reboot.

Problems

When booting from the IDE harddisk in qemu, I have the following problems:

  • even though dhcp is disabled, my dnsmasq logs DHCP requests from the virtual machine.
  • when the booting is finished, the interface has no IP address
  • dmesg logs system-dockerd[1216]: segfault at 8 ip 00000000000542436 sp 000000 c420d1d308 error 4 in system-dockerd[400000+1485000]. I am not sure if this line is relevant, but it doesn't look good.
@michael-brade
Copy link
Author

Hm. I changed "mac=..." to eth0:, but still, I have no ip address assigned. ip address lists lo, docker0, docker-sys with ip addresses, but eth0 without.

The boot log also says: ros-sysinit:info: Waiting for Docker at unix:///var/run/docker.sock

@niusmallnan
Copy link
Contributor

even though dhcp is disabled, my dnsmasq logs DHCP requests from the virtual machine.

Try to add this rancher.network.interfaces.eth*.dhcp=false to your append params when installing ros to disk.

when the booting is finished, the interface has no IP address

The address should be a CIDR , like: address: 172.17.0.91/24.

dmesg logs system-dockerd[1216]: segfault at 8 ip

I am paying attention to this problem. From the current feedback, there is no impact, but it is worth finding the root cause.
#2484

@michael-brade
Copy link
Author

michael-brade commented Oct 17, 2018

Ok, I have now installed RancherOS on a real server - the problems remain exactly the same:

Try to add this rancher.network.interfaces.eth*.dhcp=false to your append params when installing ros to disk.

That works indeed, but only as --append, if I add rancher.network.interfaces.eth*: dhcp=false to cloud-config.yml, it is apparently ignored.

when the booting is finished, the interface has no IP address

The address should be a CIDR , like: address: 172.17.0.91/24.

Nope, it really doesn't have any ip address assigned at all. ifconfig lists

eth0     Link encap:Ethernet  HWaddr AC:....
         UP BROADCAST RUNNING MULTICAST   MTU:1500  Metric:1
         RX packets:0 ....
         TX packets:9 .....

And BTW, neither with DHCP, nor with a fixed IP address will the interface end up with an IP. Once RancherOS has booted, I need to assign an address manually with ifconfig or ip.

How can I help investigate this further? Once that is fixed, I'll try to look into the segfault, but at the moment I need to get the basics working first.

@niusmallnan
Copy link
Contributor

if I add rancher.network.interfaces.eth*: dhcp=false to cloud-config.yml, it is apparently ignored.

We have confirmed this problem, will fix it later. For now, you can use this kernel cmdline.

==============================================
For others, I cannot reproduce, here are my steps:

Install the ros to disk via ros install -d /dev/sda -c cloud-config.yal --append rancher.network.interfaces.eth*.dhcp=false

The content of cloud-config.yml:

rancher:
  network:
    dns:
      nameservers:
      - 8.8.8.8
      - 8.8.4.4
    interfaces:
      "mac=08:00:27:52:df:2d":
         dhcp: false
         address: 172.22.100.100/24
         gateway: 172.22.100.1

I can get the IP address after reboot:

eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:52:df:2d brd ff:ff:ff:ff:ff:ff
    inet 172.22.100.100/24 brd 172.22.100.255 scope global eth0
       valid_lft forever preferred_lft forever

@michael-brade
Copy link
Author

Oh... my... !!! Thanks for confirming the first problem, and now I found the second:

address: 172.17.0.91

MUST instead be

address: 172.17.0.91/24

Note the missing /24. Easy to miss. Could you maybe make ros config validate complain about a missing netmask? Or make the boot process log an error? Otherwise people might spend hours trying to fix a non-existent problem :}

@niusmallnan
Copy link
Contributor

The todo list:

  1. validate this netmask via ros config validate if possible
  2. add related tips to the document
  3. add more logs If the network settings fail

@rootwuj
Copy link

rootwuj commented Nov 26, 2018

Version - rancher/os:v1.5.0-rc1 11/26
Verified fixed

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants