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
1 Answer
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 ACCEPTEdit 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 MASQUERADEand not forget
sudo sh -c “echo 1 /proc/sys/net/ipv4/ip forward’’ 10