How do i correct restart network-services in Debian?

Hello,

I would like to do follow steps.

  • Set a static IP-Adress on eth0 (For Testing)
  • Set DHCP on eth0
  • All steps should be done without a single reboot.

/etc/network/interfaces

  
   iface eth0 inet static
   address 192.0.2.7/24
   gateway 192.0.2.254

How do i perform the windows command "ipconfig /renew" on Debian ?

If i use "systemctl networking restart" -> "ip a" static ip doesnt show up
If i use "ifup eth0" -> "ip a" shows the correct ip address, why is this needed ? I never deactivated my interface eth0. This makes no sense to me i restartet the complete network service before.
What is the correct way to restart the network service ?

/etc/network/interfaces

  
   iface eth0 inet dhcp
 

How can i ask for a new ip form dhcp (what is the command)?
Do i need the "ifup eth0" here again ?

Regards,
Integer

There is no need to reboot Linux systems to change the IP address of set up network services.

systemctl networking restart is the correct way to restart your network. If the static IP doesn't show up, and you don't get any error messages, check the system log files for e.g. "eth0". ifup is not to be used explicitly by the user.
For using the DHCP services, the dhclient service must run. You may want to check its, the dhclient-script , and dhclient.conf man pages

According to man interfaces the "networking" service at startup runs ifup -a and that needs a line

auto eth0