Posted on August 28, 2018 5:14 pm
 |  Asked by Nilesh Bhadane
 |  1434 views
RESOLVED
0
0
Print Friendly, PDF & Email

Hi,

I have build vEOS using virtualbox on my local mac machine.
I am trying to build agent on vEOS using https://github.com/aristanetworks/EosSdk/wiki/Quickstart:-Hello-World

I was trying to copy
scp HelloWorld.py admin@localhost:/mnt/flash

I have setup the vEOS password using -> username privilege 15 secret

But, it is failing all the time.

PFA.

I am not sure what is the issue. Can you please help me?

Attachments:
0
Posted by Robert Lang
Answered on August 28, 2018 5:23 pm

Nilesh,
You may need to add the following to your config. This will put you in privileged exec mode automatically.

aaa authorization exec default local

Rob

1
Posted by Alexandru
Answered on August 28, 2018 5:30 pm

Make sure you are allowing no password logins if your user has no password configured.

aaa authorization exec default local
aaa authorization commands all default local
aaa authentication policy local allow-nopassword-remote-login
username admin privilege 15 role network-admin nopassword

The above snippet should allow the admin user to copy the files correctly via scp.

Even after these commands, its not working.

(Nilesh Bhadane at August 28, 2018 6:09 pm)
0
Posted by Nilesh Bhadane
Answered on August 28, 2018 6:07 pm

Thanks Robert & Alexandru for your reply.

I tried all the above commands. But it’s still not working.

I am using scp command using localhost & IP

scp /Users/nbhadane/Desktop/HelloWorld.py admin@localhost:/home/admin
scp HelloWorld.py admin@10.224.53.237:/mnt/flash/

PFA.

Attachments:
1
Posted by Nilesh Bhadane
Answered on August 28, 2018 6:19 pm

Is there any alernative to copy HelloWorld.py to /mnt/flash?

From the output you’ve sent it seems that you are trying to copy the file locally on your macOS; macOS will think localhost is itself as defined in /etc/hosts and not the switch.
Can you try using the IP address of the switch.?
Are you able to SSH using admin and no password? Can you ping the VMs IP? What type of virtual network you’ve used?

Alternatively, you can just drop down to bash, go to /mnt/flash/, create a new file and copy paste the code from github there:

bash
cd /mnt/flash
vi HelloWorld.py

:wq

(Tamas Plugor at August 28, 2018 7:02 pm)

I used ifconfig & ip addr show commnad on switch to get IP address -> output is inet 127.0.0.1

I am using Bridget network

I am able to create file /mnt/flash/ folder using vi HelloWorld.py. But virtualbox VM is not allowing to paste. So I have to type each line of code.

(Nilesh Bhadane at August 29, 2018 2:52 am)

Yes, because consoles don’t accept copy-paste.
So, 127.0.0.1 is your localhost IP, which is only locally significant, you won’t be able to copy to that IP (every operating system has that locally set up). You need to add an IP address from the same subnet as your bridged network on the vNIC. If you chose Adapter 1 as your Bridged adapter in virtualbox, that will map to interface management1 on vEOS-lab, so you can go to the CLI and configure the IP either manually or using DHCP.
e.g.
localhost#conf
localhost(config)#interface ma1
localhost(confiig-if-Ma1)#ip address dhcp

or
localhost(config-if-Ma1)#ip address 192.168.0.45/24

just make sure that’s the same subnet as what you have on your macbook

after that, verify that the IP is configured and the interface is up
#show ip interface brief

if status and protocol is UP and the IP is seen in the show output, check if you can ping the IP of your laptop and vice-versa
after this you should be able to SSH/SCP

(Tamas Plugor at August 29, 2018 6:56 pm)

Thank you so much, Tamas. It is working now. I can copy a file from my local to switch.

(Nilesh Bhadane at August 29, 2018 8:39 pm)
0
Posted by shalin
Answered on August 28, 2018 6:35 pm

The above suggested methods should work, However easiest way to copy the python file is, Open a text editor (eg vi) in your bash and copy the contents of the file from your existing script, as follows:-

DC1-SP01(s1)#bash

Arista Networks EOS shell

[shalin@DC1-SP01 ~]$ vi HelloWorld.py

0
Posted by edmund
Answered on August 28, 2018 6:56 pm

Can you ssh from your local mac to veos?
ssh’ing to localhost connects to your mac, not veos so it looks like you haven’t set this up.

This link gives some options
https://askubuntu.com/questions/48436/how-to-scp-a-file-from-mac-ubuntu-virtualbox
as well as
https://eos.arista.com/veos-and-virtualbox/

0
Posted by Aesha Parikh
Answered on August 29, 2018 7:40 pm

Hi Nilesh,

Below steps worked for me.

On Arista Veos, give management interface an ip address from 10.0.2.0/24. Lets say 10.0.2.15/24. Add aaa configs if not added already.

aaa authorization exec default local
aaa authorization commands all default local
aaa authentication policy local allow-nopassword-remote-login
username admin privilege 15 role network-admin nopassword
From vm netowork settings, click advanced and add port forwarding rule.

From host machine
scp -P 3022 test.txt admin@localhost:/mnt/flash/
Password:

Alternately, you can also try to pull files from your host machine.
On vm, add default route pointing to 10.0.2.2

From bash on vm:
scp aesha@host_ip:/Users/aesha/Downloads/test.txt /mnt/flash/

Thank you, Aesha.
How to default route pointing to 10.0.2.2 on vEOS?

(Nilesh Bhadane at August 29, 2018 8:23 pm)

From switch config mode:
switch(config):ip route 0.0.0.0/0 10.0.2.2

(Aesha Parikh at August 29, 2018 9:49 pm)

Thank you

(Nilesh Bhadane at August 29, 2018 10:18 pm)

Thank you

(Nilesh Bhadane at August 30, 2018 2:03 am)

Post your Answer

You must be logged in to post an answer.