Relase dhcp but I have configured static IP [SOLVED]

Kernels & Hardware, configuring network, installing services

Relase dhcp but I have configured static IP [SOLVED]

Postby coppolino97 » 2018-06-14 09:39

Hello guys,
I have an Odroid, with 2 wifi cards.
They are working properly but I have a little issues with one of this wifi card.

I have configured two static IP of two different networks

Code: Select all
auto lo
iface lo inet loopback


auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.39
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1


#Seconda scheda WIFI
auto wlan1
allow-hotplug wlan1
iface wlan1 inet static
address 192.168.43.139
netmask 255.255.255.0
broadcast 192.168.43.255
gateway 192.168.43.1

#iface wlan1 inet dhcp



auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0



The problem is that if I digit ifconfig the wlan0 has not 192.168.1.39 but 192.168.1.148 (from DHCP server, there is not dhcp reservation on the server)
Code: Select all
wlan0     Link encap:Ethernet  HWaddr 74:da:da:5f:ff:d3
          inet addr:192.168.1.148  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::76da:daff:fe5f:ffd3/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2376 errors:0 dropped:3 overruns:0 frame:0
          TX packets:387 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:619037 (619.0 KB)  TX bytes:75343 (75.3 KB)

wlan1     Link encap:Ethernet  HWaddr 40:9b:cd:5a:f0:54
          inet addr:192.168.43.139  Bcast:192.168.43.255  Mask:255.255.255.0
          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)


Can I force to disable DHCP?
I am using wpa_supplicant for the two wifi connection and it works properly... the problem is the IP on the wlan0
Someone can help me?
Thanks
Last edited by coppolino97 on 2018-08-07 20:17, edited 1 time in total.
coppolino97
 
Posts: 13
Joined: 2018-06-05 15:23

Re: Relase dhcp but I have configured static IP

Postby bw123 » 2018-06-14 11:30

I don't know why that would happen with that interfaces file. If you bring it down and then back up, what happens? Do you see the dhcp request? What debian ver are you using, and are there any other network gui tools installed?

I'm not sure you should assign two separate default gateways like that, interfaces file needs one only? There are some threads on the board here about it.
User avatar
bw123
 
Posts: 3283
Joined: 2011-05-09 06:02
Location: TN_USA

Re: Relase dhcp but I have configured static IP

Postby wizard10000 » 2018-06-14 13:05

If you want a static IP

Code: Select all
auto wlan0  <-- this line needs to go away.
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.39
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1292
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: Relase dhcp but I have configured static IP

Postby coppolino97 » 2018-06-15 07:33

Thanks for your help!

I don't know why that would happen with that interfaces file. If you bring it down and then back up, what happens? Do you see the dhcp request? What debian ver are you using, and are there any other network gui tools installed?
I'm not sure you should assign two separate default gateways like that, interfaces file needs one only? There are some threads on the board here about it.

On this odroid there is a derived of Debian (Ubuntu Mate).

@wizard10000
Can you explain me what is the difference between this two command?

After some test I have typed "ip addr" and I have seen that on the Wlan0 there are two IP:
- DHCP ip address is the priority
- Static ip address is the secondary ip address (and I does not see with "ifconfig")

Thanks for support!
coppolino97
 
Posts: 13
Joined: 2018-06-05 15:23

Re: Relase dhcp but I have configured static IP

Postby None1975 » 2018-06-15 13:06

coppolino97 wrote:On this odroid there is a derived of Debian (Ubuntu Mate).

Hello. Or maybe it's easier to go to Ubuntu Mate forums and ask there because Ubuntu Mate is not pure Debian.
OS: Debian 9.4 / WM: Xmonad
Debian Wiki | DontBreakDebian, My config files in github
Linux User #607425
User avatar
None1975
 
Posts: 627
Joined: 2015-11-29 18:23
Location: Lithuania, Vilnius

Re: Relase dhcp but I have configured static IP

Postby wizard10000 » 2018-06-15 13:25

coppolino97 wrote:...@wizard10000
Can you explain me what is the difference between this two command?


Sure.

