...
Code Block |
---|
ip netns exec webserver python3 -m http.server 8082 --binbind 192.168.11.223 |
The webserver is accessible via http://192.168.11.223:8082 independently from the IP settings of the underlying phyiscal interface eth0
.
...
Code Block |
---|
#!/bin/bash ip link add webserv0 link eth0 type macvlan mode bridge ip netns add webserver ip link set webserv0 netns webserver ip netns exec webserver ip addr add 192.168.11.223/24 dev webserv0 ip netns exec webserver ip link set up webserv0 ip netns exec webserver python3 -m http.server 8082 --binbind 192.168.11.223 |
Summary
In this application note, the setup of Linux Network Namespaces was shown. It also explained how to use this scheme to provide virtual Ethernet interfaces that work independently from the underlying phyiscal interface. This allows to run application like PROFINET devices on the same physical device as IP based services like webserver or SSH consoles.