You usually needs to enable ipv4 routing on the machine.
You can do this by issuing the following command:
sysctl -w net.ipv4.ip_forward=1
Or:
echo 1 > /proc/sys/net/ipv4/ip_forward
Frage
I have the following topology:
VM A VM C
192.168.56.102 192.168.57.102
| |
| |
(eth0) 192.168.56.103 --[ VM B ] -- 192.168.57.101 (eth1)
I'm trying to make B act as a router between the two networks. In trying to send a datagram from A to C, I can see the packet on the 192.168.56.103 side (using tcpdump), but I don't see the packet going outbound on the 192.168.57.101 side.
I have verified that the datagram's destination address is 192.168.57.102, and the forwarding table in B looks like:
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.56.0 * 255.255.255.0 U 1 0 0 eth0
192.168.57.0 * 255.255.255.0 U 1 0 0 eth1
I've tried adding this forwarding rule as well:
route add -net 192.168.57.0 netmask 255.255.255.0 gw 192.168.57.102 dev eth1
Which yields this routing table:
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.56.0 * 255.255.255.0 U 1 0 0 eth0
192.168.57.0 C.local 255.255.255.0 UG 0 0 0 eth1
192.168.57.0 * 255.255.255.0 U 1 0 0 eth1
I'm pretty sure this rule is just redundant, and I don't get any better results with it.
If it helps, here is the ARP table from B:
C.local (192.168.57.102) at 08:00:27:12:6b:c9 [ether] PERM on eth1
A.local (192.168.56.102) at 08:00:27:0a:86:a2 [ether] PERM on eth0
Is there a step I'm missing that can connect these two networks? Thanks for any help!
Lösung
You usually needs to enable ipv4 routing on the machine.
You can do this by issuing the following command:
sysctl -w net.ipv4.ip_forward=1
Or:
echo 1 > /proc/sys/net/ipv4/ip_forward