Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
09-23-2005, 04:26 AM
|
#1
|
LQ Newbie
Registered: Sep 2005
Posts: 8
Rep:
|
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.
|
|
|
09-25-2005, 02:04 PM
|
#2
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
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.
|
|
|
09-25-2005, 02:28 PM
|
#3
|
Member
Registered: Sep 2005
Location: Bangladesh
Distribution: RH 7.2, 8, 9, Fedora
Posts: 217
Rep:
|
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.
|
|
|
09-25-2005, 02:28 PM
|
#4
|
Member
Registered: Nov 2004
Location: Kerala, India
Distribution: Debian Bookworm
Posts: 773
Rep:
|
|
|
|
09-26-2005, 07:35 AM
|
#5
|
LQ Newbie
Registered: Sep 2005
Posts: 8
Original Poster
Rep:
|
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
|
|
|
09-26-2005, 07:53 AM
|
#6
|
Member
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338
Rep:
|
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?
|
|
|
09-27-2005, 12:01 AM
|
#7
|
LQ Newbie
Registered: Sep 2005
Posts: 8
Original Poster
Rep:
|
I did not have any routing table
|
|
|
09-27-2005, 07:25 AM
|
#8
|
Member
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338
Rep:
|
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.
|
|
|
09-27-2005, 07:37 AM
|
#9
|
Member
Registered: Jun 2005
Location: q3dm7
Distribution: Mandriva 2010.0 x86_64
Posts: 338
Rep:
|
I'm assuming here that all the machines run Linux. There are equivalent route commands in Windows but the syntax is slightly different.
|
|
|
09-27-2005, 12:02 PM
|
#10
|
Member
Registered: Sep 2003
Location: India
Distribution: Debian
Posts: 50
Rep:
|
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
|
|
|
09-28-2005, 01:35 AM
|
#11
|
LQ Newbie
Registered: Sep 2005
Posts: 8
Original Poster
Rep:
|
Thank q
I am able to do it
|
|
|
09-28-2005, 11:52 AM
|
#12
|
Member
Registered: Sep 2005
Distribution: Fedora Core 2
Posts: 34
Rep:
|
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
|
|
|
09-28-2005, 12:03 PM
|
#13
|
Member
Registered: Sep 2005
Distribution: Fedora Core 2
Posts: 34
Rep:
|
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??
|
|
|
All times are GMT -5. The time now is 02:08 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|