You are not logged in.

#1 2010-12-14 00:38:48

hexanol
Member
From: Canaduh
Registered: 2009-08-04
Posts: 95

Routing local traffic over the wire

Hello,

Here's the scenario:

* one machine with 2 NIC, eth0 and eth1
* eth0 has IP address 192.168.5.1/24
* eth1 has IP address 192.168.6.1/24
* both are connected to the same switch

Now, if you try pinging 192.168.6.1 from the local machine, even if you pass the '-I 192.168.5.1' option, there's nothing that will ever go on the wire. Indeed, if you check the output of the 'local' routing table with 'ip route list table local', you see that the kernel will route the packet in a way that it will never reach a NIC.

I'm wondering, how can I modify the routing table/rule policy so that packets are transmitted on the wire in these situations ?

Note that this is just for testing purpose, where I would like to have some traffic go on the wire from one interface and then come back to another interface, both interfaces being on the same machine.

Thanks

Offline

#2 2010-12-14 00:47:48

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,543

Re: Routing local traffic over the wire

hmm different subnets

Offline

#3 2010-12-14 00:59:37

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: Routing local traffic over the wire

I don't think there is a way to do what you're after. The kernel will take the shortest path, which is directly to itself. What are you trying to test?

skunktrader wrote:

hmm different subnets

https://wiki.archlinux.org/index.php/Fo … mpty_Posts

Offline

#4 2010-12-14 01:23:03

hexanol
Member
From: Canaduh
Registered: 2009-08-04
Posts: 95

Re: Routing local traffic over the wire

@skunktrader this was an example, the IP addresses could be on the same subnet, but I don't think this would change anything.

Basically, I'm trying to test the good working of an internal switch of an IP phone. This involves the handling of 802.1q frames. The problem is, I only have one computer to do the tests, and only one network card on this computer. That said, I have a switch with VLAN support.

The easier and more interesting solution would be to have 2 computers, but this is not possible right now. I've been able to make some traffic go over the wire by broadcasting packets at the link layer level, but this involve using tcpdump to see if the packets are actually making their way around, and it's quite inconvenient.

Offline

#5 2010-12-14 03:46:56

fukawi2
Ex-Administratorino
From: .vic.au
Registered: 2007-09-28
Posts: 6,224
Website

Re: Routing local traffic over the wire

Regardless of VLAN's and number of NIC's, you only have 1 running kernel, and as soon as the kernel sees a unicast packet for one of it's own addresses, it will send it directly through the loopback interface rather than out on to the wire to the switch. The broadcast packets going on to the wire make sense, since the kernel can't categorically state that it is the (only) recipient of the packet.

My suggestion would be to use a Virtual Machine in Virtual Box / qemu etc. That way you can "have" 2 computers on the one physical. With the right network config/bridging/subnetting you should be able to make the traffic to/from the VM go over the wire.

Offline

Board footer

Powered by FluxBB