0

I try to connect LAN with my college network with static gateway router. My LAN is 192.168.0.0/24 and my college network is 10.42.11.0/24. But client (192.168.0.3) only ping router(10.42.11.243). It's interfaces in my router

auto lo

iface lo inet loopback

auto eth0

iface eth0 inet static

address 192.168.0.1

netmask 255.255.255.0

network 192.168.0.0

up route add -net 192.168.0.0/24 gw 192.168.0.1 dev eth0

auto eth1

iface eth1 inet static

address 10.42.11.243

netmask 255.255.255.0

network 10.42.11.0

gateway 10.42.11.1

dns-nameservers 172.16.30.7

and this interfaces in client

auto lo iface lo inet loopback

auto eth0

iface eth0 inet static

address 192.168.0.3

netmask 255.255.255.0

network 192.168.0.0

gateway 192.168.0.1

when I using traceroute from client :

traceroute to 10.42.11.1 (10.42.11.1), 30 hops max, 60 byte packets

1 192.168.0.1 (192.168.0.1) 0.248 ms 0.244 ms 0.235 ms

2 * * *

3 * * *

4 * * *

30 * * *

when I using route in router

Destination Gateway Genmask Flags Metric Ref Use Iface

default 10.42.11.1 0.0.0.0 UG 0 0 0 eth1

10.42.11.0 * 255.255.255.0 U 0 0 0 eth1

192.168.0.0 192.168.0.1 255.255.255.0 UG 0 0 0 eth0

192.168.0.0 * 255.255.255.0 U 0 0 0 eth0

192.168.1.0 * 255.255.255.0 U 0 0 0 br0

0

You must set on router traffic forwarding.

First allow fw on system with command

sudo sh -c “echo 1 /proc/sys/net/ipv4/ip forward’’

and do some iptables fw rules

sudo iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
sudo iptables -A FORWARD -i eth1 -o eth0 -m state -–state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT

Edit 1

iptables -A FORWARD -i eth0 -o eth1 -j ACCEPT 
iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT 
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

and not forget

sudo sh -c “echo 1 /proc/sys/net/ipv4/ip forward’’
|improve this answer|||||
  • when I try "sudo iptables -A FORWARD -i eth1 -o eth0 -m state -–state RELATED,ESTABLISHED -j ACCEPT", then "iptables v1.4.21: unknown option "state" Try `iptables -h' or 'iptables --help' for more information.", and client stil can't connect, How I fix it's ? – rizka Mar 31 '15 at 9:01
  • have new rules in Edit 1 – 2707974 Mar 31 '15 at 9:12
  • stil can't connect – rizka Mar 31 '15 at 9:28
  • You can ping 10.42.11.243 but can not ping 10.42.11.1? – 2707974 Mar 31 '15 at 9:34
  • yes.. client can ping 10.42.11.243 but can't ping 10.42.11.1 – rizka Mar 31 '15 at 9:41

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.