LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-25-2015, 02:26 AM   #1
smilingfrog
LQ Newbie
 
Registered: Apr 2011
Distribution: debian 8, Mint 17
Posts: 9
Blog Entries: 1

Rep: Reputation: 1
Unable to boot with static IP address


I can't tell what I'm doing wrong here.
I have searched this forum and google, but have not come up with an answer. The problem seems common with raspberry pi versions of debian.

When I boot, my laptop is assigned a dynamic address.
I have cleared the address allocation from the router, but it assigns new addresses on reboot.

Code:
$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

#auto eth0
#allow-hotplug eth0
#iface eth0 inet dhcp

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
    address 192.168.1.98
    netmask 255.255.255.0
    network 192.168.1.0
    broadcask 192.168.1.255
    gateway 192.168.1.1


dns-nameservers 8.8.8.8
dns-nameservers 8.8.4.4
In order for the static address to take, I have to ifdown/ifup the wifi

Code:
$ ifconfig
eth0      Link encap:Ethernet  HWaddr 00:1d:09:5e:28:ca  
          UP 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:16 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:182 errors:0 dropped:0 overruns:0 frame:0
          TX packets:182 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:34857 (34.0 KiB)  TX bytes:34857 (34.0 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:1f:3c:73:74:4e  
          inet addr:192.168.1.120  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21f:3cff:fe73:744e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:123 errors:0 dropped:0 overruns:0 frame:0
          TX packets:152 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:19758 (19.2 KiB)  TX bytes:24866 (24.2 KiB)

$ sudo ifdown wlan0
$ sudo ifup wlan0
$ ifconfig

eth0      Link encap:Ethernet  HWaddr 00:1d:09:5e:28:ca  
          UP 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:16 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:207 errors:0 dropped:0 overruns:0 frame:0
          TX packets:207 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:41167 (40.2 KiB)  TX bytes:41167 (40.2 KiB)

wlan0     Link encap:Ethernet  HWaddr 00:1f:3c:73:74:4e  
          inet addr:192.168.1.98  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::21f:3cff:fe73:744e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:253 errors:0 dropped:0 overruns:0 frame:0
          TX packets:272 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:34996 (34.1 KiB)  TX bytes:47462 (46.3 KiB)
What am I missing?

Code:
$ uname -a
Linux laptop 4.2.0-0.bpo.1-amd64 #1 SMP Debian 4.2.6-3~bpo8+2 (2015-12-14) x86_64 GNU/Linux
 
Old 12-25-2015, 04:13 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,259

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
Are you master in the wifi? Are you the AP? If not, you ask for an IP when logging in, don't you?
 
Old 12-26-2015, 11:54 AM   #3
smilingfrog
LQ Newbie
 
Registered: Apr 2011
Distribution: debian 8, Mint 17
Posts: 9

Original Poster
Blog Entries: 1

Rep: Reputation: 1
Quote:
Originally Posted by business_kid View Post
Are you master in the wifi? Are you the AP? If not, you ask for an IP when logging in, don't you?
I'm not sure what you mean by master in the wifi, or AP, sorry.
All I can tell is that when I boot the laptop it acquires a dynamically assigned address, and then when I cycle the ifdown/ifup, I get the static address.
 
Old 12-27-2015, 02:43 AM   #4
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,259

Rep: Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321Reputation: 2321
If it needs a static ip, wire it in with Cat5 or Cat6 network cable. You are not the AP by default. So you log in, and get assigned an ip. But you alter that with ifdown & ifup. I wonder about routing.
Do you add any stati routes.
 
Old 12-27-2015, 01:13 PM   #5
v4r3l0v
Member
 
Registered: Dec 2013
Posts: 136

Rep: Reputation: Disabled
If your goal is to have static IPs on boot, configure your connections accordingly: give those connections bootproto=static and reserve those addresses with the DHCP of the router. DHCP gives out IPs in a range, so at the web interface of your router reserve those IP addresses for your devices. Otherwise, IP addresses given by DHCP will override your static IP settings.
 
Old 12-27-2015, 03:06 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
bootproto=static is only valid for Red Hat/CentOS/Fedora distributions.

I'm lazy, I keep my laptop configured as DHCP and then configure the router to always assign the same IP address. Most home router's DHCP server can assign the same address based upon the devices MAC. That way I do not have to change settings when I travel.

Is installed network-manager and running? If so that could be the reason wlan is using DHCP at boot but when you run ifup it is assigned a static IP address.
 
Old 12-28-2015, 12:54 AM   #7
smilingfrog
LQ Newbie
 
Registered: Apr 2011
Distribution: debian 8, Mint 17
Posts: 9

Original Poster
Blog Entries: 1

Rep: Reputation: 1
So I do have Network Manager running, but everything I have read says that the above configuration should override that. I configured the file as follows:
Code:
$ cat /etc/NetworkManager/NetworkManager.conf 
[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=true
Still I get DHCP when I boot. I don't want to have to hard wire to the network; the point is I want a static wireless IP address. Do I need Network Manager? How do I disable it, and what are the consequences of that?
 
Old 12-28-2015, 12:55 AM   #8
smilingfrog
LQ Newbie
 
Registered: Apr 2011
Distribution: debian 8, Mint 17
Posts: 9

Original Poster
Blog Entries: 1

Rep: Reputation: 1
Quote:
Originally Posted by michaelk View Post
I'm lazy, I keep my laptop configured as DHCP and then configure the router to always assign the same IP address. Most home router's DHCP server can assign the same address based upon the devices MAC. That way I do not have to change settings when I travel.
I mean I can do this; I'm just obsessive and I want to know why it's not working as an assigned static address.
 
Old 12-28-2015, 01:30 AM   #9
v4r3l0v
Member
 
Registered: Dec 2013
Posts: 136

Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
bootproto=static is only valid for Red Hat/CentOS/Fedora distributions.

I'm lazy, I keep my laptop configured as DHCP and then configure the router to always assign the same IP address. Most home router's DHCP server can assign the same address based upon the devices MAC. That way I do not have to change settings when I travel.

Is installed network-manager and running? If so that could be the reason wlan is using DHCP at boot but when you run ifup it is assigned a static IP address.
Given. I am not familiar with Debian's NIC config file syntax. Do you see anywhere in that file snippet the OP posted that a NIC is available at boot? The equivalent of ONBOOT=yes on Red Hat-ish systems?
Disabling Network Manager isn't an option since other parts (like firewalld) depend on it. So it would be better to just reserve those static IPs with the DHCP server and make NICs available on boot.
 
Old 12-28-2015, 07:49 AM   #10
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,680

Rep: Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894Reputation: 5894
By using the network manager GUI wizard you can manually configure a network adapter and assign it a static IP address.
 
  


Reply

Tags
debian jessie, networking



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
System running two nic with static public ip address. Unable to ping primary (eth0) Robbin Linux - Networking 3 11-18-2011 08:06 AM
setting static IP on linux PCs with no static IP address from internet provider? solvetek Linux - Networking 1 10-22-2011 08:04 AM
Unable to acquire IP address at boot after upgrade to Fedora 9 openSauce Linux - Networking 7 11-22-2008 03:19 AM
Set IP address to static from DHCP assigned address jborn Linux - Networking 4 02-02-2007 08:38 PM
[SOLVED] Converting static IP-address to dynamic IP-address Blue_Ice Linux - Networking 3 07-20-2006 03:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:47 PM.

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