Declare Your Linux Network State! with Nmstate

Declare Your Linux Network State! with Nmstate

Declare Your Linux Network State! with nmstate Edward Haas, Red Hat <[email protected]> Till Maas, Red Hat <[email protected]> Linux kernel Hardware 3 Red Hat oVirt Ifcfg initscripts iproute2 ethtool Netlink Linux kernel Hardware 4 Red Hat OpenStack oVirt Ifcfg initscripts iproute2 ethtool Netlink Linux kernel Hardware 5 Red Hat Cockpit OpenStack oVirt Ifcfg initscripts NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware 6 Red Hat Cockpit Ansible OpenStack oVirt nmcli libnm Ifcfg initscripts NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware 7 Red Hat OpenShift/ Cockpit Ansible OpenStack oVirt OKD/K8S nmcli libnm Ifcfg initscripts NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware 8 Red Hat OpenShift/ Cockpit Ansible OpenStack oVirt okd nmcli libnm Ifcfg initscripts NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware Configure a Bond Bond (mybond0) NIC (eth1) NIC (eth2) 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" 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 Configure a Bond (ifcfg) DEVICE=mybond0 TYPE=Ethernet mode=active-backup NAME=eth1 TYPE=Bond DEVICE=eth1 BONDING_MASTER=yes ONBOOT=yes IPV6INIT=no MASTER=mybond0 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 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 OpenShift/ Cockpit Ansible OpenStack oVirt okd nmstate libnm NM D-Bus NetworkManager iproute2 ethtool Netlink Linux kernel Hardware 15 Design Complete Linux host network state Design Configuration and reporting Design Declarative Describe WHAT you want and don’t bother with the HOW. https://imgs.xkcd.com/comics/pointers.png Design Inspired by IETF Network Modeling Working Group (NETCONF/YANG) Design ● Based on NetworkManager ● Open for provider extensions Design Atomic changes ALL VOID NOTHING Design Allow partial states https://commons.wikimedia.org/wiki/File:Partial_Eclipse_of_Moon.jpg 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 Currently support devices ● Ethernet ● IPv4 & IPv6, static & dynamic ● Bonding ● Linux bridges ● OVS bridges (basic) 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 Simple (Python) API state = netinfo.show() state[‘interfaces’][0][‘mtu’] = 9000 netapplier.apply(state) Verification with rollback Ansible network modules ● net_interface ● net_linkagg ● net_vlan ● net_l3_interface State Ansible Switch Linux 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 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 kubernetes-nmstate (PoC) On every Node, On every SRIO interface, Define 8 VF. NodeNetworkState Define 8 VF on eth0 & eth1. NodeNetConfPolicy Match on Nodes surrentState NodeNetworkState Define 8 VF on eth0. & Apply desireState snippet NodeNetworkState Define 8 VF on eth2 & eth4. Kukubernetes-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 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 nmstate.io How to participate Development: https://github.com/nmstate/nmstate Planning: https://nmstate.atlassian.net Discussions: ● NetworkManager mailing list ● #nmstate on Freenode IRC 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 Thank you! nmstate.io.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    37 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us