Wednesday, June 27, 2007

Linux: Internet Sharing

12/06/07- Unable to share the internet connection between fedora and Windows xp systems
1. Unable to connect from windows xp laptop to internet through fedora desktop system. The gateway for windows xp was set rightly it was That is the ip address of fedora system.
problem solved on 12/06/07
1. I did the following changes:
i went to /etc/sysconfig/network-scripts/ifcfg-eth0
it was something like:
# Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+
I added one line there to form a LAN
It enabled fedora system to listen to all the systems in LAN.
2. I went to /etc/rc.d/rc.local
and added the following lines in the file
/sbin/iptables --flush
/sbin/iptables --table nat --flush
/sbin/iptables --delete-chain
/sbin/iptables --table nat --delete-chain
/sbin/iptables --table nat --append POSTROUTING --out-interface ppp0 -j MASQUERADE
/sbin/iptables --append FORWARD --in-interface eth0 -j ACCEPT
echo 1 > /proc/sys/net/ipv4/ip_forward
3. I opened windows system and changes the DNS Server address to those of my ISP TATA VSNL. Of course i didnt change the gateway address.
and its done my dear friend.
I'm very happy to solve this problem because the way i used to form a LAN i didnt found that help on net. there was a command /sbin/ifconfig eth0 netmask broadcast but you have to run it every time you boot or add it in /etc/rc.d/rc.local file. But i chose my own alternate option.
Second thing was we have to run the iptables command manually every time system boots. so i added them in /etc/rc.d/rc.local file. And it was also not easy u have to find the absolute path for the iptables command. Luckily fedora has all its commands in /sbin directory. So I finally set it up. And god I spent my six hours on it. Trying and failing trying and failing. But in last I succeeded.

No comments: