LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   share internet between 2 other networks (https://www.linuxquestions.org/questions/linux-networking-3/share-internet-between-2-other-networks-368842/)

-Srict- 10-01-2005 06:02 PM

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.

Snowbat 10-01-2005 08:41 PM

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?

-Srict- 10-02-2005 01:56 AM

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.

Snowbat 10-02-2005 05:06 AM

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.

-Srict- 10-02-2005 10:19 AM

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.

Snowbat 10-02-2005 06:05 PM

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.

-Srict- 10-03-2005 06:20 PM

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.

Snowbat 10-04-2005 06:49 AM

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.

-Srict- 10-04-2005 12:36 PM

/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.

Snowbat 10-05-2005 10:47 AM

OK. Please state the distro (and version) you are using too.

-Srict- 10-06-2005 03:26 AM

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

Snowbat 10-06-2005 05:20 PM

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


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