gns3-server icon indicating copy to clipboard operation
gns3-server copied to clipboard

docker : GNS3 replaces the file /etc/network/interfaces ?

Open Raizo62 opened this issue 2 years ago • 7 comments

Hi

I have a docker template which contains his own /etc/network/interfaces.

When we add this tempalte on the lab, GNS3 creates in this image a new file /etc/network/interfaces.

Is it a bug or a choose of GNS3 Team ?

Raizo62 avatar Mar 26 '22 08:03 Raizo62

That's a feature.

Normally Docker does the network setup for the containers, so Docker images don't need to do anything for setting up the network. In case of GNS3 the network setup is not done by Docker but by GNS3 by injecting a busybox binary. That uses the /etc/network/interfaces file. As this configuration file is normally not present in a Docker image, it is added by GNS3.

b-ehlers avatar Mar 26 '22 10:03 b-ehlers

Thank you for the answer.

So, GNS3 can perhaps create the file /etc/network/interfaces only if it doesn't exist ?

Raizo62 avatar Mar 27 '22 16:03 Raizo62

I suppose that GNS3 can't know if the docker VM contains the file "/etc/network/interfaces" before to start it. If you add a option in the GNS3 to not create the file, GNS3 will not have a file to edit with the menu "Edit config"

Or do as dynamips/IOU ("initial startup config") : add an option to choose our own file to use

Raizo62 avatar Apr 13 '22 17:04 Raizo62

Or do as dynamips/IOU ("initial startup config") : add an option to choose our own file to use

This would be the simplest to implement I think.

grossmj avatar Apr 21 '22 07:04 grossmj

Docker needs really an interface to customize the network interface :

  1. If the docker VM starts with systemd, and the network interface starts eth0 with dhcp, then eth0 asks IP at boot by systemd. But in init.sh, GNS3server does also a "ifup -a -f" . Also eth0 asks twice an IP, then have 2 IP.

  2. GNS3 adds "hostname Name" in "/etc/network/interfaces". This keyword is useful with udhcpd, but useless with dhclient (by default in Debian) (I haven't see any trames with "Name"). Luckily there is no error message, but we have a useless keyword to explain to our students ;-)

Raizo62 avatar Jul 02 '22 11:07 Raizo62

An other idea is :

  • A "BEGIN" box text
  • A "INTERFACE" box text for 1 interface based on a variable for the name of the interface and the name of the VM (and perhaps others variables)
  • A "END" box text.

GNS3 creates the file "/etc/network/interfaces" with these texts ("INTERFACE" box text is called for each interface).

  • With a check box to use instead the default "/etc/network/interfaces" of GNS3.
  • And a check box to do the "ifup -a -f"

Raizo62 avatar Jul 03 '22 09:07 Raizo62

it's not sufficient : some network programs are started by scripts in /etc/network/if-up.d, ... (example : wpasupplicant)

An idea is to add also an option to choose our own archive file whose contains the files of the folder /etc/network Be careful : the uncompress must manage symbolic links

Raizo62 avatar Aug 23 '22 07:08 Raizo62