LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   help to join 2 network ID PCs in single LAN (https://www.linuxquestions.org/questions/linux-networking-3/help-to-join-2-network-id-pcs-in-single-lan-247774/)

cranium2004 10-27-2004 01:18 AM

help to join 2 network ID PCs in single LAN
 
i am having a LAN which is connected to main proxy server ip 10.0.0.xxx through switch. In that LAN if i isolate a PC with single network with single PC with ip 192.168.1.192 and attach it to another computer which have 2 LAN cards in that LAN,eth0 is 10.0.0.199 and eth1 is 192.168.1.1 then can i access internet through that computer with ip 192.168.1.192?

n3tw0rk 10-27-2004 02:29 AM

Yes you can access the Internet on 192.168.1.192 by setting up Network Address Translation (NAT) on the multi-homed system (eth0:10.0.0.199, eth1:192.168.1.1). For help on how to do this visit http://en.tldp.org/HOWTO/IP-Masquerade-HOWTO/ . You can also setup a proxy server on the multihomed system but i think setting up NAT is a better choice as only one machine (192.168.1.192) from the 192.168.1.0 network requires access to the Internet.

shy 10-27-2004 02:58 AM

Re: help to join 2 network ID PCs in single LAN
 
Quote:

Originally posted by cranium2004
i am having a LAN which is connected to main proxy server ip 10.0.0.xxx through switch. In that LAN if i isolate a PC with single network with single PC with ip 192.168.1.192 and attach it to another computer which have 2 LAN cards in that LAN,eth0 is 10.0.0.199 and eth1 is 192.168.1.1 then can i access internet through that computer with ip 192.168.1.192?
You should add the following rules to PC1's iptables:

-t nat -A POSTROUTING -s 192.168.1.192 -o eth0 -j SNAT --to-source 10.0.0.199
-t filter -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
-t fileter -A FORWARD -i eth1 -o eth0 -j ACCEPT

don't forget to run
echo 1 > /proc/sys/net/ipv4/ip_forward

I hope I didn't forget anything...

Hope this helps.


All times are GMT -5. The time now is 08:23 AM.