# How can I implement it with multi-route-table



## abonege (Apr 23, 2015)

My requirement is like this:
I have 3 ports in my box, 1 port is used for the primary, and communicate with outside, for others two ports, each of them connects to a separate inner-network, such as sub-network-1, sub-network-2. network1 and network2 can not see each others, so IP address in them can be the same and without conflict.

network1: 192.168.5.2-192.168.5.100/24
network2: 192.168.5.2-192.168.5.100/24

In my box,
I want port1 and port2 both have the same IP 192.168.5.1. Port1 is used to connect with network1 only, and port2 is used to connect with network2 only.

Now, assuming that there is a process named proc1, sometimes I want proc1 to communicate with network1 and sometimes with network2.

I know setfib(1) can help on multi-route-table, but I think the limitation of it is IP can not conflict.

Any solutions can solve my issue?

Thanks in advance.


----------



## abonege (Apr 23, 2015)

It seems jail+VNET can help on this, Can I fulfill the requirement only via VNET?


----------



## SirDice (Apr 23, 2015)

If you want to keep your sanity don't use the same addresses for both networks. There's rarely any good reason for it and it'll make managing a nightmare. Use different subnets for each and use a firewall to prevent network1 from accessing network2 and vice versa.


----------



## abonege (Apr 23, 2015)

SirDice, Thanks.
I have no choice, I have to support the above requirement as customer needs that.

I will try more researching about kernel code,  I know freebsd FreeBSD supports multi-route table, it will be a good message to me if IP addresses are irrelevant for each route table.


----------

