Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Relase dhcp but I have configured static IP [SOLVED]

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Relase dhcp but I have configured static IP [SOLVED]

#1 Post by coppolino97 »

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.
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: Relase dhcp but I have configured static IP

#2 Post by bw123 »

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.
resigned by AI ChatGPT

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Relase dhcp but I have configured static IP

#3 Post by coppolino97 »

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!
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

User avatar
None1975
df -h | participant
df -h | participant
Posts: 1388
Joined: 2015-11-29 18:23
Location: Russia, Kaliningrad
Has thanked: 45 times
Been thanked: 65 times

Re: Relase dhcp but I have configured static IP

#4 Post by None1975 »

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 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github

p.H
Global Moderator
Global Moderator
Posts: 3049
Joined: 2017-09-17 07:12
Has thanked: 5 times
Been thanked: 132 times

Re: Relase dhcp but I have configured static IP

#5 Post by p.H »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Relase dhcp but I have configured static IP

#6 Post by Head_on_a_Stick »

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
deadbang

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Relase dhcp but I have configured static IP

#7 Post by coppolino97 »

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!
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Relase dhcp but I have configured static IP

#8 Post by Head_on_a_Stick »

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
deadbang

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Relase dhcp but I have configured static IP

#9 Post by coppolino97 »

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!
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Relase dhcp but I have configured static IP

#10 Post by Head_on_a_Stick »

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
deadbang

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Relase dhcp but I have configured static IP

#11 Post by coppolino97 »

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
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Relase dhcp but I have configured static IP

#12 Post by Head_on_a_Stick »

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.
deadbang

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Relase dhcp but I have configured static IP

#13 Post by coppolino97 »

Don't worry about the two wireless cards.

Sorry but I did not understood a thing about this:
systemctl disable network-wireless@wlan{0,1}.service
Will this service not start again at boot with the command disable right?
Thanks!
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Relase dhcp but I have configured static IP

#14 Post by Head_on_a_Stick »

coppolino97 wrote:I did not understood a thing about this:
systemctl disable network-wireless@wlan{0,1}.service
Will this service not start again at boot with the command disable right?
Please read `man systemctl` to understand the enable and disable options.
deadbang

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Relase dhcp but I have configured static IP

#15 Post by coppolino97 »

I have read about systemctl and I have understood that

Code: Select all

 systemctl disable  example.service 
prevent that this service will start at boot

Thanks
:D
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Relase dhcp but I have configured static IP

#16 Post by Head_on_a_Stick »

Is the thread now [SOLVED]?

If so, please edit the title to reflect this.
deadbang

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Relase dhcp but I have configured static IP

#17 Post by coppolino97 »

Sorry @Head_on_a_Stick if I did not write a replay for a few days but I haven't time to try this on my odroid board.
Today I have tried with this command:

Code: Select all

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

When I have rebooted the device It did not connect automatically to my wifi network (it was configured before using wpa_supplicant)
I have typed
because in this moment the Wlan0 is in client mode and the Wlan1 is in AP mode.

Can't I simply comment the line

Code: Select all

ExecStart=/sbin/dhclient %i
in the file "systemctl cat network-wireless@.service"? :?

Thanks for your support! :D
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Relase dhcp but I have configured static IP

#18 Post by Head_on_a_Stick »

coppolino97 wrote:When I have rebooted the device It did not connect automatically to my wifi network (it was configured before using wpa_supplicant)
Do you have the interface listed in /etc/network/interfaces and is networking.service enabled and started correctly?

That should bring your connection up, or at least it would in Debian :mrgreen:
coppolino97 wrote:Can't I simply comment the line

Code: Select all

ExecStart=/sbin/dhclient %i
in the file "systemctl cat network-wireless@.service"? :?
If you want to use network-wireless@.service (rather than /etc/network/interfaces & networking.service) then replace the `dhclient` lines with commands to assign the IP addresses you want to use, like this:

Code: Select all

ExecStart=/bin/ip address add 192.168.1.39/24 broadcast 192.168.1.255 dev %i
ExecStart=/bin/ip route add default via 192.168.1.1
Just remember to remove the interface from /etc/network/interfaces to avoid conflicts.
deadbang

coppolino97
Posts: 115
Joined: 2018-06-05 15:23
Location: Italy
Has thanked: 2 times

Re: Relase dhcp but I have configured static IP

#19 Post by coppolino97 »

Thanks for your help!
I think that it is solved now!
:D :D
Lenovo T460 | 8Gbyte of RAM | Intel core i5 | SSD 250GB | Debian 12

Post Reply