0

Can't figure this one out. I have 3 hosts.

HostA: eth0: 10.10.80.5
HostB: eth0: 10.10.80.4, tun0:10.9.0.1
HostC: tun0: 10.9.0.74

I'm trying to reach port 7000 on HostC, from HostA. HostB becomes the routing problem. So far...:

HostA ---> HostB = OK

HostB ---> HostC = OK

HostC ---> HostB = OK

HostC ---> HostA = OK

HostA ---> HostC = Nothing

I've enabled ipv4 forwarding on HostB with sysctl net.ipv4.ip_forward. I'm using iptables for this. Here are my current rules: Note: LANIF=eth0, WANIF=tun0

HostB:

$IPTABLES -t nat -A POSTROUTING -o $LANIF -j MASQUERADE
$IPTABLES -A FORWARD -i $LANIF -o $WANIF -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -A FORWARD -i $WANIF -o $LANIF -j ACCEPT

$IPTABLES -t nat -A POSTROUTING -o $WANIF -j MASQUERADE
$IPTABLES -A FORWARD -i $WANIF -o $LANIF -m state --state RELATED,ESTABLISHED -j ACCEPT
$IPTABLES -A FORWARD -i $LANIF -o $WANIF -j ACCEPT

HostA:

Route Table:
10.9.0.74       10.10.80.4      255.255.255.255 UGH   0      0        0 eth0

I have enabled logging on HostB to see the traffic and everything is routing correctly except for when I try to initiate a connection from HostA ---> HostC. It looks like it is not translating the between the two interfaces.

Thanks

0

You will need to enable ipv4 forwarding (routing) in the OS. Check the status of forwarding:

sysctl net.ipv4.ip_forward

if it says net.ipv4.ip_forward = 0 then edit /etc/sysctl.conf

change:

net.ipv4.ip_forward = 0

to read

net.ipv4.ip_forward = 1

  • sorry, its a bit hidden in the details (edited) but this is configured already – pm1391 Apr 5 '18 at 21:06
  • Okay. I was going off of the statement that you are using IPTables for this. – JohnA Apr 5 '18 at 21:11
  • Do you have a rule that is accepting dport 7000? If not, it won't hit on your established,related state. – JohnA Apr 5 '18 at 21:19
  • Yes, HostB accepts connections from HostA on port 7000 as well. This is done in azure, so I'm thinking its something with their pre-configured routing tables – pm1391 Apr 5 '18 at 21:26
0

I have confirmed that it was a Azure routing issue. Although many won't have the same problems, I added a default route and a next hop in order to forward traffic out the correct interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.