LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Iptables send back to client unadequate route (https://www.linuxquestions.org/questions/linux-networking-3/iptables-send-back-to-client-unadequate-route-4175551666/)

COZSMIN 08-25-2015 04:49 AM

Iptables send back to client unadequate route
 
Hello

this is my setup


internet <---- company-gateway <-- iptables-gw <--clients wanting to connect

In this setup the company gateway only allows a few IPs to connect , if i virtualise a machine it must go thru my ip , and it must have an IP from the company network so no nat or other stuff

Iptables rules :

NAT:
-I POSTROUTING -j SNAT -o eth0 --to-destination $eth0_ip
FILTER:
-I FORWARD -j ACCEPT

sysct :
net.ipv4.ip_forward = 1
net.ipv4.conf.all.forwarding = 1
net.ipv4.conf.default.forwarding = 1
net.ipv4.conf.eth0.forwarding = 1

Now the client has default route my $eth0_ip ,
but at ping i get :

( NOTE $eth0_ip is the IP of my linux that acts as second gateway )

root@vm_1:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
From $eth0_ip: icmp_seq=1 Redirect Network(New nexthop: $company_gateway )
From $company_gateway icmp_seq=1 Destination Host Prohibited
From $eth0_ip: icmp_seq=2 Redirect Network(New nexthop: $comp_gw)
From $cmp_gw : icmp_seq=2 Destination Host Prohibited

So the kernel is redirecting the packets to $company_gw , instead i want it to forward the packets ( don't send another "better" gateway ) , i just don't need it to think for me , i do it instead and i know what route to take

COZSMIN 08-25-2015 05:23 AM

SOLVED

if anyone cares i forgot to load the settings , so *nat rules were off. BEST EVERYONE


All times are GMT -5. The time now is 02:41 PM.