LinuxQuestions.org
Visit Jeremy's Blog.
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-23-2005, 04:26 AM   #1
srinivasarajui
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Rep: Reputation: 0
Question Making a linux box router with only one network card


I want to split my network into 2 parts(192.168.0.0 and 193.168.0.0). now I want these machines to communicate with each other. For that i want to use a Linux machine as Router so any one say how to do that.
 
Old 09-25-2005, 02:04 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
193.168.0.0 is not a private network so I wouldn't use that unless you own the whole range. You may be able to acheive what you want by using a device alias for each network. I'm not sure why you are doing it or what you hope to achive though.
 
Old 09-25-2005, 02:28 PM   #3
aq_mishu
Member
 
Registered: Sep 2005
Location: Bangladesh
Distribution: RH 7.2, 8, 9, Fedora
Posts: 217

Rep: Reputation: 30
me too thinking the same. first, you use two different private ip blocks... if you donot have any public ip... and then you are advised to use 2 nics for dividing 2 or more physical network. it will be better and sometimes, it is the best. then you can use 3 or more networks to connect using alias and routing matters. but better is to use atleast two nics.
 
Old 09-25-2005, 02:28 PM   #4
deepclutch
Member
 
Registered: Nov 2004
Location: Kerala, India
Distribution: Debian Bookworm
Posts: 773
Blog Entries: 1

Rep: Reputation: 34
check this link:
http://www.linuxforu.com/yabbse/inde...;threadid=1353
 
Old 09-26-2005, 07:35 AM   #5
srinivasarajui
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Original Poster
Rep: Reputation: 0
ok i am able to do that to some extent but still have some problem
it i am able to make gateway that has 2 ip's (192.168.0.1 & 200.0.0.1) now i am able to ping both ip's of gate way from system1(192.168.0.2) and also from system2(200.0.0.2). I enabled ip forwarding also . But unable ping between the system1 and system2 . so can you suggest any corrections
 
Old 09-26-2005, 07:53 AM   #6
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
You should use only RFC 1918 addresses for your private networks.
10.0.0.0 - 10.255.255.255
172.16.0.0 - 172.31.255.255
192.168.0.0 - 192.168.255.255

What are the routing tables of system1 and system2?
 
Old 09-27-2005, 12:01 AM   #7
srinivasarajui
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Original Poster
Rep: Reputation: 0
I did not have any routing table
 
Old 09-27-2005, 07:25 AM   #8
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
In order for a machine in one subnet to communicate with a machine in another subnet, BOTH machines need to know how to route packets to each other's subnet.

You have three options:

Option 1: On both groups of machines, specify a default route pointing to the interface they can see on your gateway
Code:
                               ----------------------------
                               [          Gateway         ]
                               [ 192.168.1.1  192.168.2.1 ]
                               ----------------------------
                                    /                 \
                                   /                   \
----------------------------------/                     \-----------------------------------
[192.168.1.2                      ]                      [192.168.2.2                      ]
[route add default gw 192.168.1.1 ]                      [route add default gw 192.168.2.1 ]
-----------------------------------                      -----------------------------------
               |                                                          |
-----------------------------------                      -----------------------------------
[192.168.1.3                      ]                      [192.168.2.3                      ]
[route add default gw 192.168.1.1 ]                      [route add default gw 192.168.2.1 ]
-----------------------------------                      -----------------------------------
               |                                                          |
-----------------------------------                      -----------------------------------
[192.168.1.4                      ]                      [192.168.2.4                      ]
[route add default gw 192.168.1.1 ]                      [route add default gw 192.168.2.1 ]
-----------------------------------                      -----------------------------------
Option 2: On both groups of machines, specify a route for a specific network pointing to the interface they can see on your gateway. You'll use this if you need to have the default route through a different gateway:
Code:
                                                         ----------------------------
                                                         [          Gateway         ]
                                                         [ 192.168.1.1  192.168.2.1 ]
                                                         ----------------------------
                                                                   /      \
                                                                  /        \
-----------------------------------------------------------------/          \------------------------------------------------------------------
[192.168.1.2                                                     ]           [192.168.2.2                                                     ]
[route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1 ]           [route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.2.1 ]
------------------------------------------------------------------           ------------------------------------------------------------------
                               |                                                                            |
------------------------------------------------------------------          -------------------------------------------------------------------
[192.168.1.3                                                     ]           [192.168.2.3                                                     ]
[route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1 ]           [route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.2.1 ]
------------------------------------------------------------------           ------------------------------------------------------------------
                               |                                                                            |
------------------------------------------------------------------          -------------------------------------------------------------------
[192.168.1.4                                                     ]           [192.168.2.4                                                     ]
[route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1 ]           [route add -net 192.168.1.0 netmask 255.255.255.0 gw 192.168.2.1 ]
------------------------------------------------------------------           ------------------------------------------------------------------
Option 3: On both machines, specify a route for a specific IP address pointing to the interface they can see on your gateway. If you have only two machines, this makes sense.:
Code:
                                         ----------------------------
                                         [          Gateway         ]
                                         [ 192.168.1.1  192.168.2.1 ]
                                         ----------------------------
                                              /                \
                                             /                  \
--------------------------------------------/                    \--------------------------------------------
[192.168.1.2                                ]                    [192.168.2.2                                ]
[route add -host 192.168.2.2 gw 192.168.1.1 ]                    [route add -host 192.168.1.2 gw 192.168.2.1 ]
---------------------------------------------                    ---------------------------------------------

Last edited by Snowbat; 09-28-2005 at 05:37 AM.
 
Old 09-27-2005, 07:37 AM   #9
Snowbat
Member
 
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338

Rep: Reputation: 31
I'm assuming here that all the machines run Linux. There are equivalent route commands in Windows but the syntax is slightly different.
 
Old 09-27-2005, 12:02 PM   #10
linuxmanju
Member
 
Registered: Sep 2003
Location: India
Distribution: Debian
Posts: 50

Rep: Reputation: 15
route add 192.168.2.0 mask 255.255.255.0 192.168.1.1


is the equiv windows command for
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1
 
Old 09-28-2005, 01:35 AM   #11
srinivasarajui
LQ Newbie
 
Registered: Sep 2005
Posts: 8

Original Poster
Rep: Reputation: 0
Smile Thank q

I am able to do it
 
Old 09-28-2005, 11:52 AM   #12
bunnyrage
Member
 
Registered: Sep 2005
Distribution: Fedora Core 2
Posts: 34

Rep: Reputation: 15
its always best to let your hardware do the routing, in other words, its best to use 2 networks cards

normally you have an external interface, or WAN

and an internal interface, or LAN

the same goes for 2 LANs

using software to alias physical hardware is always going to produce unexpected problems

give your router somthing physical to link MAC addresses to ip addresses,

use two interfaces
 
Old 09-28-2005, 12:03 PM   #13
bunnyrage
Member
 
Registered: Sep 2005
Distribution: Fedora Core 2
Posts: 34

Rep: Reputation: 15
also

class C networks can be divided on the last two octets

192.168.X.X

192.X.X.X and 193.X.X.X are two totaly diferent networks altogether

you would need to set up your network as such

192.168.1.1-254 = subnet 1
192.168.2.1-254 = subnet 2
192.168.3.1-254 = subnet 3
..
..
..
..
192.168.23.1-254 = subnet 23

understand??

you are needing to create subnets within your class C network address

192 168 1 23
| | | |
netblock netblock 1st subnet host 23, on subnet 1

192.168 is not reassignable

1 is your own reassignable subnetwork, you can make 254 subnets within 192.168

your hosts are your last octet, 23, you can have 254 hosts within each subnet

this means you are capable of creating about 64516 hosts (254 times 254)(subnets times hosts in each subnet)

understand??
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Small linux box as a wireless router/home network ideas enine Linux - Wireless Networking 16 05-09-2006 10:25 PM
I am a linux n00b... need help with notebook network card, and router (linksys) spookyct Linux - Wireless Networking 15 06-01-2005 12:52 PM
Making my linux box a wireless router? jon_k Linux - Wireless Networking 1 12-26-2004 05:48 PM
Making Linux box a router eonblue4309 Linux - Networking 4 03-18-2004 06:17 PM
making a wireless router box yocompia Linux - Wireless Networking 0 08-05-2003 05:31 PM

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

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