GNS3 / gns3-server

GNS3 server
GNU General Public License v3.0
798 stars 262 forks source link

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

Open Raizo62 opened 2 years ago

Raizo62 commented 2 years ago

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 ?

ghost commented 2 years ago

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.

Raizo62 commented 2 years ago

Thank you for the answer.

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

Raizo62 commented 2 years ago

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

grossmj commented 2 years ago

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.

Raizo62 commented 2 years ago

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 commented 2 years ago

An other idea is :

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

Raizo62 commented 2 years ago

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