# Network namespace
###### tags: `Docker`
## previously on namespace
Namespace is a important technology of containerize virtualization like docker.
Since NTU smartNIC project, I have to check LAN port usage on the same server, so I need to separate the testing LAN port to different namespace and ping from one to the other
## sop
```bash=
# create namespace
ip netns add net0 # ip netns add [name_of_new_namespace]
ip netns add net1
# assign interface to namespace
ip link set dev enp175s0 netns net0 # ip link set dev [LAN_interface_name] netns [name_of_interface]
ip link set dev rename10 netns net1
```
```bash=
# terminal 1
# enter into namespace net0
ip netns exec net0 /bin/bash
# set network interface up
ifconfig enp175s0 up
# set ip
ifconfig enp175s0 172.172.172.1
```
```bash=
# terminal 2
# enter into namespace net0
ip netns exec net1 /bin/bash
# set network interface up
ifconfig rename10 up
# set ip
ifconfig enp175s0 172.172.172.2
# ping
ping 172.172.172.1
```
After finishing test, close all terminals and open a new terminal, delete all netns which you created for testing, net interfaces are all back to host netns
```bash=
ip netns del net0
ip netns del net1
```