# 2 kanals of one provider



## uinman (Feb 19, 2014)

Hello. I have problem. 

```
[root@balans /etc]# uname -a
FreeBSD balans 10.0-RELEASE FreeBSD 10.0-RELEASE #0: Tue Feb 18 23:22:53 NOVT 2014     root@balans:/usr/obj/usr/src/sys/MYKERNEL_ROUTE  amd64
```
I have server (gateway). In this server are installed 3 ethernet cards. One for local net (em0). Others (rl0, rl1) connected to one provider and have one gateway (e.g 5.5.5.5). I configured kernel with options RADIX_MPATH and ROUTETABLES=2
I configure route tables and test:

```
[root@balans ~]# setfib 1 route add default -ifp rl1 5.5.5.5
[root@balans ~]# setfib 1 ping freebsd.org
PING freebsd.org (8.8.178.110): 56 data bytes
64 bytes from 8.8.178.110: icmp_seq=0 ttl=53 time=250.769 ms
```

My route tables:

```
[root@balans ~]# netstat -rn
Routing tables
Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default              5.5.5.5        UGS         0        0    rl0
192.168.0.0/24       link#1             U           0        0    em0
```
And route table 2:

```
[root@balans ~]# setfib 1 netstat -rn
Routing tables (fib: 1)

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default               5.5.5.5        UGS         0        2    rl1
192.168.0.0/24        link#1             U           0        0    em0
```

I configure ipfw and nat

```
#!/bin/sh
fwcmd="/sbin/ipfw -q"
${fwcmd} flush
${fwcmd} nat 1 config log if rl0  reset same_ports
${fwcmd} nat 2 config log if rl1  reset same_ports
${fwcmd} add 130  nat 2 all from any to any via rl1
${fwcmd} add 140 nat 1 all from any to any via rl0
${fwcmd} add 1000 pass all from any to any
```
Why do all packets pass to nat1? If i delete rules 140, available only gproviders gateway (5.5.5.5), but internet on local computer dont work. Why  do packets dont pass to nat2?


----------



## uinman (Feb 22, 2014)

Please, close this topic. I solved this problem


----------



## wblock@ (Feb 22, 2014)

Please post how it was solved to help other readers.


----------

