mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 03:08:14 +00:00
Allow to select the default NAT interface in preferences for local server.
This commit is contained in:
parent
caa2bda71b
commit
6cec67f79f
@ -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
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user