-1

I examining a debian router's configuration.

Route output:

71.71.71.0      0.0.0.0         255.255.255.224 U     0      0        0 eth1
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         71.71.71.30    0.0.0.0         UG    0      0        0 eth1

The route output is straigthforward but the interfaces file defines additional ip routes and rules. Could please some networking guru enlighten me what are these for?

The ip address is fictional (the 71.71.71 part is replacement). The machine have 2 interfaces (eth0 10 range LAN and eth1 71 range WAN).

iface eth1 inet static
    address 71.71.71.10
    netmask 255.255.255.224
    up ip route add 71.71.71.0/27 dev eth1 src 71.71.71.10 table table1
    up ip route add 10.0.0.0/24 dev eth0 table table1
    up ip route add default via 71.71.71.30 dev eth1 table table1
    up ip rule add from 71.71.71.10/32 table table1
    up ip rule add to 71.71.71.10/32 table table1
    up ip addr add 71.71.71.20/27 dev eth1
    up ip route add 71.71.71.0/27 dev eth1 src 71.71.71.20 table table2
    up ip route add 10.0.0.0/24 dev eth0 table table2
    up ip route add default via 71.71.71.30 dev eth1 table table2
    up ip rule add from 71.71.71.20/32 table table2
    up ip rule add to 71.71.71.20/32 table table2

Thanks

0

Those additional rules are creating separate routing tables to allow the multiple IP addresses on eth1 to respond when they receive traffic directly. Adding additional IP addresses in linux is fairly simple, the additional routing tables are there to allow them to function as though they were completely separate interfaces.

  • Ok thanks I didn't set this up, I don't get it what is the difference between that setup and using simple ip aliases like eth0 71.71.71.71, eth0:0 71.71.71.72, eth0:1 71.71.71.73? – nidalee333 Jan 16 '15 at 11:22
  • Why don't you try and add a few aliases to your eth1, and then see which IP address the pings come back from. – NickW Jan 16 '15 at 11:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.