LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-24-2004, 05:39 PM   #1
sibtay
Member
 
Registered: Aug 2004
Location: U.S
Distribution: Ubuntu
Posts: 145

Rep: Reputation: 15
Making a Router


I want to make a computer having linux as router

It would allow two subnets within a LAN to communicate with each other

one subnet is of 172.x.x.x while the other of 192.x.x.x

is NAT the solution?

if not then plz tell me which tools should be used to achieve this
 
Old 09-24-2004, 05:45 PM   #2
deice
LQ Newbie
 
Registered: Sep 2004
Distribution: Debian testing/sarge
Posts: 6

Rep: Reputation: 0
no NAT should be required if you i understand your configuration, ie, the computer is connected to two separate LAN's and you want linux to route traffic between them, it's piece of cake:
just make sure your linux box has ip forwarding and proc filesystem built into the kernel and ensure that it has route's to all the subnets (check route command) and that you can ping both subnets from the linux router. then just:

echo "1" > /proc/sys/net/ipv4/ip_forward
(this enables ip forwarding, ie. routing)

and set the linux router's ip address as gateway to the other subnet (or just default gateway if you don't have other network connectivity) on each machine of both subnets (or just use dhcp or whatnot) and you should be good to go.
 
Old 09-24-2004, 05:54 PM   #3
sibtay
Member
 
Registered: Aug 2004
Location: U.S
Distribution: Ubuntu
Posts: 145

Original Poster
Rep: Reputation: 15
Thankz for your reply

So would this configuration allow the computers of 172.x.x.x subnet to communicate with the computers of 192.x.x.x subnet via this linux box?
 
Old 09-24-2004, 07:20 PM   #4
deice
LQ Newbie
 
Registered: Sep 2004
Distribution: Debian testing/sarge
Posts: 6

Rep: Reputation: 0
yup, and also the other way around. ie 172.xxx <-> 192.xxx
you can also use iptables to firewall some machines out for example or add NAT:ting to it, or whatever you want.
 
Old 10-13-2004, 03:03 AM   #5
mercifulsins
LQ Newbie
 
Registered: Oct 2004
Posts: 1

Rep: Reputation: 0
hey guys
just started posting on these forums and i've just started using linux so... bare with me.
okay, here's the situation: PC1 - router, PC2 and PC3, both in different subnets. to configure my computer as a router, here's the script that i run:

#!/bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward

ifconfig eth0 192.168.10.36 netmask 255.255.255.0
ifconfig eth0:1 192.168.10.110 netmask 255.255.255.0

route add -host 192.168.10.36 dev eth0
route add -host 192.168.10.110 dev eth0:1

route add -net 192.168.10.32 netmask 255.255.255.0 gw 192.168.10.33
route add -net 192.168.10.96 netmask 255.255.255.0 gw 192.168.10.97

I have to do this in class, and yes, that is the right netmask because we were given 192.168.10.0 Class C address range to play around with. As far as I know, this script should give address 192.168.10.33 and 192.168.10.97 direct connection (they should be able to ping each other) but for some reason, they can't. And I'm lost now. Please help. Thanks

Last edited by mercifulsins; 10-13-2004 at 05:36 AM.
 
  


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
making a router in slackware kmail Slackware 6 06-20-2004 09:12 PM
Making Slackware a router wenberg Linux - Networking 4 01-03-2004 07:56 PM
Making a slackware 9.0 2.4.22 router kleptophobiac Slackware 3 09-07-2003 09:54 PM
making a wireless router box yocompia Linux - Wireless Networking 0 08-05-2003 04:31 PM
Making a router!!! BouReaq Linux - Networking 6 03-19-2003 02:23 PM

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

All times are GMT -5. The time now is 12:12 AM.

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