Wednesday, February 23, 2022

[SOLVED] How to restart my network properly after binding two ips with single nic in debian?

Issue

I have binded two ips with single nic (Network Interface Card) in debian this way.

step 1:

vim /etc/network/interfaces into the following format:

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.100
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255
auto eth0:1
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1
network 192.168.1.0
broadcast 192.168.1.255

Now 192.168.1.100 and 192.168.1.100 are all binded with my local nic.

step2: vim /etc/network/ifstate into the following format:

lo=lo
eth0=eth0
eth0:1=eth0:1

It is time to restart my network now.

 /etc/init.d/networking restart
[....] Running /etc/init.d/networking restart is deprecated because it may not r[warnble some interfaces ... (warning).
[....] Reconfiguring network interfaces...RTNETLINK answers: File exists
Failed to bring up eth0.
Ignoring unknown interface eth0:1=eth0:1.
done.

ifdown eth0 && ifup eth0
ifdown: interface eth0 not configured
RTNETLINK answers: File exists
Failed to bring up eth0.

The two ip have been binded with single NIC when to reboot my pc.
I want to know the proper way to restart networking not to reboot it.


Solution

Typically to stop/start/restart the network interface on Debian:

/etc/init.d/networking stop
/etc/init.d/networking start
/etc/init.d/networking restart

To verify changes after making changes and restarting:

ifconfig -a

https://wiki.debian.org/Bonding



Answered By - l'L'l
Answer Checked By - Marilyn (WPSolving Volunteer)