0

I am trying to understand Network Namespaces and Network Interfaces on Ubuntu 18.04. Here is what I tried so far: I created a namespace blue

ip netns add blue

Then ran ifconfig in the network namespace:

sudo ip netns exec blue bash
ifconfig

but it didn't output anything.

I set the loopback interface up:

ip link set dev lo up

then added two more interfaces

ip link list

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: veth1@veth0: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether da:d3:16:09:3e:2a brd ff:ff:ff:ff:ff:ff
3: veth0@veth1: <BROADCAST,MULTICAST,M-DOWN> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 6e:38:e0:a1:a7:6b brd ff:ff:ff:ff:ff:ff

Now curl works fine on my server

nc -l 8888
GET / HTTP/1.1
Host: localhost:8888
User-Agent: curl/7.63.0
Accept: */*

I accept the fact that I do NOT understand how network interfaces work. How can I use veth0 and veth1 for network communication?

  • "veth" network interfaces come in pairs, so you need one endpoint in the "blue" namespace, and one endpoint in the main network namespace. Here is an answer with an example script that configures something similar for you. – dirkt May 24 at 8:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.