CKA: Network Namespace module


Relates to the Prerequsite Network Namesapces module of the CKA course linked here:

As directed in the course, running these commands on a Ubuntu 18.04 system after fresh OS install results in not being able to ping. Has anyone been able to get this working as instructed in the course module? Ping in step 6 results in “connect: Network is unreachable”. What am I missing?:

  1. Create two new network namespaces:
    ip netns add red
    ip netns add blue

  2. Create the virtual cable with two interfaces on either ends:
    ip link add veth-red type veth peer name veth-blue

  3. Attach each interface to the appropriate namespace:
    ip link set veth-red netns red
    ip link set veth-blue netns blue

  4. Assign IP addressed to each interface:
    ip -n red addr add dev veth-red
    ip -n red addr add dev veth-blue

  5. Bring up the new interfaces within their respective namespaces:
    ip -n red link set veth-red up
    ip -n blue link set veth-blue up

  6. Yet, ping does not work between the interfaces as it should:
    ip netns exec red ping

connect: Network is unreachable

Thanks in advance.


Hello sadamahan,
please try to add subnet when adding IP to ns.

ip -n red addr add dev veth-red

ip -n blue addr add dev veth-blue

check the following:

1 Like

It works!

Thank you for the quick reply.

You are welcome @sadamahan