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 10-01-2005, 06:02 PM   #1
-Srict-
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Rep: Reputation: 0
share internet between 2 other networks


Hello, I've been banging my head against the wall the last two days getting linux loaded on this old p2 Gateway w/ 512mb ram I had lying around and want to use it to replace my windows server.

What I would like to do is have the gateway box setup with 3 NICs.
1- connected to my cable modem for internet,
2- connected to my main network switch and,
3- connected to my wireless access point/router.

In the end i would like to have the inet shared and dhcp'able thru the main network(2) and also would like to be able to access files and inet thru the wireless access point.

Ideally I would want IPS to be automatically assigned to anyone who stops by and plugs into my switch so they can access network shares and browse the web. I would prefer to have the ips setup like so: main LAN network IP something 10.10.0.0 for the main network(eth2), 10.10.1.0 for the wireless access point (eth1) and whatever my ISP assigns me for eth0

I come from a windows networking background, and I am familiar on how to do such things in windows but would like to know if theres a simple way to do this in linux. I havent really settled on a distro yet but have a copy of Xandros 3 i was thinking about using for it, otherwise I was thinking about Vector SOHO or Mepis SOHO.

If someone can tell me the commands or let me know what I need to research I would very much appreciate it.

Last edited by -Srict-; 10-01-2005 at 06:04 PM.
 
Old 10-01-2005, 08:41 PM   #2
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
I don't see any problem doing this. Tell us more about the cable modem - does it contain a router that gives you a 192.168.x.x address or is it a dumb modem that gives you a public IP address when you run a ppp client on your computer?
 
Old 10-02-2005, 01:56 AM   #3
-Srict-
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
its not a fancy cable modem.. its one i've had for about 4 years now. I plug it directly into eth0 and dhcp automatically assigns me an ip direct from my isp. I do not run any special software or protocols in windows, just tcp/ip. dhcp takes care of everything. I'm on the internet with xandros now, i just can't get access on any other client machine at the moment.
 
Old 10-02-2005, 05:06 AM   #4
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
In Xandros when you run /sbin/ifconfig do you have a connection called ppp0? The following assumes that you do.

The following will configure your other network cards and add NAT router for ppp0. Note that you will have to force netmask 255.255.255.0 on every device as the 10.0.0.0 range is considered a Class A network and defaults to netmask 255.0.0.0
Code:
ifconfig eth1 10.10.0.1 netmask 255.255.255.0
ifconfig eth2 192.168.5.1
/sbin/modprobe iptable_nat
/sbin/iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
On the wireless router you'll need to disable the PPPoE and DHCP settings, set the router "public" IP address to 192.168.5.2 and configure a default route of 192.168.5.1. Warning: this may not be possible on some routers. You can leave it doing NAT - set the DHCP address pool to 10.10.1.2 - 10.10.1.254 netmask 255.255.255.0.

Set LAN clients up as 10.10.0.2-10.10.0.254 netmask 255.255.255.0, default route 10.10.0.1, ISP nameservers for DNS.
Wireless clients should pick up an IP address from the router as normal. Use ISP nameservers for DNS.

Once you've verified everything works, you can incorporate these settings in your startup files and maybe add a DHCP service and caching name service on your box.

Last edited by Snowbat; 10-02-2005 at 06:01 PM.
 
Old 10-02-2005, 10:19 AM   #5
-Srict-
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
Thank you, i'll be sure to try this out when i get home.. One quick question though, is there a reason why u picked the ip 192.168.5.2? the router defaults to having its dhcp run on 192.168.1.1. just curious.
 
Old 10-02-2005, 06:05 PM   #6
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
That's dhcp for the wireless clients. The router's "public" ip address needs to be on a different subnet. I picked 192.168.5.x because it is not 192.168.0.x or 192.168.1.x commonly used for dhcp on routers.

Note I've taken out a route add -net line from the above commands which (on reflection) shouldn't be there.
 
Old 10-03-2005, 06:20 PM   #7
-Srict-
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
ok upon closer inspection i do no have a ppp0 connection.. if i do a 'ifconfig' it comes back with a eth0-eth2 and lo devices.

what do I need or how would i go about setting up a ppp0 device, and is that needed? I never had to setup anything like that in windows, but then again it could have been automatically setup for me.
 
Old 10-04-2005, 06:49 AM   #8
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
No it's not needed - I just assumed you were running a PPPoE client to connect through the cable modem. If your eth0 has a public IP address (like 24.x.x.x) then replace ppp0 above with eth0. If not, please post output of /sbin/route and /sbin/ifconfig.
 
Old 10-04-2005, 12:36 PM   #9
-Srict-
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
/sbin/modprobe iptable_nat

This line give me an error.. too bad I am at work and surrounded by windows machines so the exact error msg it gave me i do no remember.. I will post it when i return home..

I appreciated your help, and hope to get this resolved soon. Thank you.
 
Old 10-05-2005, 10:47 AM   #10
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
OK. Please state the distro (and version) you are using too.
 
Old 10-06-2005, 03:26 AM   #11
-Srict-
LQ Newbie
 
Registered: Oct 2005
Posts: 6

Original Poster
Rep: Reputation: 0
I am running Xandros desktop 3.0, updated with newest service pack.


when running the modprobe command i get a device or resource busy error while referencing files these files:

ip_conntrack
iptables_nat.ko
ip_tables.ko
 
Old 10-06-2005, 05:20 PM   #12
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
A thread here suggests you should make sure the Xandros firewall is disabled, install Firestarter, and configure it to use NAT: http://forum.xandros.com/viewtopic.p...a7ec2a6dfaf4aa
 
  


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
How do you bridge networks on linux? Or share a network's internet connection? pugsley1218 Linux - Networking 1 11-14-2005 04:36 AM
2 networks and 2 internet connections on linux router seer_tenedos Linux - Networking 6 03-27-2005 07:24 AM
Merging two networks to share internet connection Maranza Linux - Networking 17 02-02-2004 08:32 PM
New to Linux, want to share between two seperate networks. Tiber1 Linux - Networking 2 10-21-2003 04:53 PM
Multiple private networks interconnection via internet cardner Linux - Networking 0 01-14-2002 02:15 PM

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

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