Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to a printer on another subnet 2

Status
Not open for further replies.

Deskey

Technical User
Dec 18, 2002
24
0
0
US
We have a little test lab environment where I work at. I'm on one subnet (192.168.x.x) and i'm trying to print on a printer on another subnet (151.123.x.x.). What are the different ways I can print to that printer on the other subnet?


by the way, the printer has an IP address.
 
Is there a router on your network? Are your machines Windows?
 
There is no routing device (router or managed switch) between the 2 subnets. But if there was (correct me if i'm wrong), all I would have to do is use the same default gateway for both subnets (have all computers point to the same default gateway), right? Thats just it, their is no routing device, so technically, there is no default gateway. All the machines are Windows.
 
Yes, having a single router as the central default gateway would do it. Here is another trick that *might* work:

Manually set the default gateway on each machine to the statically assigned IP of that same machine. In other words, the machine is its own gateway. I experimented with this in a W2k box and it works great. The machine actually ARPs out for IPs outside of its own subnet (I've captured it with a protocol analyzer for those of you about to flame me on this). Normally, without any default gateway (or with a real default gatway that is some real router), the machine will not ARP outside of its own subnet. It will either drop the traffic (no default gateway at all) or ARP for its router (real default gateway). This little trick breaks the layer 2/layer 3 separation, but what the hell?

I don't know how the printer will behave. That might be a problem. Also, on your machines, I guess you'll have to enter the IP of the printer instead of a name.

Let us know if any of that works out. I'm curious, having communicated between Windows boxes in this way but never between a Windows box and a printer.

Regards.
 
The first thing I did (the quick fix) was to change the IP address of the printer, so it's in the same subnet as the computer i'm trying to print from. Obviously that worked. But I know their's several ways to print to that printer on the other subnet. One is I can go to my command prompt and enter a static route and use my computer as a router and do a ROUTE ADD dest. ip, subnet mask, default gateway. For a network as small as this, it's no problem adding static routes to each computer to point and print to the printer on the other subnet. But their's got to be a way (rather than adding a static route to each computer I want to print from) to make all the computers on that subnet print to the printer (other than configuring your router to pass traffic from ethernet LAN 192.168.x.x to 151.123.x.x or setting up all computers on both subnets with the same default gateway.) Maybe a LMHOSTS? Any suggestions. By the way, I will try your "little trick" on making each computer its own gateway. Don't know how the printer on the other subnet will act though.
 
Since you have no routing device, it appears to me that the problem is that you are trying to talk between subnets with no way to do so.

Without a router to connect the two subnets, you could add a second IP address to your NIC and then you'd have an address on each subnet for your PC.

For example, if your PC is 192.168.0.1 and the printer is 151.123.0.1, then add 151.123.0.2 as a secondary address to your NIC. It will then be able to talk on both subnets.

You mentioned above that you don't want to go to each PC and make changes. You still have the problem of trying to talk across subnets without a router. The only way to avoid changing every workstation would be to put in a router. Of course, that could be one of your PCs. Then point your workstations' gateway settings to that router. There has to be a device to talk between subnets, or else you have to put each machine on both subnets.

LMHOST won't work in this case. That file is used for netbios name resolution. You have a layer-3 communication issue here.

svermill, that's interesting about the ARP. I've not tried that before. I'll give it a shot. The only problem I see is that once it does this ARP, can it really communicate? An ARP is a broadcast, but what about a unicast? With a unicast, the packet specifies source and destination addresses. If they are in different subnets, then the devices trying to talk are going to look for their gateways. This isn't a flame, you just made me very curious about this. I'll look into it. Thanks for the info.
 
Thanks guys for the suggestions and advice. Bierhunter, i'm going to try yours, I don't know why I never thought of assigning a 2nd IP address to the NIC. Where would you do it in 2000 Pro and XP? I saw the option in XP and wanted to make sure it was right, it was under TCP/IP, alternate configuration. Svermill, still haven't had time to try your very interesting suggestion (using each PC as its own gateway). I will see how it works, thanks again guys!!!
 
bierhunter,

Yes, communication between the boxes does work. Once the ARP cache has been populated, the machines simply encapsulate the off-subnet IP datagrams into a layer two frames and put it out on the wire. The recipient recognizes its layer two address, strips off the frame, and recognizes its IP address. Viola.

The only trick is getting the sending machine to send an off-subnet IP datagram directly instead of looking for a gateway. It kinda breaks the protocol stack concept a little bit, but some one at MS obviously saw a need for this. When the machine sees that the gateway address and the static IP address match, it realizes it has to make its own way in the world and does the only thing it know how. It ARPs.

Regards all,

Scott
 
Thanks for the info! You're right, it pretty much goes against the whole concept of how things are supposed to work. That's pretty cool.

Like I keep telling everyone I work with. One of the things great about the IT field is that we learn something new everyday no matter how long we've been doing it.
 
Oops, sorry Deskey. Almost forgot to respond.

If you go to the TCP/IP properties you'll see an "advanced" button. Hit that, and you can add addition IP addresses. It's only available if you aren't using DHCP.
 
Sorry guys for not responding in awhile. You know how the holidays can get pretty hectic. Anyways, I solved the printer problem and was able to print to another subnet. I tried what you guys told me, but none seemed to work. The biggest thing here is that their isn't a routing device in between the 2 subnets. I did a route add on the machine and added the printers IP address, I gave each machine its own IP address as the gateway and those didn't work. I couldn't find the option to add a secondary IP address to the NIC ( I didn't even know you can do that). If my PC had a dual-NIC PC, I could've enabled IP forwarding and assigned IP addresses for both NIC's to accommodate the 2 subnets, but then wouldn't you need all PC's in that subnet to have dual-NIC's to be able to talk to the other subnet? Anyways, this is what I ended up doing. In a nutshell, I supernetted. I changed the subnet mask of the PC opposite of the printers subnet and did the same for the printer and gave them both a class A sunbet mask. That's all I had to do and it worked! It just recognized the first octet of the IP address (192) and stopped there and I guess that was good enough to make it think it was in the same network. I combined the 2 subnets in a supernet. Thanks for everyones help and comments on this. By the way, a happy belated New Year to you all!!!
 
Thanks for the update. Too many people never bother.

I was afraid the printer wouldn't build an ARP cache entry for an off-subnet PC. Windows boxes don't seem to have a problem with it, but the TCP/IP stack in a lot of printers is, well, pretty basic. But you found a way to achieve your goal, so good for you.

Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top