cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
374
Views
5
Helpful
3
Replies
Beginner

Expose Netsim to external interface - can it be done?

I would like to expose Netsims to SSH sessions external to the host.  Of course you can ssh to a Netsim from the linux shell (within the same host), but I would like to be able to connect to a Netsim CLI from outside the host.  Is that possible? if so, how could it be done?  Thanks

Everyone's tags (4)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Beginner

Re: Expose Netsim to external interface - can it be done?

OK, got this work.  Had to use a little iptables magic from the linux shell.  I had to imput these two commands:


nsoadmin@nso-1D-workshop:~/ncs-run$ sudo iptables -t nat -I PREROUTING -p tcp -d 192.168.88.100/24 --dport 10022 -j DNAT --to-destination 127.0.0.1:10022

nsoadmin@nso-1D-workshop:~/ncs-run$ sudo sysctl -w net.ipv4.conf.ens32.route_localnet=1

 

I was then able to ssh admin@192.168.88.100 -p 10022 and get right into the netsim.  

 

 

Everyone's tags (4)
3 REPLIES 3
Cisco Employee

Re: Expose Netsim to external interface - can it be done?

So by external interface, you mean a computer/node that resides outside of the NSO's server?

 

I personally have not tried that myself.. I would think to access the netsim device and see if it can ssh to the remote host. I assume it wouldn't since netsim device's begin with 127.0.0.1. You could change the device's address to an IP within the same subnet of the external host and verify.

 

Have you tried this or other methods?

Cisco Employee

Re: Expose Netsim to external interface - can it be done?

In your netsim instance directory, say netsim/ios/ios0/ there is a file confd.conf (and a lot of other little goodies for the curious!). By modifying that file you can modify how the netsim works. 

 

For your use-case, look under cli/ssh, you can set both port and a field called ip. You can look in man ncs.conf for an explanation of what the settings do.

 

After changing confd.conf you must restart the netsim instance.

 

However, on a quick test I just ran it does seem like it binds to 0.0.0.0 by default, so I am not entirely sure why it doesn't work for you.

Highlighted
Beginner

Re: Expose Netsim to external interface - can it be done?

OK, got this work.  Had to use a little iptables magic from the linux shell.  I had to imput these two commands:


nsoadmin@nso-1D-workshop:~/ncs-run$ sudo iptables -t nat -I PREROUTING -p tcp -d 192.168.88.100/24 --dport 10022 -j DNAT --to-destination 127.0.0.1:10022

nsoadmin@nso-1D-workshop:~/ncs-run$ sudo sysctl -w net.ipv4.conf.ens32.route_localnet=1

 

I was then able to ssh admin@192.168.88.100 -p 10022 and get right into the netsim.  

 

 

Everyone's tags (4)