That "auto wlan0" tells the machine to use DHCP. If you're setting a static IP on the machine you don't want that :mrgreen:
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1292
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: Relase dhcp but I have configured static IP

Postby p.H » 2018-06-15 20:10

wizard10000 wrote:That "auto wlan0" tells the machine to use DHCP. If you're setting a static IP on the machine you don't want that

Wrong. "auto" tells to bring the interface up when the system boots.
p.H
 
Posts: 525
Joined: 2017-09-17 07:12

Re: Relase dhcp but I have configured static IP

Postby wizard10000 » 2018-06-15 21:48

p.H wrote:Wrong.


Yup. I stand corrected.
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1292
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: Relase dhcp but I have configured static IP

Postby Head_on_a_Stick » 2018-06-16 09:15

coppolino97 wrote:After some test I have typed "ip addr" and I have seen that on the Wlan0 there are two IP:
- DHCP ip address is the priority
- Static ip address is the secondary ip address (and I does not see with "ifconfig")

Rather than offer a vague (and confusing) summary, why not simply post the full output of `ip a` instead? That would be *much* more useful.

Can we also please see the output of
Code: Select all
systemctl list-unit-files --state=enabled --no-pager
User avatar
Head_on_a_Stick
 
Posts: 7904
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Relase dhcp but I have configured static IP

Postby coppolino97 » 2018-06-18 14:25

Thanks for your help!

This is the output after the command
systemctl list-unit-files --state=enabled --no-pager


Code: Select all
UNIT FILE                                 STATE

cups.path                                 enabled
accounts-daelon.service                        enabled
anacron-resume.service                        enabled
anacron.service                              enabled
autovto.service                              enabled
avahi-daelon.service                        enabled
avahi-dnsconfd.service                        enabled
binflt-support.service                        enabled
bluetooth.service                           enabled
brltty.service                              enabled
cpsnager.service                           enabled
cgproxy.service                              enabled
cron.service                              enabled
cups-browsed.service                        enabled
cups.service                              enabled
dbus-org.bluez .service                        enabled
dbus-oro.freedesktop.Avahi.service               enabled
dons-org.freedesktop.Node-lemma.service            enabled
display-lanaQer.service                        enabled
ffserver.service                           enabled
getty@.service                              enabled
gpsd.service                              enabled
lightdm.service                              enabled
lm-sensors.service                            enabled
ModemManager.service                        enabled
node-Ianager.service                        enabled
network-wireless@.service                     enabled
networking.service                           enabled
NetworkManager-wait--online.service               enabled
ofono.service                              enabled
pppd-dns.service                           enabled
resolvconf.service                           enabled
rsyslog.service                              enabled
setserial.service                           enabled
smartd.service                               enabled
smartmontools.service                        enabled
snapd.autoimport.service                            enabled   
snapd.service                                  enabled
snapd.system-shutdown.service                         enabled      
ssh.service                              enabled
sshd.service                              enabled   
syslog.service                              enabled   
systemd-timesyncd.service                     enabled
tlp-sleep.service                           enabled
tlp.service                                 enabled
ufw.service                              enabled
unattended-upgrades.service                     enabled
ureadahead.service                           enabled
whoopsie.service                           enabled
x11vnc.service                              enabled
zraI-config.service                           enabled
apport-foruard.socket                        enabled
avahi-daelon.socket                           enabled
cups.socket                              enabled
snapd.socket                              enabled
uuidd.socket                              enabled
reaote-fs.target                           enabled
apt-daily.timer                              enabled
snapd.refresh.timer                           enabled

58 unit files listed.


They are all enabled.
Thanks!
coppolino97
 
Posts: 13
Joined: 2018-06-05 15:23

Re: Relase dhcp but I have configured static IP

Postby Head_on_a_Stick » 2018-06-18 18:16

coppolino97 wrote:
Code: Select all
network-wireless@.service                     enabled

^ What is this and how did it get enabled?

I have a similarly-named custom unit file that I use to bring up my wireless connection and assign the IP addresses, does yours do that too?
Code: Select all
systemctl cat network-wireless@.service

