SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2009-10-29 20:09:20

ashleyhinton
New Member
Registered: 2009-09-01
Posts: 6

How do I change my static IP details - command line?

Hi all

I have a Crunchbang system in a cupboard, with SSH access.

I cannot figure out how to change the IP details - when it was first set up (on a screen, using the desktop) I specified a static address on my LAN with the usual info (subnet, router, DNS)

Various internet searches (including these forums) haven't helped.

What I need to do is change the Router/Gateway from 192.168.45.254 to 192.168.45.1

Having looked at the /etc/network/interfaces file it seems pretty sparse.. just two lines:
auto lo
iface lo inet loopback

this leads me to think the settings are elsewhere?

Thanks in advance!

Ashley

Offline

Help fund CrunchBang, donate to the project!

#2 2009-10-29 20:29:05

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 11,496

Re: How do I change my static IP details - command line?

Do you need to be able to change it from the command line, or are you able to log into an openbox session?  If you can get into openbox, try System >> Network Admin in the menu.


Yes; as a matter of fact, I am a cop.  Why do you ask? cool
I'm a moderator here.  How are we doing?  Feedback is encouraged.

Offline

#3 2009-10-29 21:08:39

iggykoopa
Script Master
Registered: 2008-12-13
Posts: 1,485

Re: How do I change my static IP details - command line?

if you only have access to the command line the command you would use is:
sudo route add default gw 192.168.45.1 eth0
change the eth0 to whatever your network card is. Also if you need to change the dns (probably if your gateway changed since they are usually the same) you need to edit /etc/resolv.conf


I say never be complete, I say stop being perfect, I say lets evolve, let the chips fall where they may.

Offline

#4 2009-10-29 21:31:04

ashleyhinton
New Member
Registered: 2009-09-01
Posts: 6

Re: How do I change my static IP details - command line?

Thank you both, iggykoopa: the command did the trick.
pvsage: for some reason I can't vnc, the box is running headless but I belive is sitting there with a message from X because it doesn't like to start with no screen. Got some suggestions to try but not got around to it yet-most stuff it seems can be done by ssh.

Thanks again

Ashley

Offline

#5 2009-11-02 21:14:01

ashleyhinton
New Member
Registered: 2009-09-01
Posts: 6

Re: How do I change my static IP details - command line?

In followup to this, how do I make my gateway change permanent? At the moment:
sudo route add default gw 192.168.45.1 eth0
works but does not survive a restart (for example a power fail..)

Thanks again

Ashley

Offline

#6 2009-11-05 16:45:44

dastagg
Member
Registered: 2009-02-20
Posts: 14

Re: How do I change my static IP details - command line?

You were in the right area (interfaces file). Pasting this in from the Ubuntu forums:

4.3.1.2. For Static IP Address Only

Open /etc/network/interfaces with your favourite editor. Delete everything and paste in what is below. Follow the commented out instructions carefully.

    *

      # Set up the local loopback interface
      auto lo
      iface lo inet loopback

      # Set up the External interface
      #
      # For every xxx.xxx.xxx.xxx, enter the numeric address given to you
      # by your Internet provider. Don't forget to change eth0 to the proper
      # name of the external interface if applicable.
      #
      auto eth0
      iface eth0 inet static
          address xxx.xxx.xxx.xxx
          netmask xxx.xxx.xxx.xxx
          gateway xxx.xxx.xxx.xxxk

Now, set up your DNS servers as given to you by your service provider in /etc/resolv.conf, which should look something like this

    *

      nameserver xxx.xxx.xxx.xxx
      nameserver xxx.xxx.xxx.xxx

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo