# dnsmasq , 2 ppp connections, route through just ppp1

## adriansi7

Hello!  on my gentoo box i have two ethernet cards : eth0 and eth1 . Eth0 is used for WAN connections : ppp0 and ppp1 links through eth0. The ppp connections are from the same isp and uses the same dns server 172.16.1.1.

The eth1 card is used for lan connections , i have dnsmasq running on eth1 with a DHCP range 192.168.0.2, 192.168.0.6 . The lan machines are going out through ppp0 which is the default dateway , can you please tell me how to make all traffic from dnsmasq and lan connections go out through ppp1 ? I want only dnsmasq with all dhcp clients to go out through ppp1 , and the rest of the services like apache , etc to use the ppp0 as they use it now . Thank you !

----------

## truc

not sure about your exact needs, but apache and other service are running on the gentoo box right?

If so you could probably do some source routing:

create an alternate routing table with ppp1 as the default gw

add a rule to match the lan in the source address to tell the kernel to use the alternate routing table

use the following dnsmasq syntax to make it query the NS through ppp1

```
--server=[/[<domain>]/[domain/]][<ipaddr>[#<port>][@<source-ip>|<interface>[#<port>]]
```

 :Question: 

----------

## adriansi7

not sure i understand you . on my gentoo box i have apache and other services which uses the default gateway ppp0. 

I want only dnsmasq and its clients with ip range 192.168.0.2 - 192.168.0.6 to use ppp1 as gateway . 

This is my route -n output :

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

172.16.1.1      0.0.0.0         255.255.255.255 UH    0      0        0 ppp1

172.16.1.1      0.0.0.0         255.255.255.255 UH    0      0        0 ppp0

192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

0.0.0.0         172.16.1.1      0.0.0.0         UG    0      0        0 ppp0
```

Can you please tell what rules i have to add to the route and iptables ? Thank you !

----------

## truc

try looking for examples on how to use iproute2 to do some source routing, and then you should understand what I was suggesting.

----------