^ This will show what is in the unit file.
Code: Select all
58 unit files listed.

Good grief, Ubuntu aren't shy about turning stuff on at boot, are they? :o
User avatar
Head_on_a_Stick
 
Posts: 7904
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Relase dhcp but I have configured static IP

Postby coppolino97 » 2018-06-21 09:48

All this service are enabled and I did not modify them.

The output of
systemctl cat network-wireless@.service

Code: Select all
odroid@odroid64:~$ systemctl cat network-wireless@.service
# /etc/systemd/system/network-wireless@.service
[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set dev %i up
ExecStart=/sbin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.con
ExecStart=/sbin/dhclient %i

ExecStop=/sbin/ip link set dev %i down

[Install]
WantedBy=multi-user.target



The output of ip addr is this one:
Code: Select all
odroid@odroid64:~$ ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 4096 qdisc noqueue state UNKNOWN group default
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 00:1e:06:35:60:9e brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 78:32:1b:04:30:84 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.99/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet 192.168.1.4/24 brd 192.168.1.255 scope global secondary wlan0
       valid_lft forever preferred_lft forever
    inet6 fe80::7a32:1bff:fe04:3084/64 scope link
       valid_lft forever preferred_lft forever
4: wlan1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 78:32:1b:04:31:d9 brd ff:ff:ff:ff:ff:ff
odroid@odroid64:~$


Can I disable dhcp client service? I have seen that is dhclient the service of dhcp.
Thanks for your help!
coppolino97
 
Posts: 13
Joined: 2018-06-05 15:23

Re: Relase dhcp but I have configured static IP

Postby Head_on_a_Stick » 2018-06-21 16:14

coppolino97 wrote:
Code: Select all
odroid@odroid64:~$ systemctl cat network-wireless@.service
# /etc/systemd/system/network-wireless@.service
[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link set dev %i up
ExecStart=/sbin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.con
ExecStart=/sbin/dhclient %i

ExecStop=/sbin/ip link set dev %i down

[Install]
WantedBy=multi-user.target

That is very strange — I wrote that file myself some time ago :? Convergent evolution, perhaps? :mrgreen:

Disable that unit file (dhclient.service is not enabled):
Code: Select all
# systemctl disable network-wireless@wlan{0,1}.service
User avatar
Head_on_a_Stick
 
Posts: 7904
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Relase dhcp but I have configured static IP

Postby coppolino97 » 2018-06-21 17:28

systemctl disable network-wireless@wlan{0,1}.service

Ok, I try this command! :D
But in this way Will not turn off all service about the wireless connectivity?

I have seen that with this command
Code: Select all
ps ax | grep [d]hcl

i have the dhclient active for my wlan0, So will I disable dhcp with before command right?
Probably I did not say you that I am using wpa_supplicant to manage the wireless connection of wlan0 and wlan1...becouse there are two wifi cards connected to this odroid.

Is it possible manage two wifi cards as client? They will connect to two different wireless network or it is better one as client and the other on as AP?
Thanks
coppolino97
 
Posts: 13
Joined: 2018-06-05 15:23

Re: Relase dhcp but I have configured static IP

Postby Head_on_a_Stick » 2018-06-21 17:36

coppolino97 wrote:But in this way Will not turn off all service about the wireless connectivity?

No because you also have networking.service (which is configured via /etc/network/interfaces) controlling your connections.

If you want to configure your connections via /etc/network/interfaces then networking.service is the only (network related) unit file that needs to be enabled.

Bolo wrote:I have seen that with this command
Code: Select all
ps ax | grep [d]hcl

i have the dhclient active for my wlan0.[/code]

Yes, that was called by network-wireless@wlan0.service and will stop when that unit file is disabled.

Bolo wrote:Is it possible manage two wifi cards as client? They will connect to two different wireless network or it is better one as client and the other on as AP?

I think so but I'm not sure, I've never tried to set up an access point.
User avatar
Head_on_a_Stick
 
Posts: 7904
Joined: 2014-06-01 17:46
Location: /dev/chair

Next

Return to System configuration

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable