LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 12-12-2008, 09:07 AM   #1
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Rep: Reputation: 51
setting a static IP in Kubuntu 8.10....


All right, I decided to give Kubuntu a try after using Slackware for a couple years. I am using 8.10 with KDE 4 and despite some others here, I have had very little issues with KDE 4. I am crossing my fingers to hope that continues.

My real question is though, is that I am trying to set a static IP on Kubuntu 8.10. I have editted the /etc/network/interfaces and /etc/resolv.conf (which I remember doing similarly in Slackware) to reflect the IP address and DNS servers for which I plan to use. Thought all was fine, but upon restarting the networking services AND even a reboot, it's like the changes I made to the files didn't do any good. It still reverted to an automatically assigned IP OR in some cases no IP at all. So giving up on that, I manually typed in the command for ifconfig and also adding the default gateway. This worked fine and I had internet access again. Now, I thought maybe on a reboot it'd save my changes...again, the answer is no. So...I then figured to create a startup script which I placed in /etc/init.d. Made it executable obviously. But even since doing that, it still won't save the info on reboots. I either have to manually start the script/commands. Any ideas on how I can set this to where it's automatic and it will actually save the settings when I reboot?
 
Old 12-12-2008, 09:38 AM   #2
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Just put your required configuration into /etc/network/interfaces
man interfaces for more details
Here's mine, for a static IP:
Code:
auto lo
iface lo inet loopback

# eth0 is wired
iface eth0 inet static
broadcast 10.255.255.255
address 10.0.0.8
netmask 255.255.255.0
# The next address is the address of my router
gateway 10.0.0.2
# These settings are for a small 192.168.0.X network
# with the router at 192.168.0.1
# broadcast 192.168.0.255
# address 192.168.0.8
# netmask 255.255.255.0
# gateway 192.168.0.1

# eth1 is wireless, WPA encrypted
auto eth1
iface eth1 inet static
broadcast 10.0.0.255
address 10.0.0.8
netmask 255.255.255.0
gateway 10.0.0.2
wpa-passphrase NoImNotListingItHere
wpa-ssid MyEssid
wireless-channel 11
Edit the file, then do a sudo /etc/init.d/networking restart
And all should be well.
It should automatically connect at the next boot.

AVOID GUI networking tools, as in my experience, they mess up the interfaces file.
 
1 members found this post helpful.
Old 12-13-2008, 09:39 AM   #3
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Original Poster
Rep: Reputation: 51
Nice try tredegar...but still no go. That's actually what I had tried before but wasn't able to get it. I, however, didn't have the broadcast line but I added it thinking it might help. But it didn't. My file is basically just like yours with my IP and gateway settings of course, and my resolv.conf is set for the DNS servers I use. I tried the restart of the init.d networking script too a few times...and even rebooted...but it just doesn't want to give my eth0 adapter an IP address even though it is set in those files. The only way I can do it now is manually with the ifconfig eth0 command.
 
Old 12-13-2008, 09:46 AM   #4
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
1] What is the LAN IP of your router?
2] Please post your interfaces file (preferably within CODE tags!)
3] Please post your resolv.conf
Edit:
Quote:
The only way I can do it now is manually with the ifconfig eth0 command.
What is the command that gets you a static IP that works?

Last edited by tredegar; 12-13-2008 at 09:47 AM.
 
Old 12-13-2008, 10:12 AM   #5
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Original Poster
Rep: Reputation: 51
1) Router IP: 192.168.1.1
2)
interfaces file...
Code:
auto lo
iface lo inet loopback

#iface eth0 inet dhcp
iface eth0 inet static
broadcast 192.168.1.255
address 192.168.1.6
netmask 255.255.255.0
gateway 192.168.1.1
3)
resolv.conf file...
Code:
search zoominternet.net
nameserver 24.154.1.6
nameserver 24.154.1.7
And the manual commands I use to get my static IP working are:

sudo ifconfig 192.168.1.6 netmask 255.255.255.0 up
sudo route add default gw 192.168.1.1
 
Old 12-13-2008, 10:42 AM   #6
oxleyk
Member
 
Registered: Nov 2003
Distribution: Ubuntu
Posts: 309

Rep: Reputation: 30
In my experience you also have to disable Network Manager. You can change all the settings for static IPs but when you restart NM will take over again.

Kent
 
Old 12-13-2008, 10:54 AM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Agreed: Disable (= uninstall) the wretched Network "Manager".
Your interfaces file looks good.
Check it still looks good after you have removed Network Manager, then sudo /etc/init.d/networking restart and all should be sweet.

Edit:

If you want a network GUI for wireless get wicd It is good for wireless.
Its repository is here:
Code:
deb http://apt.wicd.net hardy extras
Add that to /etc/apt/sources.list
apt-get update
apt-get install wicd

Last edited by tredegar; 12-13-2008 at 01:04 PM.
 
Old 12-14-2008, 08:28 AM   #8
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Original Poster
Rep: Reputation: 51
Removed network manager and it STILL won't keep my settings. Even tried the /etc/init.d/networking restart after making the changes and rebooting. When the system reboots or I do the /etc/init.d/networking restart command it still doesn't give eth0 the IP address and settings. It's really weird b/c the system detects my NIC, the files contain the settings I want, but it just can't seem to put the 2 together. Any ideas? Am I missing anything else?

I don't need anything for wireless as my desktop isn't wireless. I'll keep that in mind if I get a decent laptop with wireless though.
 
Old 12-14-2008, 08:33 AM   #9
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Please post the outputs of (as root)
ifconfig

and post your interfaces file
 
Old 12-15-2008, 04:02 PM   #10
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Original Poster
Rep: Reputation: 51
I already posted the interfaces file contents in one of my previous posts. As for ifconfig...here's what it shows for eth0 BEFORE I have to manually input the IP address and gateway settings with the ifconfig command.

Code:
eth0      Link encap:Ethernet  HWaddr 00:11:5b:f1:fb:c7
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:21
 
Old 12-16-2008, 06:41 AM   #11
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
I already posted the interfaces file contents in one of my previous posts.
You did, but every time you fire up the NM GUI it seems to mess up this file: It changes it, often mistakenly.

I asked you again to post this file because I wanted to find out what NM had done to it. Please do not use NM, or, if you must, please check the interfaces file after you have closed MN down, or, preferably just uninstall it until we have this problem fixed. NM is currently seriously buggy.

Your interfaces file needs the auto line, which should bring it up at boot time:
Code:
auto lo
iface lo inet loopback


auto eth0
iface eth0 inet static
broadcast 192.168.1.255
address 192.168.1.6
netmask 255.255.255.0
gateway 192.168.1.1
Please edit it and save the changes.

Your /etc/resolv.conf file should read like this:
Code:
nameserver 192.168.1.1
Because that is the LAN IP of your router which should route DNS requests to your ISP's DNS server, and relay the result back.

This (nameserver in resolv.conf) is usually set for you automatically if you are using DHCP, but you have to set it manually if you prefer a static LAN IP.

Then do a
Code:
sudo /etc/init.d/networking restart
 
Old 12-16-2008, 09:39 AM   #12
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Original Poster
Rep: Reputation: 51
That fixed it, thanks!!

And yeah I have had NM uninstalled for a good few days now. I know I tried to use it when I first installed it, but it didn't seem to do any good either...so that's when I knew I had to manually edit the files.
 
Old 12-16-2008, 03:59 PM   #13
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Pleased you eventually got it working.

Manually editing files is strange to windows users, because win likes to hide how it "works".

It's often the fastest and simplest way to get linux to do what you want, because linux isn't ashamed to expose how it works, and there are (as you have discovered) a number of GUI "helpers", some of which are broken. The config files speak for themselves, and are generally very similar across distributions.
 
Old 12-16-2008, 08:55 PM   #14
Basslord1124
Member
 
Registered: Jun 2004
Location: KY
Distribution: Debian, Mint, Puppy
Posts: 507

Original Poster
Rep: Reputation: 51
Editting config files doesn't really bother me...I actually used Slackware before trying out Ubuntu. In fact, I have used Slackware for the past 2-3 years as my main desktop. I still kept Windows around for a few basic things, but 95% of the time I used Slackware. My thing is just getting used to the Debian way of things versus Slackware. The Debian packaging system is actually what made me change from Slackware....it just took me a while to realize how much better it was.

And yeah I noticed that the GUI tool NM was not cooperating...but I also knew that this was the most recent version of Kubuntu, so I wasn't expecting perfection and everything to be bug free. Command line is good, but I also enjoy command line scripts and tools. Slackware has a really cool command line based tool for networking (netconfig) that will configure networking just fine without any config file editting...assuming you know the settings you want. And even though this is the most recent version and has some bugs, I really have had very little issues with the system...like I said, it's just a matter of learning some of Debian/Ubuntu tricks since I am so used to Slack.
 
Old 01-22-2009, 04:37 PM   #15
dukeinlondon
Member
 
Registered: May 2003
Location: London
Distribution: kubuntu 8.10
Posts: 593
Blog Entries: 1

Rep: Reputation: 30
Network manager was done with laptops in mind, making it easier to juggle with multiple connections. There is no reason why it shouldn't have a 'fixed IP' and 'connect at boot' configuration options though but sadly it doesn't afaik

Last edited by dukeinlondon; 01-22-2009 at 04:39 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
static/crackling in Kubuntu Hardy col. mustard Linux - Hardware 7 07-03-2008 12:56 AM
Setting a static IP dreakon SUSE / openSUSE 2 10-02-2005 03:08 PM
Setting a static IP hongman Linux - Networking 6 02-22-2005 05:07 AM
Setting Static IP smurfix Debian 6 02-20-2005 03:07 PM
setting a static IP EMHagerty Linux - Networking 1 09-09-2004 03:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 01:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration