LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-04-2009, 01:22 PM   #1
PurpleRain
LQ Newbie
 
Registered: Mar 2009
Posts: 2

Rep: Reputation: 0
Question Generate Traffic with only one machine - what's wrong with my routing solution?


I'm trying to generate Ip-traffic for testing purproses. As we now are testing multipoint performance of PLC networks I need some 4 to 8 endpoints to communicate but I can't afford to set up a dedicated linux box for each endpoint.
After looking into kernel routing I found that the routing of packets can also depend of the incoming device. So basically I tried to set up a routing which send out any packet generated on this host to an external interface even if the IP address is assigned to interface attached on this host.
Here is my solution:
Code:
clapham:~# ip addr show
4: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:8b:b2:47:fb brd ff:ff:ff:ff:ff:ff
    inet 10.0.1.1/24 brd 10.0.1.255 scope global eth1
    inet6 fe80::250:8bff:feb2:47fb/64 scope link
       valid_lft forever preferred_lft forever
5: eth2: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:8b:b2:47:fc brd ff:ff:ff:ff:ff:ff
    inet 10.0.1.11/24 brd 10.0.1.255 scope global eth2
    inet6 fe80::250:8bff:feb2:47fc/64 scope link
       valid_lft forever preferred_lft forever
I will try to run traffic from eth1 to eth2. Here is my batch file to modify the routing:
Code:
clapham:~# cat setnetix
# add routing policy if packet generated on host
ip rule add to 10.0.1.0/24 iif lo table ixchariot
# if all packets generated on host are sent out on the other interface
ip route add 10.0.1.11 table ixchariot dev eth1 src 10.0.1.1 proto ixchariot
ip route add 10.0.1.1 table ixchariot dev eth2 src 10.0.1.11 proto ixchariot
# routes in table local are always processed  - delete the routes
# making local delivery of the packets with the interface ip address
ip route del local 10.0.1.1 table local
ip route del local 10.0.1.11 table local
# add local delivery route for the packets coming from outside
# basically it's moving the routes deleted above from table local to table main
ip route add local 10.0.1.1 dev eth1 proto kernel table main
ip route add local 10.0.1.11 dev eth2 proto kernel table main
I have added the table "ixchariot" into \etc\iproute2\rt_tables with the ID 7 and the protocol "ixchariot" into \etc\iproute2\rt_protos with the ID 77.
My routing policy seems O.K.:
Code:
clapham:~# ip rule show
0:      from all lookup local
32765:  from all to 10.0.1.0/24 iif lo lookup ixchariot
32766:  from all lookup main
32767:  from all lookup default
The main table seems O.K.:
Code:
clapham:~# ip route show table main
local 10.0.1.11 dev eth2  proto kernel  scope host
local 10.0.1.1 dev eth1  proto kernel  scope host
192.168.178.0/24 dev eth0  proto kernel  scope link  src 192.168.178.98
10.0.1.0/24 dev eth1  proto kernel  scope link  src 10.0.1.1
10.0.1.0/24 dev eth2  proto kernel  scope link  src 10.0.1.11
default via 192.168.178.254 dev eth0
But it does't work:
Code:
clapham:~# ping 10.0.1.1
connect: Invalid argument
clapham:~# ping 10.0.1.11
connect: Invalid argument
clapham:~# ping 192.168.178.98
PING 192.168.178.98 (192.168.178.98) 56(84) bytes of data.
64 bytes from 192.168.178.98: icmp_seq=1 ttl=64 time=0.132 ms
64 bytes from 192.168.178.98: icmp_seq=2 ttl=64 time=0.047 ms
Any ideas how to pinpoint the problem?
 
Old 05-05-2009, 03:00 AM   #2
PurpleRain
LQ Newbie
 
Registered: Mar 2009
Posts: 2

Original Poster
Rep: Reputation: 0
Unhappy A hint -

the "connect: Invalid argument" message is somewhat disturbing. It seems like an sytax error in the routing tables. But everything is O.K. until I delete the routes in the local table. So the first part af the changes:
Code:
ip rule add to 10.0.1.0/24 iif lo table ixchariot
ip route add 10.0.1.11 table ixchariot dev eth1 src 10.0.1.1 proto ixchariot
ip route add 10.0.1.1 table ixchariot dev eth2 src 10.0.1.11 proto ixchariot
ip route add local 10.0.1.1 dev eth1 proto ixchariot scope host src 10.0.1.1 table main
ip route add local 10.0.1.11 dev eth2 proto ixchariot scope host src 10.0.1.11 table main
has no effect on the routing of packets to 10.0.1.1 as the route in the local table are processed first. I delete the one route in the local table:
Code:
ip route del local 10.0.1.1 table local
pinging 10.0.1.1 is now partly successful:
Code:
clapham:~# ping 10.0.1.1
PING 10.0.1.1 (10.0.1.1) 56(84) bytes of data.
From 10.0.1.11 icmp_seq=1 Destination Host Unreachable
From 10.0.1.11 icmp_seq=2 Destination Host Unreachable
the packets are sent out on the other interface eth2 as the "From 10.0.1.11" tells - just as intended. Both interfaces are connected to the same switch. But the packet is not recognized as local entering eth1.
If I delete the other route in the local table I get the strange error message again:
Code:
clapham:~# ip route del local 10.0.1.11 table local
clapham:~# ping 10.0.1.1
connect: Invalid argument
clapham:~# ping 10.0.1.11
connect: Invalid argument
it seems that the following lines in table main:
Code:
local 10.0.1.11 dev eth2  proto ixchariot  scope host  src 10.0.1.11
local 10.0.1.1 dev eth1  proto ixchariot  scope host  src 10.0.1.1
have not the same effect as the deleted lines from table local:
Code:
local 10.0.1.11 dev eth2  proto kernel  scope host  src 10.0.1.11
local 10.0.1.1 dev eth1  proto kernel  scope host  src 10.0.1.1
Any hints?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to generate the Sudoku puzzle from solved solution? pumpkin Programming 8 03-01-2009 05:23 AM
Tools to generate SIP Traffic pm010537 Linux - Newbie 2 03-23-2007 01:35 PM
generate large amount of traffic data Mr_C Linux - Networking 3 03-09-2006 11:38 PM
want to generate the most LEGAL bittorrent traffic possible hedpe General 2 03-02-2006 09:21 PM
Wireless traffic stomps isdn traffic on gateway machine Radix999 Linux - Wireless Networking 0 11-14-2003 12:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration