From 6cec67f79f7cd811153f859bea385e722cbdc328 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 26 Mar 2018 14:23:01 +0700 Subject: [PATCH] Allow to select the default NAT interface in preferences for local server. --- conf/gns3_server.conf | 2 +- gns3server/compute/builtin/nodes/nat.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/gns3_server.conf b/conf/gns3_server.conf index 7d60a982..bcf188a1 100644 --- a/conf/gns3_server.conf +++ b/conf/gns3_server.conf @@ -45,7 +45,7 @@ allowed_interfaces = eth0,eth1,virbr0 ; Specify the NAT interface to be used by the NAT node ; Default is virbr0 on Linux (requires libvirt) and vmnet8 for other platforms (requires VMware) -nat_interface = vmnet10 +default_nat_interface = vmnet10 [VPCS] ; VPCS executable location, default: search in PATH diff --git a/gns3server/compute/builtin/nodes/nat.py b/gns3server/compute/builtin/nodes/nat.py index 387a8f61..35984315 100644 --- a/gns3server/compute/builtin/nodes/nat.py +++ b/gns3server/compute/builtin/nodes/nat.py @@ -36,12 +36,12 @@ class Nat(Cloud): def __init__(self, name, node_id, project, manager, ports=None): if sys.platform.startswith("linux"): - nat_interface = Config.instance().get_section_config("Server").get("nat_interface", "virbr0") + nat_interface = Config.instance().get_section_config("Server").get("default_nat_interface", "virbr0") if nat_interface not in [interface["name"] for interface in gns3server.utils.interfaces.interfaces()]: raise NodeError("NAT interface {} is missing, please install libvirt".format(nat_interface)) interface = nat_interface else: - nat_interface = Config.instance().get_section_config("Server").get("nat_interface", "vmnet8") + nat_interface = Config.instance().get_section_config("Server").get("default_nat_interface", "vmnet8") interfaces = list(filter(lambda x: nat_interface in x.lower(), [interface["name"] for interface in gns3server.utils.interfaces.interfaces()])) if not len(interfaces):