cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2050
Views
0
Helpful
7
Replies

How to read Cisco IXM Gateway MAC address from LXC in 2.0.30 Standalone Mode

jwen2
Cisco Employee
Cisco Employee

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

7 Replies 7

yahya.jaber
Level 1
Level 1

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

jwen2
Cisco Employee
Cisco Employee

Press the button and hold on for a minute and then release it, please try again.

yahya.jaber
Level 1
Level 1

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.

jwen2
Cisco Employee
Cisco Employee

All right, please open case in Cisco TAC.

yahya.jaber
Level 1
Level 1

Thanks.

jwen2
Cisco Employee
Cisco Employee

Did it happen for all your units or just a specific one?

yahya.jaber
Level 1
Level 1

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.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: