1

I try to route packets between two interfaces of a virtual Ubuntu 16.04 machine hosted in OpenStack. Following what I found on Internet, here is what I did:

# Enable ip forwarding:
sysctl -w net.ipv4.ip_forward=1
echo 'net.ipv4.ip_forward = 1' >> net.ipv4.ip_forward = 1
sysctl -p /etc/sysctl.conf

# Update IP tables:
iptables -A FORWARD -i ens3 -o ens4 -j ACCEPT
iptables -A FORWARD -i ens4 -o ens3 -j ACCEPT

Now, here is my Linux router interfaces and routing table:

ens3: 192.168.217.6/24
ens4: 10.0.0.13/24

ip route
default via 10.0.0.1 dev ens4
10.0.0.0/26 dev ens4 proto kernel scope link src 10.0.0.13
169.254.169.254 via 10.0.0.1 dev ens4
192.168.217.0/24 dev ens3 proto kernel scope link src 192.168.217.6

I have a machine on LAN 10.0.0.0/24, and one on LAN 192.168.217.0/24. Both have my Linux router as their default gateway, but they can't ping each other. However, machine on LAN 10.0.0.0/24 has Internet access:

traceroute 1.1.1.1
10.0.0.1
...
1.1.1.1

ip route
default via 10.0.0.13 dev eth0
10.0.0.0/24 dev eth0 10.0.0.14

This is strange, as the traceoute do not use 10.0.0.13, which is the default gateway of my host.

What am I doing wrong ? Thank you.

Nakrule
  • 246
  • Add the ip route output of the "machine on LAN 10.0.0.0/24" to the question. – wurtel Jun 22 '18 at 10:05
  • @wurtel Updated. – Nakrule Jun 22 '18 at 10:35
  • You have a few mistakes in the first part ("# Enable ip forwarding"), so please make sure you have this really set with sysctl -a|grep net.ipv4.ip_forward – pawel7318 Jun 22 '18 at 11:57
  • @pawel7318 cat /proc/sys/net/ipv4/ip_forwarding return 1. – Nakrule Jun 22 '18 at 12:16
  • If on 10.0.0.14 you have 10.0.0.13 as default gateway, but 10.0.0.13 has 10.0.0.1 as default gateway, then 10.0.0.13 will send an ICMP REDIRECT back to 10.0.0.14 so that 10.0.0.13 doesn't have to waste time retransmitting a packet on the same network where it came from. That explains the traceroute not showing 10.0.0.13. However it doesn't explain why you can't ping between the networks. – wurtel Jun 22 '18 at 13:05

0 Answers0