TLWIR 49: RELIABLY Printing From GNU/Linux to a Windows 7 Printer

by Rex Djere on November 22, 2012 · 4 comments

in TLWIR

Post image for TLWIR 49: RELIABLY Printing From GNU/Linux to a Windows 7 Printer

1a. Leave Your Windows 7 PC and Router Set Up to Use DHCP, but Reserve a Permanent IP address for the Win 7 PC in the Router’s DHCP Settings.

Originally, this article only had sections 1, 2, and 3. Section 1 described how to make the Windows 7 PC a fixed target by making it have a static IP address. The method of section 1 will still work perfectly, but the astute reader presented me with a more flexible option that I did not know about. I tested it, and it worked brilliantly! The alternative method is to set up your router so it always assigns the same IP address to your Windows 7 PC. This is more flexible because your Windows 7 PC will still use DHCP to set its IP address. If it connects to a different network, it will still be able to use that network’s DHCP server to assign it a different IP address. In business settings and advanced home settings, it is fairly common for one computer to connect to multiple networks.

Here is how to set it up. You will go back into your Windows 7 network settings, and set it up to obtain IP its IP address automatically. To do this you go to Control Panel >> View network status and tasks >> Local Area Connection >> Properties >> Internet Protocol Version 4 (TCP/IPv4) >> Properties. You’ll check Obtain an IP address automatically, and hit OK.

Next, you will have to grab the MAC address of your Windows 7 machine. To do this, You will open a command line by going to Start, and typing cmd in the Search programs and files box. In the command line, you’ll type the command getmac, and hit Enter. The MAC address will be a 12 character long number/letters. Every 2 characters will be separated by a dash. The MAC address will look something like this: 01-23-45-67-89-AB

If you have more than one network adapter installed in your Windows 7 PC, you will have more than one MAC address shown. Write all of them down on a piece of paper. You want to make sure that you end up reserving the IP address for the right network adapter in your Windows 7 box. Matching the right MAC address is VERY important.

Next, you’ll go into your router, and change the starting DHCP IP address back to 1 higher than the router’s IP address, if you changed it earlier. For example, if you changed it from 192.168.1.2 to 192.168.1.3, you’ll change it back to 192.168.1.2. Reboot the router and the Windows 7 PC. When they come back up, the Windows 7 PC should now have a newly assigned IP address, and the router should be assigning addresses starting from 192.168.1.2 again. Now you’ll go in and associate the 192.168.1.2 IP address with the MAC address of the Windows 7 machine. To make this whole process more clear, let’s look my settings in the Figures below.

First, I get my Windows 7 machine’s network name from the network settings as shown in Figure A.

Figure A: Verifying My Windows 7 PC's Network Name

Then, I’ll get my Windows 7 PC’s MAC address using the getmac command in a Windows 7 command line as shown in Figure B. (I’ve obscured my full MAC address for security purposes.)

Figure B: Getting the Windows 7 PC's MAC Address

Now, I can go into my router and match up my Windows 7 PC’s MAC address with one of the MAC addresses in my router’s DHCP client table, as shown in Figure C below (again, all MAC addresses are obscured for security purposes).

Figure C: Reserving an IP address for the Windows 7 PC in My Router

As you can see, I’ve already moved my Windows 7 PC down to the Clients Already Reserved area at the bottom. It originally was one of the clients up in the Select Clients from DHCP Tables area. I just matched up its MAC address with the MAC address that I had written down from the results of the getmac command. After I verified that they matched, I felt comfortable moving the Windows 7 PC down to the Reserved area. I did this using the Manually Add Client menu box. The final test was to reboot the Windows 7 PC to make sure that it always got assigned the 192.168.1.2 IP address. It worked like a champ!!!

Thank you to Tim Chase for pointing out this great option.

Pages: 1 2 3 4 5

{ 4 comments }

Tim Chase November 23, 2012 at 1:01 pm

Rather than tell Windows to use a static IP address, I’d leave the Windows machine using DHCP and then configure your router to hand out a static IP address to your Windows box based on its MAC (hardware) address. You can find the MAC in the output of the “ipconfig” command in the line reading “Physical Address” where it should look something like “XX-XX-XX-XX-XX-XX”. This allows your Windows PC to move uneventfully to other networks and still get the right internal IP address when it reconnects to your home network. It also prevents your router from accidentally handing out the Windows box’s IP address to other DHCP clients.

Rex Djere November 23, 2012 at 3:05 pm

@Tim Chase, thank you very much for the astute comment. I’ve updated the article to reflect your recommendation.

SW November 23, 2012 at 3:30 pm

If you don’t want to use nmap, you could also use netcat (nc) for this. Chances are good it will already be installed.

nc -zv
You will see this if it succeeded:
Connection to port [tcp/http] succeeded!
and this if it failed:
nc: connect to port (tcp) failed: Connection refused

SW November 23, 2012 at 3:31 pm

You can ignore my first comment as the site didn’t like angle brackets. Here’s the correct one.

If you don’t want to use nmap, you could also use netcat (nc) for this. Chances are good it will already be installed.

nc -zv (host) (port)
You will see this if it succeeded:
Connection to (host) (port) port [tcp/http] succeeded!
and this if it failed:
nc: connect to (host) (port) port (tcp) failed: Connection refused

Previous post:

Next post: