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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
12-01-2003, 12:04 PM
|
#1
|
|
Member
Registered: Dec 2003
Location: Earth... I think!?
Distribution: Debian
Posts: 32
Rep:
|
Use two networks?
Greetings,
We are running two networks, in two separate locations that are connected to each other. One network has some linux machines and the other is mostly windows.
Problemita: I need to access the printers that are on one network, but also need to be able to ssh..etc on another. I have two network cards that I can enable/disable and somehow get by, but is there a way to assign certain tasks to each card? For Example, use eth0 for printers/http and use eth1 for ftp/ssh?
Any help is much appreciated.
|
|
|
|
12-01-2003, 01:04 PM
|
#2
|
|
Moderator
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047
Rep:
|
Welcome to LQ.
You can set specific routes to specific hosts. This will be automatic if your networks are on different subnets.
|
|
|
|
12-01-2003, 01:43 PM
|
#3
|
|
Senior Member
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
|
Well you can plug each NIC into a different network, but that may be difficult unless you have access to the wiring closet and you're allowed to plug into both at once. Usually spanning multiple networks is BAD because you want the traffic to go through a supported firewall or router. If your machine forwards packets it could become an unintentional bridge between two networks.
The correct way to handle the situation is to place a router between your networks and have it route traffic. In your routing table on the Linux box you would want to setup a route to the other network and point it at the router (assuming the router has an interface connected to your network). This is assuming that the same router isn't also your default router for all traffic, in which case it would happen automatically and you don't need to do anything.
|
|
|
|
12-01-2003, 02:41 PM
|
#4
|
|
Member
Registered: Dec 2003
Location: Earth... I think!?
Distribution: Debian
Posts: 32
Original Poster
Rep:
|
Thanks, that solves it!
I can ssh the router, which routes me to one of the computers on the Linux subnet and go from there.
|
|
|
|
12-01-2003, 03:45 PM
|
#5
|
|
Senior Member
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
|
Well, that is a little bit different than what I was explaining, but if it works.. great!
Let me make things more clear. Say you are on one network, that is say 172.16.0.0/24 and there are some machines on another network, say 192.168.0.0/24 that you want to get to. Now there is a router at 172.16.0.1 that is your default route to the Internet. There is also a router at 172.16.0.100 that also has an interface on 192.168.0.100 and it will pass traffic in between. The catch is that you have only two routes on your box, one for 0.0.0.0/0 which points to 172.16.0.1, and one for 172.16.0.0/24 that points to eth0.
What you want is a third route, one that tells your machine where to find 192.168.0.0/24.
Right now your routing table looks like this (assuming 172.16.0.20 is your IP)
Code:
destination gw if
0.0.0.0/0 172.16.0.1 eth0
172.16.0.0/24 172.16.0.20 eth0
what you want is this
Code:
destination gw if
0.0.0.0/0 172.16.0.1 eth0
172.16.0.0/24 172.16.0.20 eth0
196.168.0.0/24 172.16.0.100 eth0
So you need to do
route add -net 192.168.0.0/24 gw 172.16.0.100
You can add that to /etc/rc.d/rc.local or on some distributions there's a file call /etc/static-routes (or something similar)
Last edited by chort; 12-01-2003 at 03:47 PM.
|
|
|
|
12-02-2003, 11:02 AM
|
#6
|
|
Member
Registered: Dec 2003
Location: Earth... I think!?
Distribution: Debian
Posts: 32
Original Poster
Rep:
|
I'm using Debian (Knoppix), We have one network 192.168.1.0/255 and another network 186.168.1.0/255. There is a router in between, WAN IP. I think I was doing is going there manually ssh and there is a way to configure it automatically in the routing tables.
I don't quite understand it completely.
I think I see how it will work if I am on the Windows network (192...)running Linux, and I can use the printers on the Linux network (186...) if they are connected to a server, but in our case here it's quite different. The printers are stand alone and some are connected to windows machines. Is there a way that I can be on Linux (186...) network and access the printers as stand alone machines on 192... or do I have to configure the router for each one?
Sorry, I'm a bit confused on this.
Thanks.
|
|
|
|
12-02-2003, 02:00 PM
|
#7
|
|
Senior Member
Registered: Jul 2003
Location: Silicon Valley, USA
Distribution: OpenBSD 4.6, OS X 10.6.2, CentOS 4 & 5
Posts: 3,660
Rep:
|
First, /255 is not a valid bitmask. IPs are formed by <network number><host number> where the network number is always static. The CIDR notation is just a shorthand way of saying how many bits of the IP are static, i.e. how many bits are used to specify the network. Thus a dotted decimal subnet mask of 255.255.255.0 would translate into a CIDR bitmask of /24, becuase the first 24 out of 32 bits are static.
OK, now that we have that out of the way...
The router between the 192 and 186 networks should have two interfaces, one on 192 and one on 186. If this router is not your default router for all non-local traffic, then you will need to create static routes on all the 192 machines to point to the router for 186 addresses and vis versa.
|
|
|
|
12-24-2003, 11:01 AM
|
#8
|
|
Member
Registered: Dec 2003
Location: Earth... I think!?
Distribution: Debian
Posts: 32
Original Poster
Rep:
|
I think I understood more of what you are saying 
I configured the second network card to be on the other network (but without a gateway)
Now everything is working fine and here's what the routing tables look like:
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 eth1
187.26.16.0 * 255.255.255.0 U 0 0 0 eth0
default 187.26.16.254 0.0.0.0 UG 0 0 0 eth0
Many Thanks!
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 08:27 PM.
|
|
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
|
|