Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm trying to set a static IP address in 12.10.

When I run ifconfig, I find that both lo and wlan0 have downloaded packets. In my /etc/network/interfaces file it says auto lo. Which should I be setting?

If I set the IP address the graphical way, through Network settings, do I need to change the settings for both IPV4 and IPV6?

How do I set my IP address to static and how do I know what ip address to use?

share|improve this question
    
First: Why u need Static Ip? Second: what is your gateway IP adress? If u run desktop edition, better do it graphical way. I need more details about your network confguration.. then i can point you to the right way.. –  gexas Mar 5 '13 at 19:19
    
I want it because I host a Minecraft server. What details do you need? –  schtocker Mar 5 '13 at 20:48

3 Answers 3

up vote 1 down vote accepted

Do you have a specific reason for wanting to set a static IP address? it's not needed in the vast majority of situations. If you do need it, it should be either by request from a network administrator at your organization (in which case it's his responsibility to assist you and provide the proper config values), or because you know you need it on a network you built.

-First of all, when I run ifconfig, I find that both lo and wlan0 have downloaded packets. In my /etc/network/interfaces file it says auto lo. Which should I be setting?

lo is an internal loopback interface. You don't need to change this one. Read about the loopback interface here:

http://en.wikipedia.org/wiki/Loopback

-Secondly, every guide I've found does it as though eth0 is the main connection, but it isn't for me? So what should I be doing differently?

What is your main connection? If it's eth1, you should apply the instructions from your guides to eth1 instead. Use common sense here :) It would help if you could tell us which guides you're looking at.

-Next: If I do it the graphical way, through Network settings, do I need to change the settings for both IPV4 and IPV6? Every guide I've found has only ever done it for IVP4.

Not unless you know you need IPV6. This would be something your network administrator can tell you. If it's your own network, you should know whether you have configured or need IPV6.

-Lastly, how do I know what to set my ip address as when I set it to static?

Ah, here's the crux of the matter. You should know this, either because your network administrator told you "configure a static IP on your machine, here are the config parameters") or because you decided "I'll make my home network fully static, here's how I'm going to allocate my address space, here's the IP address for the gateway, this is the IP for my computer" and so on.

If you don't really know what IP address to set, then potentially you don't really need to set one.

I suggest you read up on what setting up a private network with static addresses entails (http://www.wikihow.com/Set-up-a-Private-Network), you don't need to follow the instructions but it will help you understand how to plan a small network and determine whether you want/need to do this.

share|improve this answer
    
I want a static ip address because I host a Minecraft server, and it's getting rather tiresome texting my friends the ip address every time I put up the server. I was unsure of my main connection; but now that you've cleared up for me that it's not lo, then it must wlan0. Some of the guides I've been following are howtoforge.com/linux-basics-set-a-static-ip-on-ubuntu , howtogeek.com/howto/ubuntu/… and jonathanmoeller.com/screed/?p=4053 Also, I am without a network admin because this is my home network. –  schtocker Mar 5 '13 at 20:45
    
Thanks for the explanation. How are you connecting to the internet? DSL? cable modem? You can configure your home router to forward minecraft connections to your computer regardless of its internal IP address, but in order to get a static "public" ip address (the one you give your friends) you would need to speak to your ISP. An easier route is to set up dynamic DNS, this way you give people a name like "schtocker-minecraft.dyndns.org" which doesn't change. Read here: wikihow.com/Make-a-Personal-Minecraft-Server –  roadmr Mar 5 '13 at 21:10
    
Okay, No-IP seems like my ideal solution. Problem is, and I'm not sure what I've done, but whenever the No-IP script is running I am unable to connect to the internet. I have to restart my laptop to be able to. When I ran make install I assumed it'd install it (I had to download the tar.gz) but it just took me to setup and then I couldn't connect to the internet. –  schtocker Mar 5 '13 at 22:26
    
Oh woops I forgot to tag @roadmr –  schtocker Mar 5 '13 at 22:40
    
Don't worry, I've now fixed it. I did as the No-IP website suggested and downloaded/installed it with wget. It now works perfeclty. Thank you very much! –  schtocker Mar 5 '13 at 22:47

static ip configuration example

Here is an example for a static configuration of interface eth0 in /etc/network/interfaces

 iface eth0 inet static 
    address 10.1.2.3 
    netmask 255.255.240.0 
    broadcast 10.1.255.255
    dns-nameservers 10.1.2.3 10.1.2.3
    dns-search example.com

For more informations see man interfaces

share|improve this answer
    
man interfaces provides a very good reference on how to configure interfaces. It's a bit technical (not a tutorial!) but is very helpful. –  roadmr Mar 5 '13 at 19:36

How to set a static IP address in Ubuntu 12.10

The best way to set a static IP address is through "DHCP reservation" on the router, not through the operating system because then you can leave your computer on "DHCP" so when you plug it in somewhere else, it just works. I am using Ubuntu 12.10 and have a Cisco E2000 router to demonstrate.

  1. Run ifconfig on the Ubuntu Box.

    eth0      Link encap:Ethernet  HWaddr d4:3d:7e:ea:9b:3a  
              inet addr:192.168.13.88  Bcast:192.168.13.255  Mask:255.255.255.0
              inet6 addr: fe80::d63d:7eff:feea:9b3a/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:1268 errors:0 dropped:0 overruns:0 frame:0
              TX packets:872 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:1114418 (1.1 MB)  TX bytes:150044 (150.0 KB)
              Interrupt:20 Memory:f7d00000-f7d20000 
    

    That tells you the IP address is 192.168.13.88 I am connected with DHCP

  2. Here my contents of /etc/network/interfaces, it is the default. Don't touch this:

    auto lo
    iface lo inet loopback
    
  3. Log into your router. Find the button called: "DHCP Reservation".

    If you can't find that button for your router, use the Google to type in "where is DHCP Reservation for my crunch-whirrr-bang router?"

    Click the "DHCP Reservation" button. What that button means is you are telling the router to "remember the mac address of a computer, and when it requests an IP address, always give it THAT ip address, and give that IP address out to nobody else.

enter image description here

  1. Check the checkbox in the upper right corresponding to the computer you want to set a static IP address.

enter image description here

  1. Then click Add clients.

  2. Click save settings. Note this freezes the IP address to this computer as-is. You may want to define your own, you need to know your computer's mac address and you can use the "Assign IP address" feature to link an IP address to the mac address of your computer.

  3. Restart the computer, and the router will always give you that 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.