04-27-2018 10:44 AM - last edited on 08-10-2022 02:39 PM by Paul Zimmerman
From 2.0.30, the privilege of LXC is downgraded to user level by the request from our SP customer.
The "pcamap show" command in LXC will not show the true value of MAC address.
bash-3.2# pcamap show
MAC_ADDR: 00:00:00:00:00:00
MODEL_NUM:
VERSION_ID:
MB_SERIAL_NUM:
MB_ASSEMBLY_NUM:
MB_REVISION_NUM:
SYSTEM_SERIAL_NUM:
MODEL_REVISION_NUM:
While the IXM gateway is running on the standalone mode, If you still need to read the MAC address from LXC, we suggest to create a python script in LXC to initiate SSH to the host, execute the CLI and return the result.
Steps and Python Scripts
Step 1
From host CLI, firstly you need to create secret, username, password and generate SSH crypto key
1) (config)#enable secret cisco
2) (config)#username cisco password cisco
3) (config)#crypto key generate rsa
Step 2
Create a python script (such as get_mac.py) in LXC
examples
bash-3.2# more get_mac.py
#!/usr/bin/python
##################################################################
#Name of script : get_mac.py
#usage : to get the device MAC address
#args : ssh-username , ssh-password and privileg-epassword
#usage example : python get_mac.py cisco cisco cisco
####################################################################
#!/usr/bin/python
import re
import pexpect
import sys
username=sys.argv[1]
password=sys.argv[2]
adminsecpassword=sys.argv[3]
cmd ='ssh '+username+'@10.0.3.1'
p=pexpect.spawn(cmd)
p.expect('password:')
p.sendline(password)
p.sendline("\n")
p.sendline("\n")
p.sendline("\n")
p.sendline("\n")
p.sendline("\n")
p.expect('>')
p.sendline("enable\n")
p.expect('Password:')
p.sendline(adminsecpassword)
p.expect('#')
p.sendline("show interfaces")
p.expect('#')
config=p.before
#print("Config Output ----\n %s" %config)
#host_ip = re.search(r'ip address (\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)', config)
mac_addr = re.search(r'address is (([\dA-F]{2})[-:]([\dA-F]{2})[-:]([\dA-F]{2})[-:]([\dA-F]{2})[-:]([\dA-F]{2})[-:]([\dA-F]{2}))', config)
print mac_addr.group(1)
p.sendline("request shell exit")
Step 3
Run this script in LXC and get the return value of MAC
bash-3.2# python get_mac.py cisco cisco cisco
00:5F:86:5C:46:00
05-15-2018 10:49 PM
Hi,
How can i reset the password on the standalone GW? i tried to configure SSH but seems that it failed.
i tried the reset button for 1 minute hold, and still didnt work.
thanks
05-16-2018 08:46 AM
Press the button and hold on for a minute and then release it, please try again.
05-16-2018 08:50 AM
Hi Jun,
Everyone told me to do so, I did it like ten times! Either it's my finger problem or hardware issue.
If you can, please share the console logs on what to expect when a successful reset happens!
Thank you.
05-16-2018 08:53 AM
All right, please open case in Cisco TAC.
05-16-2018 08:54 AM
Thanks.
05-16-2018 09:46 AM
Did it happen for all your units or just a specific one?
05-16-2018 09:49 AM
I have only one, this is a PoC I got from Cisco team.
When the time came for field installation, I tried to configure SSH so I can access it remotely, and this is when I got locked out.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide