declare your linux network state
play

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


  1. Declare Your Linux Network State! with nmstate Edward Haas, Red Hat < edwardh@redhat.com > Till Maas, Red Hat < till@redhat.com >

  2. Linux kernel Hardware 3 Red Hat

  3. oVirt Ifcfg initscripts iproute2 ethtool Netlink Linux kernel Hardware 4 Red Hat

  4. OpenStack oVirt Ifcfg initscripts iproute2 ethtool Netlink Linux kernel Hardware 5 Red Hat

  5. Cockpit OpenStack oVirt Ifcfg initscripts NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware 6 Red Hat

  6. Cockpit Ansible OpenStack oVirt nmcli libnm Ifcfg initscripts NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware 7 Red Hat

  7. OpenShift/ Cockpit Ansible OpenStack oVirt OKD/K8S nmcli libnm Ifcfg initscripts NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware 8 Red Hat

  8. OpenShift/ Cockpit Ansible OpenStack oVirt okd nmcli libnm Ifcfg initscripts NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware

  9. Configure a Bond Bond (mybond0) NIC (eth1) NIC (eth2)

  10. 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"

  11. 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

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

  13. 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

  14. OpenShift/ Cockpit Ansible OpenStack oVirt okd nmstate libnm NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware 15

  15. Design Complete Linux host network state

  16. Design Configuration and reporting

  17. Design Declarative Describe WHAT you want and don’t bother with the HOW. https://imgs.xkcd.com/comics/pointers.png

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

  19. Design Based on NetworkManager ● Open for provider extensions ●

  20. Design Atomic changes ALL NOTHING VOID

  21. Design Allow partial states https://commons.wikimedia.org/wiki/File:Partial_Eclipse_of_Moon.jpg

  22. 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

  23. Currently support devices Ethernet ● IPv4 & IPv6, static & dynamic ● Bonding ● Linux bridges ● OVS bridges (basic) ●

  24. Command-line interface # nmstatectl show eth0 --- interfaces: - name: eth0 type: ethernet state: up nmstatectl [show|set|edit] mtu: 1500 ipv4: enabled: true dhcp: true address: - ip: 192.168.122.197 prefix-length: 24

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

  26. Verification with rollback

  27. Ansible network modules net_interface ● net_linkagg ● net_vlan ● net_l3_interface ● State Ansible Switch Linux

  28. Ansible network modules for Linux # Ansible # nmstate tasks: --- - net_linkagg: interfaces: name: web-bond - name: web-bond state: up type: bond members: state: up - eth1 link-aggregation: - eth2 mode: 802.3ad options: {} slaves: - eth1 - eth2

  29. kubernetes-nmstate (PoC) - Manage host/node network through Kubernetes. - Implements the suggested Kubernetes Node Network Configuration CRD. NodeNetworkState NodeNetConfPolicy Match on Nodes surrentState NodeNetworkState & Apply desireState snippet NodeNetworkState PoC: https://github.com/nmstate/kubernetes-nmstate

  30. kubernetes-nmstate (PoC) On every Node, On every SRIO interface, Define 8 VF. NodeNetworkState Define 8 VF on eth0 & eth1. NodeNetConfPolicy Define 8 VF on eth0. Match on Nodes surrentState NodeNetworkState & Apply desireState snippet Define 8 VF on eth2 & eth4. NodeNetworkState

  31. Ku kubernetes-nmstate (PoC) apiVersion: "k8s.cni.cncf.io/v1" status: kind: NodeNetworkState currentState: metadata: capabilities: [] name: my-node-netstate interfaces: spec: - if-index: 10 managed: true name: bond0 nodeName: my-node type: bond desiredState: state: up interfaces: phys-address: aa:bb:cc:dd:ee:ff - name: bond0 link-aggregation: type: bond mode: balance-rr state: up slaves: link-aggregation: - eth0 mode: balance-rr - eth1 slaves: ipv4: - eth0 enabled: true - eth1 address: ipv4: - ip: 10.10.10.2 enabled: true prefix-length: 24 address: ipv6: - ip: 10.10.10.2 enabled: false prefix-length: 24 ipv6: enabled: false 32

  32. Challenges # desired state # actual state --- --- interfaces: interfaces: - name: eth0 - name: eth0 type: ethernet type: ethernet state: up state: up ipv4: ipv4: enabled: true enabled: true dhcp: true dhcp: true address: - ip: 192.168.122.197 prefix-length: 24

  33. nmstate.io

  34. How to participate Development: https://github.com/nmstate/nmstate Planning: https://nmstate.atlassian.net Discussions: NetworkManager mailing list ● #nmstate on Freenode IRC ●

  35. 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 ●

  36. Thank you! nmstate.io

Recommend


More recommend