April 26, 2024, 12:31:06 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: eth0 problem when trying to share internet with dialup modem  (Read 5609 times)

Offline hitesh

  • Linux Noob !
  • *
  • Posts: 11
eth0 problem when trying to share internet with dialup modem
« on: November 29, 2004, 07:00:43 PM »
Hi ricky,

This is Hitesh. This is my first post this forum. I have read your artical with following link and try to share internet. http://www.linuxsolved.com/forums/ftopic115.html

My home network setup:

On RHEL 3:
eth0
ip: 192.168.100.20
netmask:255.255.255.0

This is eth0 details on Linux BOX.

# Realtek|RTL-8029(AS)
DEVICE=eth0
onBOOT=yes
BOOTPROTO=static
IPADDR=192.168.100.20
NETMASK=255.255.255.0
GATEWAY=192.168.100.254
HWADDR=00:80:AD:89:E98

On Windowxp:
eth0
ip: 192.168.100.10
netmask:255.255.255.0
gateway: 192.168.100.20 [RHEL box ip address]

DNS: 203.94.227.70 [auto getting on linux box]

Every thing i have done what ever you have given under above link. BUT

1) If i up the eth0 and try to ping to 192.168.100.10 [windows pc] , i can ping to that PC. BUT at the same if I try to surf the internet, browser status showing it "looking for the www.yahoo.com" , i can NOT able to surf the net.

2) In BWT if I down eth0 using ifdown eth0 , still i can NOT surf net. So i have to reconnect the dial up modem. then ONLY i can surf the net.

Question:

1) how can i share inernet with windowXP PC? As soon as i up eth0 very next time i can NOT able to share the net.

2) is there any thing wrong with eth0? as i have connect two PC with HUB. what else i have to do to share the net.

Please help me...

Thank you,
Hitesh

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
eth0 problem when trying to share internet with dialup modem
« Reply #1 on: November 30, 2004, 05:29:10 PM »
Are you sure your NAT script is being executed properly ? Also Your problem is of DNS, try to use other DNS server in XP box. You can use MTNL's name server to give try. Here are they !
202.134.192.10
202.134.192.11
202.54.15.30

You have specifid gateway as 192.168.100.254 in etho in RHEL. Using gui  left it blank.

Else is fine !

Offline hitesh

  • Linux Noob !
  • *
  • Posts: 11
eth0 problem when trying to share internet with dialup modem
« Reply #2 on: December 01, 2004, 05:47:19 PM »
Thank you! for the reply Ricky,

I have resloved this problem with commented GATEWAY=xxx.xxx.xxx.xx option under /etc/sysconfig/network-script/ifcfg-eth0 file.

Now eth0 is up and i can ping to windows PC. but still NET sharing not working when i try to access from windows PC. YES, I have given Linux BOX Ip address as gateway in IE and set the porxy server.

what else i have to do the share the net with other PC.

By the way could you tell me HOW DID YOU KNOW THAT IT'S MTNL's NAME SERVER? I am interested to know about this.....

Please help me...

 -/Hitesh

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
eth0 problem when trying to share internet with dialup modem
« Reply #3 on: December 02, 2004, 05:13:51 PM »
Quote from: "hitesh"
PC. YES, I have given Linux BOX Ip address as gateway in IE and set the porxy server.

what else i have to do the share the net with other PC.

By the way could you tell me HOW DID YOU KNOW THAT IT'S MTNL's NAME SERVER? I am interested to know about this.....

Please help me...

 -/Hitesh

You are still doing wrong.. just leave the gateway option blank in Redhat for eth0 , you can do that yby redhat-config-network

And why you are using PROXY in IE setting ? hmm. have installed proxy server also on RH ?
BTW.. if you are doing simple NAT then you have to only set up the gateway as IP of the server machine (Linux Box) in the client machine and you can access NAT on client, no need to set IE to use proxy.

Those are BSNL name servers.
to find those just connect using bsnl and see /etc/resolv.conf

that way what ever connection u are using , u can find thier nameserver.

Offline hitesh

  • Linux Noob !
  • *
  • Posts: 11
eth0 problem when trying to share internet with dialup modem
« Reply #4 on: December 09, 2004, 03:59:58 AM »
Sorry Ricky, but i do not know why i can not do the simple thing. same on me..

see i have try again, here it what i have done...

First on redhat box:

assign ip add: 192.168.100.20 [on eth0]
Gateway: Blank [as you suggest]

check below:

# Realtek|RTL-8029(AS)
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.100.20
NETMASK=255.255.255.0
GATEWAY=
HWADDR=00:80:AD:89:E9:D8

I have save rc.nat file under /etc/rc.d/ip.nat

and also make executable with chmod 755 and also mention line under /etc/rc.d/rc.local

Now on Widnows Pc.

open TCP/IP propertices:

ipaddress: 192.168.100.10
subnet mask:255.255.255.0
default gateway: 192.168.100.20 [redhat box ipaddress]

Preferred DNS server: 203.94.227.70 [from rehat box which i am getting through MTNL when connecing suing modem]
Aleternate DNS server: 203.94.243.70

I have not setup anything under IE proxy and try.. then it show

"The page cannot be displayed."

if i give RHLBOX ip (192.168.100.20 port 80) then it show RHL defaults homepage which i have setup under /var/www/html/index.html

So i think it getting RHL box defaults home page. [the Test page]

Haa. I have setrup squid proxy on my RHL box. Also, i have stop that service and tried but still not working .

I know this is really simple stuf, i do not why i ma not getting any web site. page.

Please help me to sloved this issue.

Thank you! again for your important time.

-/Hitesh

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
eth0 problem when trying to share internet with dialup modem
« Reply #5 on: December 09, 2004, 07:37:25 PM »
Quote
if i give RHLBOX ip (192.168.100.20 port 80) then it show RHL defaults homepage which i have setup under /var/www/html/index.html

Because you have Apache server configured by default.
Now..

Can you give me output of the following command (it will either 0 or 1)
Code: [Select]
cat /prox/sys/net/ipv4/ip_foward
Then i will suggest u further.

Offline hitesh

  • Linux Noob !
  • *
  • Posts: 11
eth0 problem when trying to share internet with dialup modem
« Reply #6 on: December 10, 2004, 06:20:58 PM »
When i check with /proc/sys/net/ipv4/ip_foward file.

it showing   1

please help me...

Thank you!,
-/Hitesh

Offline dalek

  • LST CareTaker
  • Crescent
  • *****
  • Posts: 243
eth0 problem when trying to share internet with dialup modem
« Reply #7 on: December 10, 2004, 07:05:11 PM »
I found this little script when I was doing mine and after running it I could share my modem fine.  Just save it somewhere, /sbin or /usr/sbin, then type in sh <name if script>.

Here is the script:

Code: [Select]
#!/bin/bash
 IPTABLES='/sbin/iptables'
# Set interface values
 EXTIF='ppp0'
 INTIF1='eth1'
 INTIF2='eth2'
# enable ip forwarding in the kernel
 /bin/echo 1 > /proc/sys/net/ipv4/ip_forward
# flush rules and delete chains
 $IPTABLES -F
 $IPTABLES -X
# enable masquerading to allow LAN internet access
 $IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
# forward LAN traffic from $INTIF1 to Internet interface $EXTIF
 $IPTABLES -A FORWARD -i $INTIF1 -o $EXTIF -m state --state NEW,ESTABLISHED -j ACCEPT
# forward LAN traffic from $INTIF2 to Internet interface $EXTIF
 $IPTABLES -A FORWARD -i $INTIF2 -o $EXTIF -m state --state NEW,ESTABLISHED -j ACCEPT
 #echo -e "       - Allowing access to the SSH server"
 $IPTABLES -A INPUT --protocol ssh --dport 22 -j ACCEPT
 #echo -e "       - Allowing access to the HTTP server"
 $IPTABLES -A INPUT --protocol tcp --dport 80 -j ACCEPT
# block out all other Internet access on $EXTIF
 $IPTABLES -A INPUT -i $EXTIF -m state --state NEW,INVALID -j DROP
 $IPTABLES -A FORWARD -i $EXTIF -m state --state NEW,INVALID -j DROP

Hope that helps.  I'm no expert at this though.  I just found a script that worked for me.

Later

:D :D :D :D

Offline Ricky

  • LST CareTaker
  • Specially Skilled
  • *****
  • Posts: 2381
eth0 problem when trying to share internet with dialup modem
« Reply #8 on: December 15, 2004, 01:06:35 PM »
Quote from: "hitesh"
When i check with /proc/sys/net/ipv4/ip_foward file.

it showing   1

please help me...

Thank you!,
-/Hitesh

It means routing is enabled , I think you should start from scratch.. ie.. try to redo all freshely

Offline hitesh

  • Linux Noob !
  • *
  • Posts: 11
eth0 problem when trying to share internet with dialup modem
« Reply #9 on: December 24, 2004, 04:48:09 AM »
Ricky,

I try and again from scratch and now it's working fine, Thank you very for the help.

but now new problem, i have share some folders between windows to RHEL 3.

I tyr to explain here.

i have started my Linux box and once it up if i try to access net from windows machin i m getting net, but if i try to access some windows sharble data from Linux i can able to access , then again if i try to access net that i can not , i do not why...
this happen, it should work.

I have restart both the services (SMB and iptables)

Also, I have set the rc.ipmasq file path under /etc/rc.d/rc.ipmasq, but if i check with iptables -nL routing not enable.

Then i have to run manualy. in both cases still i am not able to access net from windows PC. why?

pls help me .

haa, some time i can able to access both (shareble data and net)

Thank you! for ur help.
-/Hitesh