Running WrapSix in a Linux namespace

← Back

How-to for Debian 8 Jessie

Written by: Eric Guppy <elkabreaks AT yahoo.co.uk>, 2017

Disable unused services

# update-rc.d nfs-common disable
# update-rc.d rpcbind disable
# service rpcbind stop
check with
netstat -lntp

Use management in global ip space

root@dev-nat64-deb1:/home/eric# ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0d:31:6a:90:22 brd ff:ff:ff:ff:ff:ff
    inet 192.168.44.204/24 brd 192.168.44.255 scope global eth1
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:31:ff:fe6a:9022/64 scope link
       valid_lft forever preferred_lft forever

Automatic start on boot

In /etc/rc.local:

# Create the mgmt network namespace
ip netns add nat64

# Add the physical NIC to the namespace
ip link set eth0 netns nat64

# Turn up the link
ip netns exec nat64 ip link set eth0 up

# Configure the nat64 IP address
ip netns exec nat64 ip addr add 201.201.107.226/29 dev eth0
ip netns exec nat64 ip -6 addr add 2002:4444:1:3:2::2/96 dev eth0

# Configure the default route for the mgmt namespace
ip netns exec nat64 ip route add default via 201.201.107.230
ip netns exec nat64 ip -6 route add default via 2002:4444:1:3:2::1

# Turn up the link lo
ip netns exec nat64 ip link set lo up

# Start wrapsix in nat64 namespace and run in backgound
nohup ip netns exec nat64 wrapsix > /dev/null 2>&1 &
exit 0

Finalisation

Config WrapSix & compile.

You can either run above (commands in rc.local) or reboot.

If all good you should see below:

root@dev-nat64-deb1:/home/eric# ip netns exec nat64 netstat -an
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
raw        0      0 0.0.0.0:255             0.0.0.0:*               7          
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node   Path


root@dev-nat64-deb1:/home/eric# ip netns exec nat64 ip -6 route
2002:4444:1:3:2::/96 dev eth0  proto kernel  metric 256
fe80::/64 dev eth0  proto kernel  metric 256
default via 2002:4444:1:3:2::1 dev eth0  metric 1024
default via fe80::222:80ff:fe43:963b dev eth0  proto ra  metric 1024  expires 1631sec hoplimit 64


root@dev-nat64-deb1:/home/eric# ip netns exec nat64 ip route
default via 201.201.107.230 dev eth0
201.201.107.224/29 dev eth0  proto kernel  scope link  src 201.201.107.226


root@dev-nat64-deb1:/home/eric# ip netns exec nat64 ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0d:31:6a:90:18 brd ff:ff:ff:ff:ff:ff
    inet 201.201.107.226/29 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 2002:4444:1:3:2::2/96 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::20d:31:ff:fe6a:9018/64 scope link
       valid_lft forever preferred_lft forever

Last updated: 2023-03-13