Having some issues getting my interfaces configured properly. The
configuration is a bit complex. The machine has 4 network interfaces,
eth1,2,3,4. Each interface is connected to a different network. Each
network has a dual ipv4/ipv6 address space.
eth1: vlan10: 10.0.4/22: 2001:740:7063:10::/64
eth2: vlan20: 10.0.0/22: 2001:740:7063:20::/64
eth3: vlan30: 10.0.16/22: 2001:740:7063:30::/64
eth4: vlan40: 10.0.20/22: 2001:740:7063:40::/64
In /etc/network/interfaces I have the following:
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet static
address 10.0.4.240
netmask 255.255.252.0
broadcast 10.0.7.255
gateway 10.0.4.1
iface eth1 inet6 static
address 2001:740:7063:10::240
netmask 64
gateway 2001:740:7063:10::10
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth1/autoconf
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth1/accept_ra
auto eth2
iface eth2 inet static
address 10.0.0.240
netmask 255.255.252.0
broadcast 10.0.3.255
gateway 10.0.0.1
iface eth2 inet6 static
address 2001:740:7063:20::240
netmask 64
gateway 2001:740:7063:20::10
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth2/autoconf
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth2/accept_ra
auto eth3
iface eth3 inet static
address 10.0.16.240
netmask 255.255.252.0
broadcast 10.0.23.255
gateway 10.0.16.1
iface eth3 inet6 static
address 2001:740:7063:30::240
netmask 64
gateway 2001:740:7063:30::10
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth3/autoconf
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth3/accept_ra
auto eth4
iface eth4 inet static
address 10.0.20.240
netmask 255.255.252.0
broadcast 10.0.23.255
gateway 10.0.20.1
post-up ip route add table 100 to 10.0.4.0/22 dev eth1
post-up ip route add table 100 to default via 10.0.4.1 dev eth1
post-up ip route add table 200 to 10.0.0.0/22 dev eth2
post-up ip route add table 200 to default via 10.0.0.1 dev eth2
post-up ip route add table 300 to 10.0.16.0/22 dev eth3
post-up ip route add table 300 to default via 10.0.16.1 dev eth3
post-up ip route add table 400 to 10.0.20.0/22 dev eth4
post-up ip route add table 400 to default via 10.0.20.1 dev eth4
post-up ip rule add from 10.0.4.0/22 table 100 priority 100
post-up ip rule add from 10.0.0.0/22 table 200 priority 200
post-up ip rule add from 10.0.16.0/22 table 300 priority 300
post-up ip rule add from 10.0.20.0/22 table 400 priority 400
post-up ip route flush cache
iface eth4 inet6 static
address 2001:740:7063:40::240
netmask 64
gateway 2001:740:7063:40::10
post-up ip -6 route add table 110 to 2001:740:7063:10::/64 dev eth1
post-up ip -6 route add table 110 to default via
2001:740:7063:10::10 dev eth1
post-up ip -6 route add table 210 to 2001:740:7063:20::/64 dev eth2
post-up ip -6 route add table 210 to default via
2001:740:7063:20::10 dev eth2
post-up ip -6 route add table 310 to 2001:740:7063:30::/64 dev eth3
post-up ip -6 route add table 310 to default via
2001:740:7063:30::10 dev eth3
post-up ip -6 route add table 410 to 2001:740:7063:40::/64 dev eth4
post-up ip -6 route add table 410 to default via
2001:740:7063:40::10 dev eth4
post-up ip -6 rule add from 2001:740:7063:10::/64 table 110
priority 110
post-up ip -6 rule add from 2001:740:7063:20::/64 table 210
priority 210
post-up ip -6 rule add from 2001:740:7063:30::/64 table 310
priority 310
post-up ip -6 rule add from 2001:740:7063:40::/64 table 410
priority 410
#post-up ip -6 route add default via 2001:740:7063:40::10 dev eth4
post-up ip -6 route flush cache
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth4/autoconf
pre-up echo 0 > /proc/sys/net/ipv6/conf/eth4/accept_ra
I have a need to get traffic that comes into one interface to go back from
the same interface, hence the rules using iproute2.
All works fine if I only set up the ivp4 interfaces. If I remove either
the 'iface eth4 inet6 static' or 'iface eth4 inet static' stanza,
everything works fine for the one that is not removed. With the above
configuration, after booting the machine, I have the following in iproute2:
root@ntp01:/# ip route show
10.0.20.0/22 dev eth4 proto kernel scope link src 10.0.20.240
10.0.16.0/22 dev eth3 proto kernel scope link src 10.0.16.240
10.0.4.0/22 dev eth1 proto kernel scope link src 10.0.4.240
10.0.0.0/22 dev eth2 proto kernel scope link src 10.0.0.240
default via 10.0.20.1 dev eth4
default via 10.0.16.1 dev eth3
default via 10.0.0.1 dev eth2
default via 10.0.4.1 dev eth1
root@ntp01:/# ip -6 route show
2001:740:7063:10::/64 dev eth1 proto kernel metric 256 mtu 1500 advmss
1440 hoplimit 4294967295
2001:740:7063:20::/64 dev eth2 proto kernel metric 256 mtu 1500 advmss
1440 hoplimit 4294967295
2001:740:7063:30::/64 dev eth3 proto kernel metric 256 mtu 1500 advmss
1440 hoplimit 4294967295
2001:740:7063:40::/64 dev eth4 proto kernel metric 256 mtu 1500 advmss
1440 hoplimit 4294967295
fe80::/64 dev eth1 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit
4294967295
fe80::/64 dev eth2 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit
4294967295
fe80::/64 dev eth3 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit
4294967295
fe80::/64 dev eth4 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit
4294967295
root@ntp01:/# ip rule show
0: from all lookup local
100: from 10.0.4.0/22 lookup 100
200: from 10.0.0.0/22 lookup 200
300: from 10.0.16.0/22 lookup 300
400: from 10.0.20.0/22 lookup 400
32766: from all lookup main
32767: from all lookup default
root@ntp01:/# ip -6 rule show
0: from all lookup local
32766: from all lookup main
root@ntp01:/# ip route show tab 100
10.0.4.0/22 dev eth1 scope link
default via 10.0.4.1 dev eth1
root@ntp01:/# ip route show tab 200
10.0.0.0/22 dev eth2 scope link
default via 10.0.0.1 dev eth2
root@ntp01:/# ip route show tab 300
10.0.16.0/22 dev eth3 scope link
default via 10.0.16.1 dev eth3
root@ntp01:/# ip route show tab 400
10.0.20.0/22 dev eth4 scope link
default via 10.0.20.1 dev eth4
root@ntp01:/# ip -6 route show tab 110
root@ntp01:/# ip -6 route show tab 210
root@ntp01:/# ip -6 route show tab 310
root@ntp01:/# ip -6 route show tab 410
Note that all the ipv6 iproute2 information is missing. If I reorder the
inet and inet6 stanzas for eth4, the opposite is true; the ipv6 interfaces
will have the rules and tables and the ipv4 interfaces will be missing the
rules and tables. If I manually run the commands in
/etc/network/interfaces, as shown here:
root@ntp01:/# ip -6 route add table 110 to 2001:740:7063:10::/64 dev eth1
root@ntp01:/# ip -6 route add table 110 to default via 2001:740:7063:10::10
dev eth1
root@ntp01:/# ip -6 route add table 210 to 2001:740:7063:20::/64 dev eth2
root@ntp01:/# ip -6 route add table 210 to default via 2001:740:7063:20::10
dev eth2
root@ntp01:/# ip -6 route add table 310 to 2001:740:7063:30::/64 dev eth3
root@ntp01:/# ip -6 route add table 310 to default via 2001:740:7063:30::10
dev eth3
root@ntp01:/# ip -6 route add table 410 to 2001:740:7063:40::/64 dev eth4
root@ntp01:/# ip -6 route add table 410 to default via 2001:740:7063:40::10
dev eth4
root@ntp01:/# ip -6 rule add from 2001:740:7063:10::/64 table 110 priority
110
root@ntp01:/# ip -6 rule add from 2001:740:7063:20::/64 table 210 priority
210
root@ntp01:/# ip -6 rule add from 2001:740:7063:30::/64 table 310 priority
310
root@ntp01:/# ip -6 rule add from 2001:740:7063:40::/64 table 410 priority
410
root@ntp01:/# ip -6 route add default via 2001:740:7063:40::10 dev eth4
root@ntp01:/# ip -6 route flush cache
Then the iproute2 rules and tables are properly defined:
root@ntp01:/# ip -6 route show
2001:740:7063:10::/64 dev eth1 proto kernel metric 256 mtu 1500 advmss
1440 hoplimit 4294967295
2001:740:7063:20::/64 dev eth2 proto kernel metric 256 mtu 1500 advmss
1440 hoplimit 4294967295
2001:740:7063:30::/64 dev eth3 proto kernel metric 256 mtu 1500 advmss
1440 hoplimit 4294967295
2001:740:7063:40::/64 dev eth4 proto kernel metric 256 mtu 1500 advmss
1440 hoplimit 4294967295
fe80::/64 dev eth1 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit
4294967295
fe80::/64 dev eth2 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit
4294967295
fe80::/64 dev eth3 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit
4294967295
fe80::/64 dev eth4 proto kernel metric 256 mtu 1500 advmss 1440 hoplimit
4294967295
default via 2001:740:7063:40::10 dev eth4 metric 1024 mtu 1500 advmss
1440 hoplimit 4294967295
root@ntp01:/# ip -6 rule show
0: from all lookup local
110: from 2001:740:7063:10::/64 lookup 110
210: from 2001:740:7063:20::/64 lookup 210
310: from 2001:740:7063:30::/64 lookup 310
410: from 2001:740:7063:40::/64 lookup 410
32766: from all lookup main
root@ntp01:/# ip -6 route show tab 110
2001:740:7063:10::/64 dev eth1 metric 1024 mtu 1500 advmss 1440 hoplimit
4294967295
default via 2001:740:7063:10::10 dev eth1 metric 1024 mtu 1500 advmss
1440 hoplimit 4294967295
root@ntp01:/# ip -6 route show tab 210
2001:740:7063:20::/64 dev eth2 metric 1024 mtu 1500 advmss 1440 hoplimit
4294967295
default via 2001:740:7063:20::10 dev eth2 metric 1024 mtu 1500 advmss
1440 hoplimit 4294967295
root@ntp01:/# ip -6 route show tab 310
2001:740:7063:30::/64 dev eth3 metric 1024 mtu 1500 advmss 1440 hoplimit
4294967295
default via 2001:740:7063:30::10 dev eth3 metric 1024 mtu 1500 advmss
1440 hoplimit 4294967295
root@ntp01:/# ip -6 route show tab 410
2001:740:7063:40::/64 dev eth4 metric 1024 mtu 1500 advmss 1440 hoplimit
4294967295
default via 2001:740:7063:40::10 dev eth4 metric 1024 mtu 1500 advmss
1440 hoplimit 4294967295
It is as if interfaces script is not being properly handled to configure
the interfaces; like it is not handling the post-up statements. There are
no errors logged in /var/log/messages, kern.log, syslog, dmesg, daemon.log,
etc.
Not sure where to start debugging this problem. Can someone point me in
the right direction? I am running the latest stable release
(2.6.32-5/squeeze). There is nothing much on this box. It was built using
debootstrap from the mirrors.
When the interfaces are configured, they look like this:
eth1 Link encap:Ethernet HWaddr 00:18:51:b9:d2:fd
inet addr:10.0.4.240 Bcast:10.0.7.255 Mask:255.255.252.0
inet6 addr: fe80::218:51ff:feb9:d2fd/64 Scope:Link
inet6 addr: 2001:740:7063:10::240/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:214 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:20372 (19.8 KiB) TX bytes:564 (564.0 B)
eth2 Link encap:Ethernet HWaddr 00:18:51:75:d6:59
inet addr:10.0.0.240 Bcast:10.0.3.255 Mask:255.255.252.0
inet6 addr: 2001:740:7063:20::240/64 Scope:Global
inet6 addr: fe80::218:51ff:fe75:d659/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:329 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:34134 (33.3 KiB) TX bytes:564 (564.0 B)
eth3 Link encap:Ethernet HWaddr 00:18:51:9b:19:ac
inet addr:10.0.16.240 Bcast:10.0.23.255 Mask:255.255.252.0
inet6 addr: fe80::218:51ff:fe9b:19ac/64 Scope:Link
inet6 addr: 2001:740:7063:30::240/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:256 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:28990 (28.3 KiB) TX bytes:564 (564.0 B)
eth4 Link encap:Ethernet HWaddr 00:18:51:20:93:71
inet addr:10.0.20.240 Bcast:10.0.23.255 Mask:255.255.252.0
inet6 addr: fe80::218:51ff:fe20:9371/64 Scope:Link
inet6 addr: 2001:740:7063:40::240/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:238 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:21866 (21.3 KiB) TX bytes:564 (564.0 B)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Is there an easier way to configure the interfaces to achieve what I am
trying to achieve? I have 4 interfaces, on 4 seperate networks, all
connected to the same router (1 hop away from each other). If I am on
vlan20 and I ssh to the interface on this machine from vlan10, I need the
packets to have a synchronous route between the hosts, else my ssh sessions
are broken. The rules above achieve that, but it seems overly complicated
to configure. I figure this would be the expected behavior and I'm hoping
I'm missing something obvious and easier.
Thanks,
Axton Grams