LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   linux router (https://www.linuxquestions.org/questions/linux-networking-3/linux-router-899974/)

famsinyi 08-28-2011 11:52 PM

linux router
 
I have three pcs. They are referred as:

pcA:
NIC 192.168.1.2,
subnet mask: 255.255.255.0
default gateway 192.168.1.1

pcB:
NIC 192.168.2.2,
subnet mask: 255.255.255.0
default gateway 192.168.2.1

pcRouter: two NICs:
eth0 192.168.1.1, subnet mask: 255.255.255.0
eth1 192.168.2.1, subnet mask: 255.255.255.0
this command is executed:
echo 1 > /proc/sys/net/ipv4/ip_forward

when I ping from pcA:
ping 192.168.2.2

ping returned:
From 192.168.1.1 icmp_seq=1 destination Host Prohibited

rodrifra 08-29-2011 01:35 AM

Have you set your IP tables rules to route the packets?

allwimb 08-29-2011 05:33 AM

one of the easiest way to do it is NAT:
iptables -t nat -A POSTROUTING -i eth0 -o eth1 -j MASQUERADE
iptables -t nat -A POSTROUTING -i eth1 -o eth0 -j MASQUERADE

that should work correctely

spring logout


All times are GMT -5. The time now is 12:31 AM.