TEQL and Subnet problem
I have a network topology shown below, and I am trying to use TEQL. P1,
P2 and P3 are three linux machines, and each has two network cards. P2
and P3 are connected in two ways: (1) directed connection between
P2.eth0 and P3.eth0; (2) connection via P1. P1 acts as the gateway. TEQL
is installed on P2 and P3 to load-balance packet transmission by
round-robin sending packets to eth0 and eth1. I defined P2.teql0,
P2.eth1, P1.eth0 as 16.119.144.32/30 subnet, and defined P3.teql0,
P3.eth1, P1.eth1 as 16.119.144.64/30 subnet.
My problem is: When I ping to P3.teql0 from P2 ("[P2]# ping
16.119.144.66"), the traffic can never go from P2.eth1, and all traffic
only goes to P1.eth0. What P2.eth1 (16.119.144.33) did is broadcasting
an ARP asking for the MAC address of 16.119.144.66, although I have
specified the route to 16.119.144.64/30 is through gateway
16.119.144.32, as shown below. Similarly, when I use ttcp ("ttcp -t -s
-n -T -v 200 16.119.144.66"), traffic can never go through P2.eth1. On
the other hand, if I "ping -I eth1 16.119.144.66", the ping can go
through P2.eth1, P1.eth0, P1.eth1, and to P3.teql0 with no problem.
What''s wrong and how to fix it? In addition, how to ensure traffic of
"ping 16.119.144.66" will go from P2.teql0 instead of P2.eth0 or
P2.eth1? By routing table as I have done below? Configuration details
(ifconfig, route) are shown below.
1. Topology
teql0 144.34
_
_
|_|------- eth0: 144.21 eth0: 144.27 ------|_|
teql0: 144.66
| P2 |------------------------------------------------------| P3
|
|____|
|____|
eth1: | |
eth1:
144.33 | |
144.65
|
|
|_______________|------|________________|
eth0: 144.32 | P1 | eth1: 144.64
|___ |
Machines, network interfaces and their IPs:
P1:
- eth0: 16.119.144.32
- eth1: 16.119.144.64
P2:
- eth0: 16.119.144.21
- eth1: 16.119.144.33
- teql0: 16.119.144.34
P3:
- eth0: 16.119.144.27
- eth1: 16.119.144.65
- teql0: 16.119.144.66
2.IP configuration
(1) P1:
[root@princeton1 root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:E0:81:00:5F:FC
inet addr:16.119.144.32 Bcast:16.119.145.255
Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:428 errors:0 dropped:0 overruns:0 frame:0
TX packets:439 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:36966 (36.0 Kb) TX bytes:36526 (35.6 Kb)
Interrupt:11
eth1 Link encap:Ethernet HWaddr 00:10:B5:48:1A:54
inet addr:16.119.144.64 Bcast:16.119.145.255
Mask:255.255.254.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:399 errors:0 dropped:0 overruns:0 frame:0
TX packets:371 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:34174 (33.3 Kb) TX bytes:33739 (32.9 Kb)
Interrupt:5 Base address:0x7800
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:81 errors:0 dropped:0 overruns:0 frame:0
TX packets:81 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7094 (6.9 Kb) TX bytes:7094 (6.9 Kb)
(2) P2:
[root@princeton2 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:12:79:94:10:AF
inet addr:16.119.144.21 Bcast:16.119.145.255
Mask:255.255.254.0
inet6 addr: fe80::212:79ff:fe94:10af/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1035 errors:0 dropped:0 overruns:0 frame:0
TX packets:1569 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:89851 (87.7 KiB) TX bytes:1756828 (1.6 MiB)
Interrupt:201
eth1 Link encap:Ethernet HWaddr 00:12:79:94:10:AE
inet addr:16.119.144.33 Bcast:16.119.145.255
Mask:255.255.254.0
inet6 addr: fe80::212:79ff:fe94:10ae/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:200 errors:0 dropped:0 overruns:0 frame:0
TX packets:165 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:15954 (15.5 KiB) TX bytes:13792 (13.4 KiB)
Interrupt:209
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:5253 errors:0 dropped:0 overruns:0 frame:0
TX packets:5253 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:7687091 (7.3 MiB) TX bytes:7687091 (7.3 MiB)
teql0 Link encap:UNSPEC HWaddr
FA-FE-3B-C3-BA-00-F4-EF-00-00-00-00-00-00-00-00
inet addr:16.119.144.34 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:1272 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:1706684 (1.6 MiB)
(3) P3:
[root@princeton3 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:12:79:3C:6F:2D
inet addr:16.119.144.27 Bcast:16.119.145.255
Mask:255.255.254.0
inet6 addr: fe80::212:79ff:fe3c:6f2d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1558 errors:0 dropped:0 overruns:0 frame:0
TX packets:1074 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1757749 (1.6 MiB) TX bytes:80452 (78.5 KiB)
Interrupt:201
eth1 Link encap:Ethernet HWaddr 00:12:79:3C:6F:2C
inet addr:16.119.144.65 Bcast:16.119.145.255
Mask:255.255.254.0
inet6 addr: fe80::212:79ff:fe3c:6f2c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:223 errors:0 dropped:0 overruns:0 frame:0
TX packets:316 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23057 (22.5 KiB) TX bytes:28712 (28.0 KiB)
Interrupt:209
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:2784 errors:0 dropped:0 overruns:0 frame:0
TX packets:2784 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:3473742 (3.3 MiB) TX bytes:3473742 (3.3 MiB)
teql0 Link encap:UNSPEC HWaddr
EB-FE-3B-B3-5B-00-F4-DF-00-00-00-00-00-00-00-00
inet addr:16.119.144.66 Bcast:0.0.0.0 Mask:255.255.255.255
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:690 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 b) TX bytes:38556 (37.6 KiB)
3.Routing Tables
(1) P1:
[root@princeton1 root]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
16.119.144.64 0.0.0.0 255.255.255.252 U 0 0 0
eth1
16.119.144.32 0.0.0.0 255.255.255.252 U 0 0 0
eth0
16.119.144.0 0.0.0.0 255.255.254.0 U 0 0
0 eth1
16.119.144.0 0.0.0.0 255.255.254.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 16.119.144.1 0.0.0.0 UG 0 0
0 eth0
(2) P2:
[root@princeton2 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref
Use Iface
16.119.144.66 0.0.0.0 255.255.255.255 UH 0 0
0 teql0
16.119.144.32 0.0.0.0 255.255.255.255 UH 0 0
0 eth1
16.119.144.64 16.119.144.32 255.255.255.252 UG 0 0 0
eth1
16.119.144.0 0.0.0.0 255.255.254.0 U 0 0
0 eth0
16.119.144.0 0.0.0.0 255.255.254.0 U 0 0
0 eth1
0.0.0.0 16.119.144.1 0.0.0.0 UG 0
0 0 eth0
(3) P3:
[root@princeton3 ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric
Ref Use Iface
16.119.144.64 0.0.0.0 255.255.255.255 UH 0
0 0 eth1
16.119.144.34 0.0.0.0 255.255.255.255 UH 0
0 0 teql0
16.119.144.32 16.119.144.64 255.255.255.252 UG 0 0
0 eth1
16.119.144.0 0.0.0.0 255.255.254.0 U 0
0 0 eth0
16.119.144.0 0.0.0.0 255.255.254.0 U 0
0 0 eth1
169.254.0.0 0.0.0.0 255.255.0.0 U 0
0 0 eth1
0.0.0.0 16.119.144.1 0.0.0.0 UG 0
0 0 eth0
4. Enable IP Forwarding on P1
IP forwarding needs only to be enabled on P1. This part should be OK.
(1) In /etc/sysconfig/network, add "FORWARD_IPV4=yes"
(2) "echo 1 > /proc/sys/net/ipv4/ip_forward". The default value in
Linux
is 0.
(3) To enable IP forwarding automatically after reboot, change
"net.ipv4.ip_forward=1" in /etc/sysctl.conf.
(4) Dislab packet filtering:
"echo 0 > /proc/sys/net/ipv4/conf/eth0/rp_filter"
"echo 0 > /proc/sys/net/ipv4/conf/eth1/rp_filter"