Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a debian wheezy box running, which is supposed to function as router / firewall / webserver / samba server [...]. I have two accounts from my ISP: acc1 with one static IP, and acc2 with dynamic IPs. The box has two ethernet cards, eth0 and eth1. eth0 is connected to my modem, eth1 to my switch. eth1: ip: 192.168.2.1 netmask: 255.255.255.0 subnet: 192.168.2.0

I set up dnsmasq, basic iptables to allow connections, and both pppoe connections; now I can connect my devices at home to the debian box.

There I set up iproutes to enable internet access. I set the default in main to be ppp1 (static), and now I want to route the subnet 192.168.2.0/24 through ppp2.

# ip rule add from 192.168.2.0/24 table Homenet
# ip route add default via 168.95.98.254 dev ppp2 table Homenet

168.95.98.254 is the gateway through which the pppoe connections connect.

This does not work. As soon as I those settings take effect, my clients cannot ping the internet or 192.168.2.1 anymore. They can, however, ping 168.95.98.254.

BUT when I replace 192.168.2.0/24 in the command above with one of my clients IPs, everything works seemlessly, my client connecting through a dynamic IP, while the others still use the static IP.

What did I miss(-understand)?

Thanks for any help!

here are some outputs:

~$ sudo route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp2
168.95.98.254   0.0.0.0         255.255.255.255 UH    0      0        0 ppp2
168.95.98.254   0.0.0.0         255.255.255.255 UH    0      0        0 ppp1
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1

~$ sudo ip rule list
0:      from all lookup local 
32763:  from 192.168.2.0/24 lookup Homenet 
32764:  from 192.168.2.239 lookup Claire 
32766:  from all lookup main 
32767:  from all lookup default

~$ sudo ip route list table Claire
default via 168.95.98.254 dev ppp2  # this one works! the same on table Homenet works not.

~$ sudo ip route list
default dev ppp2  scope link 
168.95.98.254 dev ppp2  proto kernel  scope link  src xx.xxx.170.105 
168.95.98.254 dev ppp1  proto kernel  scope link  src xxx.xx.85.229 
192.168.2.0/24 dev eth1  proto kernel  scope link  src 192.168.2.1 

I did ask this on the debian forums before, but no networking gurus emerged, thus I thought I might as well try here.

share|improve this question

To wrap this up: I found help on the lartc mailing list pretty quickly. My final ip rules and ip routes are as follows:

$ ip rule ls
0:      from all lookup local 
32763:  from all iif ppp2 lookup Homenet 
32764:  from all iif eth1 lookup Homenet 
32766:  from all lookup main 
32767:  from all lookup default

$ ip route ls
default dev ppp1  scope link 
168.95.98.254 dev ppp2  proto kernel  scope link  src w.x.y.z 
168.95.98.254 dev ppp1  proto kernel  scope link  src a.b.c.d 
192.168.2.0/24 dev eth1  proto kernel  scope link  src 192.168.2.1

$ ip route ls table Homenet
default dev ppp2  scope link 
192.168.2.0/24 dev eth1  scope link

all running smoothly now. :)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .