networkd : Disabling DHCP

2,848 views
Skip to first unread message

Smain Kahlouch

unread,
Jul 9, 2015, 11:57:39 AM7/9/15
to coreo...@googlegroups.com
Hi,

i'm looking for a way to disable once and for all the DHCP.
Indeed i have static ip configuration, but sometimes, when i reboot the server a new address is configured with dhcp.

        content: |
          [Match]
          MACAddress=52:54:00:a2:98:99
 
          [Network]
          DHCP=none
          Address=10.115.77.87/16
          Gateway=10.115.255.253
          DNS=192.168.11.253
 
          [Route]
          Destination=10.0.0.0/8
          Gateway=10.115.255.254

Could you please help me ?

Regards,
Smana

anton....@coreos.com

unread,
Jul 9, 2015, 12:24:08 PM7/9/15
to coreo...@googlegroups.com
Hi Smana,

Do you use bare-metal installation?
Could you try to test cloud-config with these options?

coreos:
  units:
    - name:  systemd-networkd.service
      command: restart
      drop-ins:
        - name: 50-disable-dhcp.conf
          content: |
          [Match]
          MACAddress=52:54:00:a2:98:99
  
          [Network]
          DHCP=none
          Address=10.115.77.87/16
          Gateway=10.115.255.253
          DNS=192.168.11.253
  
          [Route]
          Destination=10.0.0.0/8
          Gateway=10.115.255.254

Regards,
Anton

Smain Kahlouch

unread,
Jul 10, 2015, 4:05:04 AM7/10/15
to coreo...@googlegroups.com
Hi Anton,

I tried this configuration but i got the following errors in the logs:
Jul 10 07:59:08 coreos2 systemd[1]: [/etc/systemd/system/systemd-networkd.service.d/50-disable-dhcp.conf:1] Unknown section 'Match'. Ignoring.
Jul 10 07:59:08 coreos2 systemd[1]: [/etc/systemd/system/systemd-networkd.service.d/50-disable-dhcp.conf:4] Unknown section 'Network'. Ignoring.
Jul 10 07:59:08 coreos2 systemd[1]: [/etc/systemd/system/systemd-networkd.service.d/50-disable-dhcp.conf:10] Unknown section 'Route'. Ignoring.

And my virtual machine (kvm) is still configured using dhcp.

Thanks for your help,
Smana

anton....@coreos.com

unread,
Jul 10, 2015, 4:26:10 AM7/10/15
to coreo...@googlegroups.com
Dear Smana,

Sorry, I've made a mistake in my example. Please try this one:

coreos:
  units:
    - name:  systemd-networkd.service
      command: restart
    - name: 10-static.network
      runtime: true
      content: |
        [Match]
        MACAddress=52:54:00:a2:98:99

        [Network]
        DHCP=none
        Address=10.115.77.87/16
        Gateway=10.115.255.253
        DNS=192.168.11.253

        [Route]
        Destination=10.0.0.0/8
        Gateway=10.115.255.254

BTW: Which platform do you use? Libvirt + iPXE?

Regards,
Anton

Smain Kahlouch

unread,
Jul 10, 2015, 4:32:11 AM7/10/15
to coreo...@googlegroups.com
My mistake, this was caused by an incorrect mac-address.
My previous configuration works as expected.

Sorry for the inconvenience.
Smana

Smain Kahlouch

unread,
Jul 10, 2015, 9:27:39 AM7/10/15
to coreo...@googlegroups.com
Actually it still starts dhcp ....

default via 10.115.255.253 dev eth0  proto static
default via 10.115.255.254 dev eth0  proto dhcp  src 10.115.200.92  metric 1024
10.115.0.0/16 dev eth0  proto kernel  scope link  src 10.115.200.92
10.115.255.254 dev eth0  proto dhcp  scope link  src 10.115.200.92  metric 1024
10.244.0.0/16 dev flannel.1  proto kernel  scope link  src 10.244.39.0
172.17.0.0/16 dev docker0  proto kernel  scope link  src 172.17.42.1
192.168.0.0/17 via 10.115.255.254 dev eth0  proto static

Do you have any idea ?

Regards,
Smana

anton....@coreos.com

unread,
Jul 10, 2015, 9:52:55 AM7/10/15
to coreo...@googlegroups.com
Dear Smana,

Which platform do you use? Libvirt + iPXE?

Regards,
Anton

anton....@coreos.com

unread,
Jul 10, 2015, 11:39:39 AM7/10/15
to coreo...@googlegroups.com
Dear Smana,

You can find the answer in your bug report:

Regards,
Anton

On Thursday, July 9, 2015 at 5:57:39 PM UTC+2, Smain Kahlouch wrote:
Reply all
Reply to author
Forward
0 new messages