Declare Your Linux Network State! with nmstate Edward Haas, Red Hat - - PowerPoint PPT Presentation

declare your linux network state
SMART_READER_LITE
LIVE PREVIEW

Declare Your Linux Network State! with nmstate Edward Haas, Red Hat - - PowerPoint PPT Presentation

Declare Your Linux Network State! with nmstate Edward Haas, Red Hat < edwardh@redhat.com > Till Maas, Red Hat < till@redhat.com > Linux kernel Hardware 3 Red Hat oVirt Ifcfg initscripts iproute2 ethtool Netlink Linux kernel


slide-1
SLIDE 1

Declare Your Linux Network State!

with nmstate

Edward Haas, Red Hat <edwardh@redhat.com> Till Maas, Red Hat <till@redhat.com>

slide-2
SLIDE 2
slide-3
SLIDE 3

Red Hat

3

Linux kernel Hardware

slide-4
SLIDE 4

Red Hat

4

  • Virt

Linux kernel iproute2 Ifcfg initscripts Netlink ethtool Hardware

slide-5
SLIDE 5

Red Hat

5

OpenStack

  • Virt

Linux kernel iproute2 Ifcfg initscripts Netlink ethtool Hardware

slide-6
SLIDE 6

Red Hat

6

OpenStack

  • Virt

Linux kernel iproute2 Ifcfg initscripts Netlink Cockpit NetworkManager NM D-Bus ethtool Hardware

slide-7
SLIDE 7

Red Hat

7

OpenStack

  • Virt

Linux kernel iproute2 Ifcfg initscripts Netlink Ansible Cockpit NetworkManager NM D-Bus libnm nmcli ethtool Hardware

slide-8
SLIDE 8

Red Hat

8

OpenShift/ OKD/K8S OpenStack

  • Virt

Linux kernel iproute2 Ifcfg initscripts Netlink Ansible Cockpit NetworkManager NM D-Bus libnm nmcli ethtool Hardware

slide-9
SLIDE 9

OpenShift/

  • kd

OpenStack

  • Virt

Linux kernel iproute2 Ifcfg initscripts Netlink Ansible Cockpit NetworkManager NM D-Bus libnm nmcli ethtool Hardware

slide-10
SLIDE 10

NIC (eth1) NIC (eth2) Bond (mybond0)

Configure a Bond

slide-11
SLIDE 11

Configure a Bond (nmcli)

$ nmcli con add type bond ifname mybond0 mode active-backup $ nmcli con add type ethernet ifname eth1 master mybond0 $ nmcli con add type ethernet ifname eth2 master mybond0 $ nmcli con mod mybond0 ipv4.method manual ipv4.address "1.2.3.4/24"

slide-12
SLIDE 12

Configure a Bond (iproute2)

# ip link add mybond0 type bond # ip link set eth1 master mybond0 # ip link set eth2 master mybond0 # ip addr add 1.2.3.4/24 dev mybond0

slide-13
SLIDE 13

Configure a Bond (ifcfg)

DEVICE=mybond0 mode=active-backup TYPE=Bond BONDING_MASTER=yes IPV6INIT=no NAME=bond00 ONBOOT=yes BOOTPROTO=none IPADDR=1.2.3.4 PREFIX=24 DEFROUTE=yes TYPE=Ethernet NAME=eth1 DEVICE=eth1 ONBOOT=yes MASTER=mybond0 SLAVE=yes TYPE=Ethernet NAME=eth2 DEVICE=eth2 ONBOOT=yes MASTER=mybond0 SLAVE=yes

slide-14
SLIDE 14

Configure a Bond (nmstate)

interfaces:

  • name: mybond0

type: bond state: up link-aggregation: mode: active-backup slaves:

  • eth1
  • eth2

ipv4: enabled: true address:

  • ip: 1.2.3.4

prefix-length: 24

slide-15
SLIDE 15

15

OpenShift/

  • kd

OpenStack

  • Virt

Linux kernel iproute2 Netlink Ansible Cockpit NetworkManager NM D-Bus libnm ethtool Hardware nmstate

slide-16
SLIDE 16

Design

Complete Linux host network state

slide-17
SLIDE 17

Design

Configuration and reporting

slide-18
SLIDE 18

Design

Declarative

Describe WHAT you want and don’t bother with the HOW.

https://imgs.xkcd.com/comics/pointers.png

slide-19
SLIDE 19

Design

Inspired by IETF Network Modeling Working Group (NETCONF/YANG)

slide-20
SLIDE 20

Design

  • Based on NetworkManager
  • Open for provider extensions
slide-21
SLIDE 21

Design

Atomic changes

NOTHING ALL VOID

slide-22
SLIDE 22

Design

Allow partial states

https://commons.wikimedia.org/wiki/File:Partial_Eclipse_of_Moon.jpg

slide-23
SLIDE 23

Nmstate Design

  • simple API:
  • state = show()
  • apply(state)
  • allow partial states to configure only subset of all settings
  • verification of the configuration by comparing the runtime state
  • atomic configuration changes: Rollback to previous state on failure by default
  • Use power of NetworkManager but allow enhancements missing in

NetworkManager

slide-24
SLIDE 24

Currently support devices

  • Ethernet
  • IPv4 & IPv6, static & dynamic
  • Bonding
  • Linux bridges
  • OVS bridges (basic)
slide-25
SLIDE 25

# nmstatectl show eth0

  • interfaces:
  • name: eth0

type: ethernet state: up mtu: 1500 ipv4: enabled: true dhcp: true address:

  • ip: 192.168.122.197

prefix-length: 24

Command-line interface

nmstatectl [show|set|edit]

slide-26
SLIDE 26

Simple (Python) API

state = netinfo.show() state[‘interfaces’][0][‘mtu’] = 9000 netapplier.apply(state)

slide-27
SLIDE 27

Verification with rollback

slide-28
SLIDE 28

Ansible network modules

  • net_interface
  • net_linkagg
  • net_vlan
  • net_l3_interface

Switch Linux Ansible State

slide-29
SLIDE 29

Ansible network modules for Linux

# Ansible tasks:

  • net_linkagg:

name: web-bond state: up members:

  • eth1
  • eth2

# nmstate

  • interfaces:
  • name: web-bond

type: bond state: up link-aggregation: mode: 802.3ad

  • ptions: {}

slaves:

  • eth1
  • eth2
slide-30
SLIDE 30

kubernetes-nmstate (PoC)

  • Manage host/node network through Kubernetes.
  • Implements the suggested Kubernetes Node Network Configuration CRD.

NodeNetConfPolicy Match on Nodes surrentState & Apply desireState snippet NodeNetworkState NodeNetworkState NodeNetworkState

PoC: https://github.com/nmstate/kubernetes-nmstate

slide-31
SLIDE 31

kubernetes-nmstate (PoC)

NodeNetConfPolicy Match on Nodes surrentState & Apply desireState snippet NodeNetworkState NodeNetworkState NodeNetworkState On every Node, On every SRIO interface, Define 8 VF. Define 8 VF on eth0 & eth1. Define 8 VF on eth0. Define 8 VF on eth2 & eth4.

slide-32
SLIDE 32

Ku

32

apiVersion: "k8s.cni.cncf.io/v1" kind: NodeNetworkState metadata: name: my-node-netstate spec: managed: true nodeName: my-node desiredState: interfaces:

  • name: bond0

type: bond state: up link-aggregation: mode: balance-rr slaves:

  • eth0
  • eth1

ipv4: enabled: true address:

  • ip: 10.10.10.2

prefix-length: 24 ipv6: enabled: false status: currentState: capabilities: [] interfaces:

  • if-index: 10

name: bond0 type: bond state: up phys-address: aa:bb:cc:dd:ee:ff link-aggregation: mode: balance-rr slaves:

  • eth0
  • eth1

ipv4: enabled: true address:

  • ip: 10.10.10.2

prefix-length: 24 ipv6: enabled: false

kubernetes-nmstate (PoC)

slide-33
SLIDE 33

Challenges

# desired state

  • interfaces:
  • name: eth0

type: ethernet state: up ipv4: enabled: true dhcp: true # actual state

  • interfaces:
  • name: eth0

type: ethernet state: up ipv4: enabled: true dhcp: true address:

  • ip: 192.168.122.197

prefix-length: 24

slide-34
SLIDE 34

nmstate.io

slide-35
SLIDE 35

How to participate

Development: https://github.com/nmstate/nmstate Planning: https://nmstate.atlassian.net Discussions:

  • NetworkManager mailing list
  • #nmstate on Freenode IRC
slide-36
SLIDE 36

Outlook

  • Different state for configuration/persistence and runtime
  • Support commit and confirm commands
  • More interface types
  • Add read-only report values
  • Proprietary vendor interfaces
  • NETCONF/YANG
  • Routing (under review)
  • Firewall
  • Integration with oVirt, OpenStack, KubeVirt
slide-37
SLIDE 37

Thank you!

nmstate.io