خرید بک لینک

I have a usb-etheet adapter. When it comes up, I am applying routes and rules to get the network working the way I want. I'm trying to add post-up directives to /etc/network/interfaces to apply the rules and routes when the network comes up.

The commands I want to automatically apply are:

$ sudo ip route add default via 192.168.1.1 dev eth0 tab 1
$ sudo ip route add default via 192.168.8.1 dev eth1 tab 2
$ sudo ip rule add from 192.168.1.135/32 tab 1 priority 500
$ sudo ip rule add from 192.168.8.100/32 tab 2 priority 600
$ sudo ip route flush cache

My /etc/network/interfaces file is:

auto lo
iface lo inet loopback

iface eth0 inet manual

iface eth1 inet manual
    pre-up iptables-restore < /etc/network/iptables.rules
    # eth1 isn't always up. Don't mess with eth0 unless eth1 is up.
    post-up ip route add default via 192.168.1.1 dev eth0 tab 1
    post-up ip route add default via 192.168.8.1 dev eth1 tab 2
    post-up ip rule add from 192.168.1.135/32 tab 1 priority 500
    post-up ip rule add from 192.168.8.100/32 tab 2 priority 600

For the time being, I'm relying on DHCP to always give me the same addresses. I'll suspect that I'll have to assign static addresses, but that's not today's conce.

When the network comes up, the routes appear to apply successfully, but the rules do not:

djshaw@raspberry3:~/svn/rc/bin$ ip route show
default via 192.168.1.1 dev eth0  metric 202
default via 192.168.8.1 dev eth1  metric 204
192.168.1.0/24 dev eth0  proto keel  scope link  src 192.168.1.135  metric 202
192.168.8.0/24 dev eth1  proto keel  scope link  src 192.168.8.100  metric 204
$ ip rule show
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default

Does anyone know why the rules aren't being applied correctly?

Thanks

برچسب: نویسنده: استخدام کار تاريخ: جمعه 27 فروردين 1395 ساعت: 11:12

صفحه بندی