Last active
October 15, 2015 09:52
-
-
Save skinny/86cce313786c9498b140 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This config is used on a server with 6 physical network cards. four of them will be used to create two 2-nic bonds (bond0, bond1) and the remaining two will remain unused for now (enp5s0f0,enp5s0f1). First we enable the bonding module by writing out two files (review the bonding module options for your own environment). We then write out unit files to : | |
- 00-bond*.netdev : Setup two bonding interfaces (units) | |
- 01-*.network : Attach each interface to the right bond interface | |
- 99-dhcp.network : Disable DHCP on the remaining interfaces (' catch all ') | |
- down-interfaces.service : One time service to flush out all the assigned IP adresses and down the interfaces | |
- systemd-networkd.service : Restart the networkd service to 'up' the bonding interfaces | |
---------------------------------------------- | |
#cloud-config | |
hostname: node-00 | |
write_files: | |
- path: /etc/modprobe.d/bonding.conf | |
permissions: 0644 | |
owner: root | |
content: | | |
options bonding miimon=100 mode=4 lacp_rate=1 | |
- path: /etc/modules-load.d/bonding.conf | |
permissions: 0644 | |
owner: root | |
content: | | |
bonding | |
coreos: | |
units: | |
- name: systemd-networkd.service | |
command: stop | |
- name: 00-bond0.netdev | |
runtime: true | |
content: | | |
[NetDev] | |
Name=bond0 | |
Kind=bond | |
- name: 00-bond1.netdev | |
runtime: true | |
content: | | |
[NetDev] | |
Name=bond1 | |
Kind=bond | |
- name: 01-enp2s0f0.network | |
content: | | |
[Match] | |
Name=enp2s0f0 | |
[Network] | |
Bond=bond0 | |
- name: 01-enp4s0f0.network | |
content: | | |
[Match] | |
Name=enp4s0f0 | |
[Network] | |
Bond=bond0 | |
- name: 01-enp2s0f1.network | |
content: | | |
[Match] | |
Name=enp2s0f1 | |
[Network] | |
Bond=bond1 | |
- name: 01-enp4s0f1.network | |
content: | | |
[Match] | |
Name=enp4s0f1 | |
[Network] | |
Bond=bond1 | |
- name: 10-bond0.network | |
runtime: true | |
content: | | |
[Match] | |
Name=bond0 | |
[Network] | |
DNS=8.8.8.8 | |
Address=172.16.250.219/24 | |
Gateway=172.16.250.254 | |
- name: 10-bond1.network | |
runtime: true | |
content: | | |
[Match] | |
Name=bond1 | |
[Network] | |
Address=10.172.40.219/24 | |
- name: 99-dhcp.network | |
runtime: true | |
content: | | |
[Match] | |
Name=en* | |
[Network] | |
DHCP=no | |
- name: down-interfaces.service | |
command: start | |
content: | | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/ip link set enp2s0f0 down | |
ExecStart=/usr/bin/ip addr flush dev enp2s0f0 | |
ExecStart=/usr/bin/ip link set enp2s0f1 down | |
ExecStart=/usr/bin/ip addr flush dev enp2s0f1 | |
ExecStart=/usr/bin/ip link set enp4s0f0 down | |
ExecStart=/usr/bin/ip addr flush dev enp4s0f0 | |
ExecStart=/usr/bin/ip link set enp4s0f1 down | |
ExecStart=/usr/bin/ip addr flush dev enp4s0f1 | |
ExecStart=/usr/bin/ip link set enp5s0f0 down | |
ExecStart=/usr/bin/ip addr flush dev enp5s0f0 | |
ExecStart=/usr/bin/ip link set enp5s0f1 down | |
ExecStart=/usr/bin/ip addr flush dev enp5s0f1 | |
- name: systemd-networkd.service | |
command: restart | |
update: | |
group: stable | |
reboot-strategy: 'off' | |
users: | |
- name: core | |
groups: | |
- sudo | |
shell: /bin/bash | |
ssh-authorized-keys: | |
- ssh-rsa .... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment