GNS3 / gns3-server

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

1.5: dynamips VM ignores changed console port #468

Closed ghost closed 8 years ago

ghost commented 8 years ago

After jeremy changed the console port range, on existing projects I can no longer connect to dynamips VMs. On QEMU VMs the change of the console port works.

The old console port 2001 is pushed to the server. 2016-03-30 10:50:53 DEBUG http_client.py:571 POST http://192.168.1.99:3080/v1/projects/262d0df4-c2d5-40fe-9c1c-f8fbf1c5dc0b/dynamips/vms {'name': 'R1', 'idlepc': '0x602467a4', 'ram': 128, 'startup_config': 'configs/i1_startup-config.cfg', 'disk0': 0, 'nvram': 256, 'sparsemem': True, 'console': 2001, 'slot0': 'GT96100-FE', 'idlemax': 500, 'auto_delete_disks': True, 'clock_divisor': 8, 'image_md5sum': '606484061b9e52e71d4f4ddab9af19e7', 'disk1': 0, 'iomem': 5, 'vm_id': 'bf43edf6-1d5a-408d-ae18-3262ec7c2e12', 'image': 'c3725-adventerprisek9-mz.124-25d.image', 'idlesleep': 30, 'mmap': True, 'system_id': 'FTX0945W0MY', 'dynamips_id': 1, 'exec_area': 64, 'platform': 'c3725', 'mac_addr': 'c201.056d.0000'}

The server replies that it uses port 5000

2016-03-30 10:50:54 DEBUG project.py:376 Event received: {'action': 'log.warning', 'event': {'message': 'TCP port 2001 is outside the range 5000-10000 on host 0.0.0.0. Port has been replaced by 5000'}}
2016-03-30 10:50:54 WARNING project.py:390 TCP port 2001 is outside the range 5000-10000 on host 0.0.0.0. Port has been replaced by 5000
Warning: TCP port 2001 is outside the range 5000-10000 on host 0.0.0.0. Port has been replaced by 5000
2016-03-30 10:50:54 DEBUG http_client.py:705 Decoding response from http://192.168.1.99:3080/v1/projects/262d0df4-c2d5-40fe-9c1c-f8fbf1c5dc0b/dynamips/vms response 201
2016-03-30 10:50:54 DEBUG http_client.py:712 {
    "auto_delete_disks": true,
    "aux": null,
    "clock_divisor": 8,
    "console": 5000,
    "disk0": 0,
    "disk1": 0,
    "dynamips_id": 1,
    "exec_area": 64,
    "idlemax": 500,
    "idlepc": "0x602467a4",
    "idlesleep": 30,
    "image": "c3725-adventerprisek9-mz.124-25d.image",
    "image_md5sum": "606484061b9e52e71d4f4ddab9af19e7",
    "iomem": 5,
    "mac_addr": "c201.056d.0000",
    "mmap": true,
    "name": "R1",
    "nvram": 256,
    "platform": "c3725",
    "private_config": "",
    "project_id": "262d0df4-c2d5-40fe-9c1c-f8fbf1c5dc0b",
    "ram": 128,
    "slot0": "GT96100-FE",
    "slot1": null,
    "slot2": null,
    "sparsemem": true,
    "startup_config": "configs/i1_startup-config.cfg",
    "system_id": "FTX0945W0MY",
    "vm_directory": "/opt/gns3/projects/262d0df4-c2d5-40fe-9c1c-f8fbf1c5dc0b/project-files/dynamips",
    "vm_id": "bf43edf6-1d5a-408d-ae18-3262ec7c2e12",
    "wic0": null,
    "wic1": null,
    "wic2": null
}
2016-03-30 10:50:54 INFO vm.py:184 R1 setting up and updating idlepc from '' to '0x602467a4'
2016-03-30 10:50:54 INFO vm.py:184 R1 setting up and updating image_md5sum from '' to '606484061b9e52e71d4f4ddab9af19e7'
2016-03-30 10:50:54 INFO vm.py:184 R1 setting up and updating nvram from '112' to '256'
2016-03-30 10:50:54 INFO vm.py:184 R1 setting up and updating startup_config from '' to 'configs/i1_startup-config.cfg'
2016-03-30 10:50:54 INFO vm.py:184 R1 setting up and updating console from 'None' to '5000'
2016-03-30 10:50:54 INFO vm.py:184 R1 setting up and updating auto_delete_disks from 'False' to 'True'
2016-03-30 10:50:54 INFO vm.py:184 R1 setting up and updating disk0 from '16' to '0'
2016-03-30 10:50:54 INFO vm.py:184 R1 setting up and updating mac_addr from 'None' to 'c201.056d.0000'

Nevertheless the dynamips VM listens on port 2001 for console connections, therefore a console connection from the GUI doesn't work:

gns3@gns3vm:~$ netstat -tna
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 192.168.1.99:2375       0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:3080            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:56141           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:2001            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:56141         127.0.0.1:39381         ESTABLISHED
tcp        0      0 192.168.1.99:3080       192.168.1.10:50220      ESTABLISHED
tcp        0      0 192.168.1.99:3080       192.168.1.10:50223      ESTABLISHED
tcp        0      0 192.168.1.99:3080       192.168.1.10:50221      ESTABLISHED
tcp        0      0 192.168.1.99:22         192.168.1.10:49807      ESTABLISHED
tcp        0      0 192.168.1.99:3080       192.168.1.10:50219      ESTABLISHED
tcp        0      0 127.0.0.1:39381         127.0.0.1:56141         ESTABLISHED
tcp        0    172 192.168.1.99:22         192.168.1.10:49449      ESTABLISHED
tcp        0      0 192.168.1.99:3080       192.168.1.10:50222      ESTABLISHED
tcp6       0      0 :::22                   :::*                    LISTEN
gns3@gns3vm:~$
grossmj commented 8 years ago

Hi,

Strange. What do you have with the following commands?

cat ~/.config/GNS3/gns3_server.conf 
cat ~/.config/GNS3/gns3_gui.conf | grep udp_

Thanks,

ghost commented 8 years ago

Dynamips runs on a GNS3VM server with a simple config:

gns3@gns3vm:~$ cat .config/GNS3/gns3_server.conf
[Server]
host = 0.0.0.0
port = 3080
images_path = /opt/gns3/images
projects_path = /opt/gns3/projects
#auth = True
#user = user
#password = pass
#ssl = True
#certfile = /home/gns3/.config/GNS3/ssl/server.cert
#certkey = /home/gns3/.config/GNS3/ssl/server.key
gns3@gns3vm:~$

I assume, you don't want the udp range, but you want the console range. So I did a grep on _range

/Users/behlers# cat .config/GNS3/gns3_gui.conf | grep _range
            "console_end_port_range": 5000,
            "console_start_port_range": 2001,
            "udp_end_port_range": 20000,
            "udp_start_port_range": 10000,
        "vmnet_end_range": 19,
        "vmnet_start_range": 10,
/Users/behlers#

That's still the old range. I then changed it to the new range:

/Users/behlers# cat ~/.config/GNS3/gns3_gui.conf | grep _range
            "console_end_port_range": 10000,
            "console_start_port_range": 5000,
            "udp_end_port_range": 20000,
            "udp_start_port_range": 10000,
        "vmnet_end_range": 19,
        "vmnet_start_range": 10,
/Users/behlers#

But that didn't help. When a project with a dynamips VM has the old console port 2001, it's started with that port on the server, even though in the GUI it's shown with console port 5000:

gns3@gns3vm:~$ sudo lsof -a -i -c dynamips
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
dynamips 5874 gns3    4u  IPv4  20071      0t0  TCP *:53150 (LISTEN)
dynamips 5874 gns3    5u  IPv4  20073      0t0  TCP localhost:53150->localhost:39151 (ESTABLISHED)
dynamips 5874 gns3    8u  IPv4  20074      0t0  UDP 192.168.1.99:10000->192.168.1.99:10002
dynamips 5874 gns3    9u  IPv4  20075      0t0  UDP 192.168.1.99:10003->192.168.1.99:10001
dynamips 5874 gns3   10u  IPv4  18397      0t0  TCP *:2001 (LISTEN)
gns3@gns3vm:~$

When I save the project and then reload it (save only doesn't help) it is started with the new console port 5000 and all is fine.

julien-duponchelle commented 8 years ago

It's fixed. Don't hesitate to comment again on the issue if you still have the problem.

Thanks for the bug report !