Simple Network Segement Setup


Add additional IP on existing Linux box assuming you already have eth0 NIC defined on Linux

sudo ip address add dev eth0

This will add new IP address '' on eth0 device. So we are listening to a new IP address on eth0 also we can add multiple other IPs to eth0 at this point.

You can see all your additional IPs on eth0 using the following command.

ip a | grep eth0

Let's assume the Linux box already had a default IP address that was accessible from the network ''.

We need to define routes for new IP addresses we defined in Linux box in the other servers.

Let's assume we have a windows system that we want to communicate on the Linux server using ''

On the window server we need to run the route command and define a new route as follows;

route add MASK

This route will redirect traffic for segment to gateway which is our Linux server.

Test the connection

On the Linux box lets listen to TCP commination using Netcat (nc) command.

nc -l 3000

On the window system we can use telnet or nc command to connect the linux nc listening server.

nc 3000

There you have it!

Useful Commands to manage Linux Networks

Network Namespaces allows admins to segregate different network on the same computer. The network namespaces are isolated networks that can't directly communicate with the host system or each other!

List all network namespaces

sudo ip netns

Add new namespace

sudo ip netns add network-1

sudo ip netns add network-2

Add virtual ethernet in the namespace

This command creates pair of NIC veth0@veth1 and veth1@veth0

sudo ip -n network-1 link add type veth

List all NICs on the network namespace

sudo ip -n network-1 link

Bringing veth0 NIC up on network namespace

sudo ip -n network-1 link set veth0 up

Assigning IP to NIC in the network namespace

sudo ip -n network-1 a add dev veth0