LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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-16-2004, 11:51 PM   #1
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Rep: Reputation: 15
Unhappy Newbie- Redhat 9.0 sharing internet with 2 WIN XPpro




Hello all.

I have a linux redhat 9.0 with 3 Lan Cards, eth0, eth1, eth2.

I want to use the Redhat 9.0 as a router for my other two PCs (Both are Win Xp Pros).

I am using the eth0 (or is it ppp0?) to connect to ADSL, using eth1 for 1 windows xp and eth2 for the other windows XP system. Each windows XP is connect to a seperate Lan Card.

I have been asking around and people tell me to use the DHCP server. I downloaded the dhcp-3.0.1 version and installed it. I have configured the dhcpd.conf and started the server.

Here is the 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;
	}
After configuring the dhcp.conf, i tried to ifup oth eth1 and eth2.

It doens't seem to work. This message appears

Code:
Determing IP information for eth1... failed; no link present. Check Cable?
Determing IP information for eth2... failed; no link present. Check Cable?
So i tried assigning Static IP Addresses to eth1 and eth2 using the Redhat Network setting interface (i dot know how to do it otherwise )

Code:
 For eth1 its:

Address: 192.168.0.2
Netmask: 255.255.255.0
Gateway:192.168.0.1 (i am not sure about this, just guessing)

For eth2 its:

Address: 192.168.0.3
Netmask:255.255.255.0
Gateway:192.168.0.1 (again, i am not sure about this, just plainly guessing :D)
I didn't configure the eth0. "The default is Automatically obtain IP addresses setting with DHCP".

I rebooted my redhat 9.0 and started the DHCP server.
When i plug the cable from each of the Win Xp systems into eth1 and eth2, on both Win Xp Systems, it says that there is no link. And on the Redhat 9.0, the light for each of the LAN Cards aren't on.

The Windows XP systems are connected to the Redhat 9.0 Directly. Not Hub switch in between, Lan Card to Lan Card.

The cables used to connect Win Xp to Redhat 9.0 are the same cables i used to connect to my old router (the ones you get for $60 USD).

Might this be because i am not using a network hub/ switch and different cables have to be used? Or does it have to do with the setting on my RedHat 9.0 ?

All Lan cards, eth0, eth1, eth2 have been tested and they all work.

Here is my host file in case its any useful
Code:
#Do not remove the following line, or various programs
#that require network functionality will fail.
127.0.0.1        BMX.localdomain        localhost
255.255.255.255        all-ones        all-ones
 
Old 08-17-2004, 12:19 AM   #2
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
first be sure to use a twisted cable for your ms boxes.

ping interfaces eth1 & 2 to see they are up and running (your dhcp-server too).
the ms boxes will get their ip's when they start up - i'm not sure they can fetch it later, when they are already powered up.

btw. using dhcp just for two machines's quite not necessary if you don't frequently change your netlayout.

sl mritch.
 
Old 08-17-2004, 01:15 AM   #3
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Original Poster
Rep: Reputation: 15
Thank you very much!

I kinda fixed one problem. I wasn't using a cross cable .

I have got both ms systems connected to my redhat 9.0.
They both have an IP address now.

Afterwards, i tried to test and see if i can view a webpage from one of the Win XPs. It doesn't really connect to any online service.

Is my next step to setup iptables?
 
Old 08-17-2004, 02:31 AM   #4
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
right.
you'll have to tell the linux box to act as a router - packages from the ms boxes should go out to internet and the answers 'll have to be send back.
first enable /proc/sys/net/ipv4/ip_forward by writing 1 to it:

echo 1 > /proc/sys/net/ipv4/ip_forward

now you'll want to set up the firewall:

iptables -t nat -A POSTROUTING -o eth0 -j SNAT ---to [ IPofYOURadslLINK/eth0-IP ]
iptables -A INPUT -i eth0 -m state --state NEW,INVALID -j DROP
iptables -A FORWARD -i eth0 -m state --state NEW,INVALID -j DROP

while this will do it i recommend reading the documention from iptables and/or firewall-howto! you better know what you do ;-)

sl mritch.
 
Old 08-17-2004, 03:09 AM   #5
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Original Poster
Rep: Reputation: 15
THX
 
Old 08-17-2004, 03:45 AM   #6
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Original Poster
Rep: Reputation: 15
I don't quite get this bit.

Code:
iptables -t nat -A POSTROUTING -o eth0 -j SNAT ---to [ IPofYOURadslLINK/eth0-IP ]
I have this enabled
Code:
# Controls IP packet forwarding
net.ipv4.ip_forward = 1

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1
Is that correct? Coz my ms systems don't seem to be able to ping http://www.yahoo.com or http://www.google.com.
They are able to ping localhost.

Thanks for help
 
Old 08-17-2004, 04:42 AM   #7
mritch
Member
 
Registered: Nov 2003
Location: austria
Distribution: debian
Posts: 667

Rep: Reputation: 30
the POSTROUTING line makes that outgoing connections via your ISP gets forwarded with the IP-address of your outgoing interface (=ppp0 or eth0).
i.e. if your eth0 has 192.168.1.10: packets from your internal net (behind eth1/2) will get rewritten to 192.168.1.10 when they are send and also when they return and so it will look like (for the outside net) all packets come from the linuxrouter.

if you use a ppp0 and/or a dynamic assigned IP at your outgoing iface try this rule instead:
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE

rp_filter just takes care that packages crossing a interface really belong to the network the iface is connected to.

here's some reading:
http://www.netfilter.org/documentation/

sl mritch.
 
Old 08-17-2004, 06:20 AM   #8
Julian_Thong
LQ Newbie
 
Registered: Aug 2004
Posts: 23

Original Poster
Rep: Reputation: 15
Thank you very much !!
 
  


Reply



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
internet sharing, linux client, win server... huzzzo Linux - Networking 3 08-21-2005 02:30 PM
Sharing internet between WIN XP and REDHAT Travis Huey Linux - Newbie 10 02-14-2005 01:11 AM
internet sharing from slack 10.0 -> win xp zobra Linux - Networking 4 11-20-2004 12:17 AM
Win Me - RedHat 9 - Net working & Internet sharing Iyan Linux - Networking 2 09-23-2003 10:14 PM
Sharing Internet Connection with Win Me iaypaa Linux - Networking 8 10-13-2002 04:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:16 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
Open Source Consulting | Domain Registration