dresden-weekly / ansible-network-interfaces

Ansible roles to manage Ubuntu network interface configuration
MIT License
86 stars 62 forks source link

network namespaces support #54

Open hydro-b opened 7 years ago

hydro-b commented 7 years ago

It would be nice to have network namespaces support (ip netns). Instead of making "single stack" complex network setups, network namespaces are independent of each other. "Multihoming" setups for example can be made much simpler. Or to create an "out of band" management network (mgmt) seperated from "production" traffic, i.e.:

# add a namespace named "mgmt"
/sbin/ip netns add mgmt
# put physical interface "eno1" in mgmt namespace
/sbin/ip link set eno1 netns mgmt
# (optionally) apply sysctl config within mgmt namespace
/sbin/ip netns exec mgmt /sbin/sysctl -p /etc/sysctl.d/sysctl_disable_ra.conf
# bring up lo interface
/sbin/ip netns exec mgmt /sbin/ip link set lo up
# bring up eno1
/sbin/ip netns exec mgmt /sbin/ip link set eno1 up
# Add IPv6 management address
/sbin/ip netns exec mgmt /sbin/ip -6 addr add 2001:dead::beef/64 dev eno1
# Delete IPv6 management default route
/sbin/ip netns exec mgmt /sbin/ip -6 route del default
# Add IPv6 management default route
/sbin/ip netns exec mgmt /sbin/ip -6 route add default via 2001:dead::1
arBmind commented 7 years ago

Calling /sbin/ip netns directly is not creating a server configuration, is it? I would love to learn more about netns - will put this on the TODO stack.