LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 09-19-2003, 02:21 AM   #1
Baran
Member
 
Registered: Aug 2003
Location: Tampere-FINLAND
Distribution: Mandrake 10.1
Posts: 105

Rep: Reputation: 15
Most simple network ever !


This is thought to be a very simple network problem. I want to set a network with my home mate's windows XP. Shortly there are two computers connected to each other directly by an ethernet cable. There isn't an hub. We want to share our files and internet. We will be having a cable internet connection in few days, so we want all things to be set by that day. My computer will be the gateway. Yesterday, we tried to set a local network at home. Red Hat 9.0 recognised my ethernet card properly. In fact I don't know what to do now?
I am brand new on this subject. I even don't know what information is needed for someone to answer this !
 
Old 09-19-2003, 02:49 AM   #2
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
Things you need:

1 CROSS-OVER ethernet cable (for the computer->computer connection)

2 (total) network cards in the gateway (1 for the internet service, 1 for the compter-to-computer connection)


you'll need to set ip addresses for both computers:

if eth0 is used to connected to the internet, leave it alone for now.

assuming eth1 is connected to the windows XP machine, do this:

(as root users)
Code:
#ifconfig eth1 192.168.0.1 bcast 192.168.0.255 netmask 255.255.255.0
open the file /etc/sysctl.conf and modify the line that says
Code:
net.ipv4.ip_forward = 0
to
Code:
net.ipv4.ip_forward = 1
also, as root do this(to avoid having to reboot)
Code:
#echo 1 > /proc/sys/net/ipv4/ip_forward

as root again
Code:
#iptables -P FORWARD ACCEPT
#iptables -A POSTROUTING -t nat -s 192.168.0.1/24 -j MASQUERADE
that last part you'll want to put in a script that runs everytime you boot up. also, this setup is very NOT SECURE. Because you are new, i didnt go into the whole firewalling thing but you will want to learn iptables ASAP (like before you get the internet connection).

there are several threads on LQ (this site) about itables. try doing a search (4th blue button on the second row at the top, right-hand side of the screen). You should find a wealth of good examples. Also, here is a link to a howto taht i just "googled" for:

http://www.netfilter.org/unreliable-....linuxdoc.html


oh i almost forgot, you'll have to setup the windows machine:

1. give it an ip address of 192.168.0.X where X is anything except for 0, 1 or 255.

2. give it a netmask of 255.255.255.0

3. give it a gateway/default router of 192.168.0.1 (the linux box)

4. DNS servers will be whatever you get from you internet service provider.

the setup for win XP is located in Control Panel -> Network Connections.

RIGHT mouse click on the Local Area Connection icon
Click Properties
Highligh the line that say Internet Protocol (TCP/IP)
then Click the Properties button

you'll see a screen where you can enter in all that information.

to check that you have the right info entered in:

Click Start -> Run type "cmd" (without the quotes) and hit enter.

When you get teh command prompt type the command:
ipconfig /all

and you should see the information you entered.
 
Old 09-19-2003, 02:49 AM   #3
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
if i left something out, someone please correct me, its almost 4am and im a little sleepy.
 
Old 09-19-2003, 03:32 AM   #4
Baran
Member
 
Registered: Aug 2003
Location: Tampere-FINLAND
Distribution: Mandrake 10.1
Posts: 105

Original Poster
Rep: Reputation: 15
Thanks for your help Robert0380, you have been very very very very helpfull

Next I have other questions,

Robert0380 said

(total) network cards in the gateway (1 for the internet service, 1 for the compter-to-computer connection)

1) I have one network card, and that is for computer-to-computer connection. Will I need to buy one more for the cable connection, I think there will a modem given by the service provider. I mean I didn't need a network card for the dial-up connection at least, the communication was via serial port . Anyways I guess this wasn't a LQ problem

2) Robert0380 as I said you helped alot, but I will do what you wrote but I want to learn what I am doing by those commands, can you or someone else explain me what these do.


i) #ifconfig eth1 192.168.0.1 bcast 192.168.0.255 netmask 255.255.255.0

ii) open the file /etc/sysctl.conf and modify the line that says

code:--------------------------------------------------------------------------------
net.ipv4.ip_forward = 0
--------------------------------------------------------------------------------

to

code:--------------------------------------------------------------------------------
net.ipv4.ip_forward = 1
--------------------------------------------------------------------------------



iii) also, as root do this(to avoid having to reboot)

code:--------------------------------------------------------------------------------
#echo 1 > /proc/sys/net/ipv4/ip_forward
--------------------------------------------------------------------------------

iv)as root again

code:--------------------------------------------------------------------------------
#iptables -P FORWARD ACCEPT
#iptables -A POSTROUTING -t nat -s 192.168.0.1/24 -j MASQUERADE
--------------------------------------------------------------------------------


that last part you'll want to put in a script that runs everytime you boot up. also, this setup is very NOT SECURE. Because you are new, i didnt go into the whole firewalling thing but you will want to learn iptables ASAP (like before you get the internet connection).

windows part is my home mates problem he should have used Linux also
 
Old 09-19-2003, 04:01 AM   #5
ashjam10
Member
 
Registered: Sep 2003
Location: UK
Distribution: Mandrake 10.0
Posts: 121

Rep: Reputation: 15
Usually the cable modem will connect via ethernet, hence needing a second ethernet card, though the one I have can also connect via USB.
 
Old 09-19-2003, 04:50 AM   #6
sashhoney
Member
 
Registered: Jul 2003
Distribution: Red Hat, Fedora, Debian
Posts: 85

Rep: Reputation: 15
i will try to explain each stmt one by one
1) ifconfig is used to configure ur ethernet card(s), if u r using 2 ethernet cards and first one is reserved for net conn, then u have to configure 2nd card for ur local network(in ur case u have 2 m/c), so using ifconfig u r just configuring
a) ip address(192.168.0.1 in ur case)
b)broadcast add
c)subnet mask (255.255.255.0 generally used for C-class network)

2) /etc/sysctl.conf entry enables ur machine to communicate(forward ) ip packets to other machine. this sol is only for Redhat user in my opinion
3)doing the same thing as first but here u need not reboot the machine
4)ipchains allows u to configure firewall. u can read How-tos to understand all these concepts
 
  


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
simple network sa1nt Linux - Networking 1 12-11-2004 10:56 AM
Simple network setup filburt1 Linux - Wireless Networking 12 03-15-2004 08:44 PM
Question about a simple network mitchmiller Linux - Networking 1 03-13-2004 03:41 PM
Simple network AttOMIXT Linux - Networking 3 10-06-2003 10:14 AM
Setting up a simple network... RJL Linux - Networking 6 02-24-2003 06:57 AM

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

All times are GMT -5. The time now is 12:59 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