You are not logged in.
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
hmm different subnets
Offline
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?
hmm different subnets
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
@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
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.
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline