LinuxQuestions.org
Review your favorite Linux distribution.
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
 
LinkBack Search this Thread
Old 12-26-2003, 06:44 AM   #1
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Rep: Reputation: 15
Arrow Help me set up a private network and router (looong post)


There. Some time ago I came here for help to set up networking on linux. After not having much success with any help it somehow appeared that one of the 2 network cards was defective. I later replaced it with a new one and it worked fine. The thing was that when I tried that "defective" network card on another PC with Windows it appeared to work fine as well. Weird. The old thread can be viewed here if anyone is interested:
http://www.linuxquestions.org/questi...081#post419081

Okay. That was some history. Now let me get to the point.
I just recently got ADSL. It was the final thing I was waiting for before attempting to create a private network and giving all computers on it internet access. Now the problem appears to be just that.

Here's what I plant to do:
I wish to create a small home local area network so that all computers can communicate over it (like playing games, file transfers, etc.) Along with that I also wish to give every computer connected to the local network internet access. The thing is that I only want one computer to be connected to internet over ADSL modem. All other computers should have internet access via the first PC. So most probably I'll have to be using the first PC AS A ROUTER. This first computer I'm talking about has Red Hat Linux 9 on it, the rest have windows. I also want to use the first PC as HTTP server and some other things.

Here's what hardware I have available:
I have 4 computers waiting to be conected to lan. The first one has Red Hat Linux 9 on it and 2 network cards (I thought I could use one to connect to internet and another one to connect to lan, this PC should be the only one connected to internet, others have to access the internet over the first one). The rest of them have Windows98/XP on them and each has one network card for the lan (lol ). I also have a 5 port (Level One) switch for the lan and an ADSL modem plus some UTP cables.

Here's what I've done already:
At one point I have successfully created a private network with static IP's. The linux PC had the following IP: 192.168.10.1 and mask: 255.255.255.0 The rest PC's had the same mask but the last byte of the IP was one number higher for each PC like 192.168.10.2, 192.168.10.3, etc. The static network appeared to work fine as we played games and shared files over it. The problem came when I connected ADSL modem to the second network card on my linux PC. The linux PC could connect to internet fine but none of the rest PCs seemed to be able to access the internet. It appeared as the linux PC was blocking the traffic from the static network to the internet. Yes. I have disabled the firewall and configured both network cards properly. All computers could ping each other on the LAN. The linux PC could ping www.google.com for example which none of the rest could. I said earlier that I wanted to use this linux PC as a router. Is there some kind of routing software I need to configure on the linux PC? Or it this at all possible to access internet from one computer over the linux one (in at the first network card and out at the second)?

Second thing I attempted was connecting ADSL modem directly to switch but unlike the first time, this time all the computers were able to access the internet by seperately logging online (each one had different IP, I don't know what is going to happen when I get a static IP from the ISP as I am planning to, I need it for the server). This time the static network was dead. And this second case is not quite what I want. I have heard that it is possible to keep the network as it is (in this case ADSL modem is still connected to switch unlike in the first case where it was connected to the second network card on the linux pc), connect only one PC to the internet and let the other PC's know to access the internet over the first one as a gateway.

Here's what help I need:
I have listed what I have done so far. Now I would like someone to explain me these network things a bit because I myself do not have much networking knowledge (specially on linux). Are there any links to good network tutorial sites? What was I doing wrong? What kind of network would you recommend me?


Here's what I also wish to know:
One more thing I just recently noticed and I think it's worth mentioning is: How would this private network affect game servers? If I am to host a game server on a windows PC that is not directly connected to internet how would the IP be visible from the outside the network. Would it be 192.168.10.* or would it be the static IP from the ISP (when I get it)? What if I try to host 2 game servers on different PC's - would IPs of both servers appear the same from the outside network? How would people connect to them?

Yes, I know. I have absolutely no idea on these things. That's why I'm asking here. If a question I asked sounds stupid please don't start on me. I didn't know it was stupid.
I hope I posted enough info. Please tell me if you do not understand something so we can clear it up. Anything would be welcome here. Suggestions, help, links, tutorials, etc.
Thanks.
Overlord Origy

Last edited by <Ol>Origy; 12-26-2003 at 07:06 AM.
 
Old 12-26-2003, 08:14 AM   #2
bcarl314
Member
 
Registered: Jun 2003
Location: USA, Minnesota - Land of 10,000 lakes
Distribution: Red Hat 9, Mandrake 10
Posts: 56

Rep: Reputation: 15
Having just done this myself, I'll try to help...

Sounds like you've got about 90% of what you need done. Here's what you'll need to do.

Right now your got the Internet coming in on one card (I'll say eth0) and your network on the other card (say eth1). Now, by default, all the packets from eth1 will not be "forwarded" to eth0 unless you tell them to. This is done for security reasons.

What you'll need to do is enable IP forwarding. Which will tell linus to take packets from the local network and forward them on to the world and vice versa. (Well, not exactly, but for simplicity sake we'll say that).

I would try doing a google search for the following topics...

NAT
IP Masquerading
IP Forwarding
iptables service

Other thoughts,

Reset firwall settings. I use the medium setting and allow SSH on my eth0 (internet) card and set eth1 (network) as a trusted device.

Hope this helps.
 
Old 12-27-2003, 07:04 AM   #3
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Original Poster
Rep: Reputation: 15
So you're saying the network I have now (the one with 2 network cards on the linux PC) should work if I enable IP forwarding. That's good as I won't have to remove one network card. Hmm, I have no clue how to enable IP forwarding but I'll try google searching for those keywords. Hopefully I find something that can help. Thanks for your reply.
 
Old 12-27-2003, 07:09 AM   #4
imoex2
LQ Newbie
 
Registered: Oct 2003
Posts: 3

Rep: Reputation: 0
have you checked out http://www.ipcop.org

it should be enough for waht you want to do
this is waht i run at home and has never failed me
 
Old 12-27-2003, 08:53 AM   #5
bcarl314
Member
 
Registered: Jun 2003
Location: USA, Minnesota - Land of 10,000 lakes
Distribution: Red Hat 9, Mandrake 10
Posts: 56

Rep: Reputation: 15
This command (run as root) should also do it...

$> echo 1 > /proc/sys/net/ipv4/ip_forward
 
Old 12-29-2003, 12:35 PM   #6
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by imoex2
have you checked out http://www.ipcop.org

it should be enough for waht you want to do
this is waht i run at home and has never failed me
Thanks for your reply. Are you suggesting that I should install a new firewall on my PC? Since I'm very new to linux I would rather not install any additional software. If at all possible I'd like to solve my problem with things I have installed on my PC so far (which includes software from the Red Hat installation DCs only).

Quote:
Originally posted by bcarl314
This command (run as root) should also do it...

$> echo 1 > /proc/sys/net/ipv4/ip_forward
Yes. I set that to 1 before. It still doesn't let any traffic through.

I would be glad to give info about my configuration but I have no idea what I should post.

My ifconfig output looks line this:
eth0 Link encap:Ethernet HWaddr 00:06:4F:03:3F:EE
inet addr:192.168.10.1 Bcast:192.168.10.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:72920 errors:0 dropped:0 overruns:0 frame:0
TX packets:138529 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:4735480 (4.5 Mb) TX bytes:203204611 (193.7 Mb)
Interrupt:10 Base address:0xe800

eth1 Link encap:Ethernet HWaddr 00:50:FC:E2:A9:4B
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2960 errors:0 dropped:0 overruns:0 frame:0
TX packets:2971 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:385357 (376.3 Kb) TX bytes:231664 (226.2 Kb)
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:21 errors:0 dropped:0 overruns:0 frame:0
TX packets:21 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:4954 (4.8 Kb) TX bytes:4954 (4.8 Kb)

ppp0 Link encap:Point-to-Point Protocol
inet addr:193.77.251.149 P-t-P:213.250.19.90 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1
RX packets:2606 errors:0 dropped:0 overruns:0 frame:0
TX packets:2618 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:3
RX bytes:306721 (299.5 Kb) TX bytes:152828 (149.2 Kb)

eth0 is my local network while eth1 is connected to ADSL. Ask me to put output of files if that can help.
Thanks.
 
Old 12-29-2003, 03:40 PM   #7
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Original Poster
Rep: Reputation: 15
Never mind! I solved it! Now I can access the internet from all PC's!!!! YAYAYAYAYAY!!!! Thanks for pointing me to google with those keywords, bcarl314!

Let this topic be a lesson to all of those who have similar problems and those who will seek help in the future!
Go to this website and follow the instructions!
http://tldp.org/HOWTO/IP-Masquerade-HOWTO

It should work for you just as it did for me!!! I'm so happy now HAHAHA!!!
Okay okay... calming down.

Last edited by <Ol>Origy; 12-29-2003 at 04:42 PM.
 
Old 12-29-2003, 05:21 PM   #8
bcarl314
Member
 
Registered: Jun 2003
Location: USA, Minnesota - Land of 10,000 lakes
Distribution: Red Hat 9, Mandrake 10
Posts: 56

Rep: Reputation: 15
Glad I could help.

btw, I'm at home now on my Linux box, here's the command I wanted to post earlier...

Code:
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
Of course that assumes eth0 is on the internet, and eth1 is on the LAN.
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
help me to set up a home network with the router/modem irena56 Linux - Networking 5 09-30-2005 03:26 PM
do i configure my router to set up a wireless network motaguense Linux - Wireless Networking 1 06-18-2004 04:32 PM
Virtual private network citrus Linux - Networking 1 05-24-2004 08:11 AM
How can I set my Suse 9.0 system to work as a router on an existing network? ww6y Linux - Networking 1 02-04-2004 09:08 AM
Mandrake 7.2 & barricade router, need to set up network printer wolfyheart Linux - Newbie 0 10-17-2001 09:42 PM


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

Main Menu
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