CKA: Network Namespace module

Hi

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 192.168.15.1 dev veth-red
    ip -n red addr add 192.168.15.2 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 192.168.15.2

connect: Network is unreachable

Thanks in advance.

SMK

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

ip -n red addr add 192.168.15.1/24 dev veth-red

ip -n blue addr add 192.168.15.2/24 dev veth-blue

check the following:
2020-05-15_18-23-33-a22f7e3ca277cec74eda7b1849a20e5c

1 Like

It works!

Thank you for the quick reply.

You are welcome @sadamahan