Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I use an Ubuntu system and frequently connect to my parent's Windows system on the local network. But, using DHCP, the computers IP address are always different, making it a chore to find what IP address the machines are before connecting to them.

Is there a way to let the systems ask for a permanent IP address from the DHCP server?

share|improve this question
    
Do not connect to addresses; connect to names. –  grawity Nov 26 '11 at 13:26
    
@grawity How would that work? If, for example, I had a web UI running on port 8080 of a computer named Example-PC, what do I write in my browser? –  Oxwivi Nov 26 '11 at 13:59
    
http://Example-PC:8080/ –  grawity Nov 26 '11 at 14:13
    
@grawity Doesn't work. –  Oxwivi Nov 26 '11 at 14:58
    
@grawity It did work, when I wrote the name of my Ubuntu system when using it. But it did not resolve the Windows system. –  Oxwivi Nov 26 '11 at 15:46

2 Answers 2

You need to set a static IP.

Ubuntu

Run the following, and note down the netmask and gateway:

sudo ifconfig 

Edit /etc/network/interfaces, and, assuming your NIC is eth0, add the IP, netmask and gateway addresses noted earlier:

auto lo eth0
iface lo inet loopback
iface eth0 inet static
address xxx.xxx.xxx.xxx # enter your IP address
netmask xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx

Windows

Run ipconfig command in Command Prompt to get the default gateway and netmask.

  1. Open Network Connections

  2. Right-click the network connection you want to configure, and then click Properties.

  3. On the General tab (for a local area connection) or the Networking tab (all other connections), click the Internet Protocol (TCP/IP) component, and then click Properties.

  4. Click Use the following IP address for a local area connection, in IP address, Subnet mask, and Default gateway, type the IP address, subnet mask, and default gateway addresses.

  5. Click Use the following DNS server addresses.

  6. In Preferred DNS server and Alternate DNS server, type the primary and secondary DNS server addresses. This is usually the same as your default gateway

If you need to do something more advanced here's the official howto for Windows and a howto for Linux.

share|improve this answer
    
Can't this be done on a network-by-network basis? It's a wireless netowrk (I tagged the question as such), and could cause a problem if I connected to a different network. Or if there are some other system connected to the system using the IP addresses we defined. –  Oxwivi Nov 26 '11 at 8:57
    
unfortunately you cant do what without some form of connection management. there's no reason static IPs shouldn't work on wireless though –  Journeyman Geek Nov 26 '11 at 9:46
    
I'm not saying static IP won't work on wireless networks, I'm saying there might be IP address conflicts if I connect to a different network. Or can I ask to be assigned an IP address near the limit of the address space? (192.168.1.100)? And my Ubuntu system is a desktop, got NetworkManager. –  Oxwivi Nov 26 '11 at 14:02
    
that would probably work - but most systems i run seem to favour IP addresses between 192.168.1.100-200... so going low might work better –  Journeyman Geek Nov 26 '11 at 14:05
    
I don't know, in my network, there are three systems which revolves around .2, .4, and .6. It depends on the network, then? This is annoying... –  Oxwivi Nov 26 '11 at 14:44

Check your parent's router settings, under DHCP there should be an option for allocating a fixed address to a given MAC address. I've not come across a router that doesn't allow you to reserve an IP address.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.