LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 08-18-2004, 08:57 AM   #1
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Rep: Reputation: 15
How do i set ppp0 as default gateway for internet sharing in Redhat?




I am new to linux.

I have installed redhat 9.0 3 days ago. I am trying to share the internet with 2 Win XP pros, using Redhat as the gateway. I spent alot of time everyday on it and it still doesn't seem to work.

I have read http://www.start-linux.com/articles/article_70.php and a few other sites. It didn't seem to work atall .

My setup- Redhat with eth0, eth1, eth2 and something called ppp0. I am using the xDSL connection wizard in Redhat and have extablished the internet connection using the eth0 card. A ppp0 is then created.

When i assign a static IP address for the eth0 using the redhat interface, ping www.yahoo.com doens' work. So i set it to "Automatically obtain IP address settng from DHCP". Is it conflicting with the ppp0 in anwayway?

I have assigned a static IP adress for eth1 and eth2. They are As follows

eth1:

Address- 192.168.0.2
Subnet mask- 255.255.255.0
Default gateway- I don't know what to put. The ppp0 has a dynamic IP address and changes everytime i reconnect

*The address on the WIN XP appears to be different on both machines. For the first machine- 169.254.120.214, netmask- 255.255.0.0. Why is that?

eth2

Address- 192.168.0.4
Subnet mask- 255.255.255.0
Default gateway- I don't know what to put. The ppp0 has a dynamic IP address and changes everytime i reconnect.

I have tried this Firewall Script

http://www.ecst.csuchico.edu/~dranch...c.firewall-2.4

But i don't know what to do. I read the instructions from this- http://www.ecst.csuchico.edu/~dranch...masq-HOWTO.pdf

I followed the insturtions about the Kernel 2.4.

Still no luck.

I have tried DHCP, but it just doesn't assign any IP addresses to my WIN XPs. When i set eth1 and eth2 to "automatically obtain IP address settings with dhcp", when starting the dhcp server, it says "no subnet decleration for eth1 and eth2".

After assign both cards addresses, this "no subnet decleration for eth1 and eth2" doesn't appear anymore. But when the Two WIN XPs are connected to the Redhat, connection is established. I am able to ping local host and ping each of the machines from all the hosts.

dhcpd.conf
Code:
ddns-update-style ad-hoc;
# Thong
subnet 192.168.0.0 netmask 255.255.255.0 {
	host Andre {
		hardware ethernet 00:50:FC:99:20:C8;
		fixed-address 192.168.0.3;
		option broadcast-address 192.168.0.255;
		}
	host Julian {
		hardware ethernet 00:C0:DF:0A:D2:C9;
		fixed-address 192.168.0.2;
		option broadcast-address 192.168.0.255;
		}
	range 192.168.0.30 192.168.0.50;
	}
Should I be Using DHCP?
Do i need to set gateways?

THANKS!!!

Is there anything that i can post so that it makes it even more clear what the problem is?
 
Old 08-18-2004, 09:18 AM   #2
arno
Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: fedora core 8, suse 10.3, ubuntu 7.10, kamikaze 7.09
Posts: 515

Rep: Reputation: 30
You don't need a dhcp server.
but first i need some information about your ppp connection
post the output of
ifconfig
route -n
display the adress of ppp as xx.xx.nn.nn where nn are the real numbers
 
Old 08-18-2004, 09:42 AM   #3
rhettmaxwell
LQ Newbie
 
Registered: Apr 2004
Posts: 20

Rep: Reputation: 0
dsl router

go spend $40-$50 bucks on a dsl router. It'll be the best thing you ever did.

If you don't want a router, your current setup will work. You don't need to use dhcp, static ips are fine. You'll have to learn about iptables though. Its not that hard.


-rhett
 
Old 08-18-2004, 10:06 AM   #4
rhettmaxwell
LQ Newbie
 
Registered: Apr 2004
Posts: 20

Rep: Reputation: 0
adslsetup

are you using adsl-start to start your dsl connection. i remember asl-setup asked me if i wanted to share my connection. It would have setup the firewall rules for me. give it a try.
 
Old 08-18-2004, 10:21 AM   #5
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Original Poster
Rep: Reputation: 15
Code:
eth0      Link encap:Ethernet  HWaddr 00:0A:CD:0A:50:51
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4791 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4812 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:2096460 (1.9 Mb)  TX bytes:570105 (556.7 Kb)
          Interrupt:11 Base address:0x3000

eth1      Link encap:Ethernet  HWaddr 00:0A:CD:0A:50:72
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:2874 (2.8 Kb)
          Interrupt:10 Base address:0x5000
 
eth2      Link encap:Ethernet  HWaddr 00:0A:CD:08:64:0F
          inet addr:192.168.0.4  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:0 (0.0 b)  TX bytes:480 (480.0 b)
          Interrupt:9 Base address:0x7000
 
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:67794 errors:0 dropped:0 overruns:0 frame:0
          TX packets:67794 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4876796 (4.6 Mb)  TX bytes:4876796 (4.6 Mb)
 
ppp0      Link encap:Point-to-Point Protocol
          inet addr:203.218.128.101  P-t-P:203.218.41.254  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:80 errors:0 dropped:0 overruns:0 frame:0
          TX packets:84 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3
          RX bytes:35846 (35.0 Kb)  TX bytes:11191 (10.9 Kb)
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
203.218.41.254  0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth2
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth2
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth2
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         203.218.41.254  0.0.0.0         UG    0      0        0 ppp0
I just tried adsl-setup and chose option 2- MASQ. What does it actually do in terms of configuration ?

Thank you Very much guys!

Last edited by Julian_Thong; 08-18-2004 at 10:30 AM.
 
Old 08-18-2004, 11:41 AM   #6
rhettmaxwell
LQ Newbie
 
Registered: Apr 2004
Posts: 20

Rep: Reputation: 0
are you sure you can connect to the other machines?

i'm confused. are the machines connected with crossover cables or is there a hub or switch installed somewhere?

can you try 'traceroute julian' and 'traceroute andre' (or use their ips 192.168.0.3, 192.168.0.2 ?)

If there's a hub or switch, then you have too may nic's. If you are using crossover cables, i'm not sure how both ip's are working, because all routes for 192.168.0.0 are going through eth2

Quote:
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
you should seriously consider the dsl router. it would be the best/easiest solution unless you want to use something like squid or dan's guardian for the other machines.

http://www.walmart.com/catalog/produ...26297%3A126311

-rhett
 
Old 08-18-2004, 11:51 AM   #7
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Original Poster
Rep: Reputation: 15


Connected with cross cables. No Hub switch.

Haha, thanks for the tip, i already have one. i've been using it for a year now. I've decided to setup a 24/7 accessable private ftp server from school. For it to be accessable, i'll have to use it as a gateway for the one internet connection that i have. Of coz, i can create a virtual server and use the dsl router as a gateway.

I want to learn Linux , so i've decided to make it the gateway.


Maybe ill just reset everything lol.

But where do i start ?

Last edited by Julian_Thong; 08-18-2004 at 11:55 AM.
 
Old 08-18-2004, 12:14 PM   #8
arno
Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: fedora core 8, suse 10.3, ubuntu 7.10, kamikaze 7.09
Posts: 515

Rep: Reputation: 30
If there is a dhck server on your computer stop it
Give
eth0 adress 192.168.0.1 net mask 255.255.255.0 gw 203.218.41.254
eth1 adress 192.168.1.1 net mask 255.255.255.0 gw 203.218.41.254
eth2 adress 192.168.2.1 net mask 255.255.255.0 gw 203.218.41.254
put the dns information of your isp in
/etc/resolv.conf
nameserver xx.xx.xx.xx
and restart your computer
 
Old 08-18-2004, 01:32 PM   #9
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Original Poster
Rep: Reputation: 15
I have done the configurations

For the resolv.conf, i put
Code:
ns1.netvigator.com 205.252.144.228
.

But after those configurations, the ppp0 fails to connect

And before the configurations, i noticed that if i assign the eth0 (the lan card i use for connecting to the PPPoE), the ppp0 fails to connect. Might that have anything to do with this?

Is there anything i can post to help?

Thank you all very much.
 
Old 08-18-2004, 02:39 PM   #10
arno
Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: fedora core 8, suse 10.3, ubuntu 7.10, kamikaze 7.09
Posts: 515

Rep: Reputation: 30
replace in resolv.conf
ns1.netvigator.com 205.252.144.228
to
nameserver 205.252.144.228
 
Old 08-18-2004, 02:48 PM   #11
rhettmaxwell
LQ Newbie
 
Registered: Apr 2004
Posts: 20

Rep: Reputation: 0
my breakdown

i use a dsl connection at work, and I've used it with and without a dsl router.

without the router, the dsl modem actually gave my nic an ip via dhcp. the address was like 192.168.1.11 and the dsl modem was using 192.168.1.1. Then a ppp connection was established over the ethernet connection (known as PPPoE). This is the ppp0 connection that you have, and it gets the real internet ip address.

for your setup i don't think you need to run a dhcp server, that's overkill. you can just use static ip's.

andre = 192.168.1.5 , connected to eth1(192.168.1.4) over crossover cables
julian = 192.168.1.7, connected to eth2(192.168.1.6) over crossover cables

ifconfig eth1 192.168.1.4
ifconfig eth2 192.168.1.6

you need to modify your routing so that you can connnect to each of these boxes. You'll want it to look something like

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
203.218.41.254 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.1.5 0.0.0.0 255.255.255.255 U 0 0 0 eth1
192.168.1.7 0.0.0.0 255.255.255.255 U 0 0 0 eth2
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 203.218.41.254 0.0.0.0 UG 0 0 0 ppp0

so you'll have to delete any other routes that go to eth1 and to and add the ones above
route add 192.168.1.5 netmask 255.255.255.255 eth1
route add 192.168.1.7 netmask 255.255.255.255 eth2

andre should be able to ping 192.168.1.4 and julian should be able to ping 192.168.1.6

you said that pinging the other machines was actually working before, but i'm not quite sure how. the routing didn't seem correct to me.

the adsl-start script should setup the routing for you if you chose that option in the adsl-setup script. It probably does a couple of things. 1st it probably sets FORWARD=1, so that now your linux box can act as a gateway. 2nd it probably added a few rules for forwarding requests.

I'm not sure how elaborate the forwarding rules are since I haven't used forwardig with this script. You can view how the rules are setup with 'iptables -L' which will list the rules for each chain.

If you want to know more about iptables (you said you wanted to learn linux), you can find out more at http://www.tldp.org.
 
Old 08-18-2004, 07:54 PM   #12
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Original Poster
Rep: Reputation: 15
Thank you
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
default gateway not set by PPPoE, can't ping internet rproffit Linux - Networking 3 12-17-2007 06:29 AM
How can I tell what my default gateway is currently set as? abefroman Linux - Networking 6 09-10-2005 01:15 PM
How can I set up an internet gateway? peaceofcrap2001 Linux - Networking 1 06-11-2005 11:39 PM
How do I set the ip address for eth0, eth1 and the default gateway? abefroman Suse/Novell 5 05-19-2005 05:15 AM
how do I add script to set default gateway on boot for eth1 abg Linux - Networking 3 10-01-2003 06:22 PM


All times are GMT -5. The time now is 03:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration