1

The scenario is I want to use Expect to automatize some daily routine tasks to check log servers with private IP addresses. Telnet/SSH to those servers from a Linux server with public IP address won't work. Any way to set up a workable linux environment to run shell scripts + install packages (eg. expect) + get private IP address from the PC? Simplest method which can achieve the goal is welcomed.

3
  • Not sure I understand what your question actually is. You'd just need a server in the same private network. I have not used Expect but I have used pexpect to accomplish some automation on our systems. Works great. Dec 20, 2011 at 3:32
  • Thanks for introducing pexpect. Let me explain my question some more. I need to check log servers in corporate's intranet (therefore private IP address 10.x.x.x). Previously I telnet/ssh them from putty/Windows inside this private network, this works. Later on I want to automate this procedure by expect/Linux. But I only have Linux with public IP address, I need to set up a linux server which have a private IP to be able to login other log servers. I cannot assign private IP, but it's possible to use existing PC's private IP by setting a linux server on it.
    – Andrew
    Dec 20, 2011 at 3:46
  • 2
    You can grab cygwin to emulate a "Linux" environment on your Winbox for testing this stuff. It has a nice setup/package tool that has to have expect in it. GL!
    – Tim
    Dec 20, 2011 at 3:48

2 Answers 2

3

Two simplest options:

  1. Install cygwin on your PC. Install the expect package.

  2. Set up a clothed-metal hypervisor (e.g. VMWare Player) on your PC. Create a virtual machine with sufficient system resources and install your preferred Linux distribution. Configure it for bridged networking. Install the expect package.

1
  • Option 1 works, simple and sound. For option 2 VM solution, Use bridge networking to inherit the IP address is actually what I want to confirm/know.
    – Andrew
    Dec 20, 2011 at 7:26
2

The simplest way to do this if you want to use an external server is to create a VPN between your public Linux server and the internal corporate network. Look into installing the open source OpenVPN product on your server and creating a VPN tunnel into your corporate network. This is not an encouragement to use their commercial service. What you want to do is create a VPN tunnel from your Linux server to your corporate network, regardless of what VPN server software you use.

Another option is to create port forwarding rules on the corporate network's firewall for your expect server to forward through to the private log servers. Make absolutely sure that you deny all traffic from all IP addresses except the public IP of your Linux expect server. This isn't ideal, however.

Finally, you could create a bastion server in the DMZ that collects information, and then passes it off to the external expect server. That's the most complex option, and doesn't offer you many advantages over the other two options that I can think of. It also requires another server be added to the equation and more servers equals more management and more management equals less sleep.

Put a VPN server on your public expect box, connect securely to your internal corporate network and then you can expect to find success.

Yes, I am ashamed of my pun.

3
  • OpenVPN is a commercial service. I would rather not involve public Linux server if other method works. I will try cygwin @Tim.
    – Andrew
    Dec 20, 2011 at 4:12
  • @beicha The commercial service that OpenVPN offers is only a small part of what OpenVPN is. When someone mentions "OpenVPN" they are likely referring to the open source OpenVPN package. That was the context that I was speaking. I've updated my answer.
    – Wesley
    Dec 20, 2011 at 4:24
  • Thanks for the elaboration. I'm sorry I might describe the problem too complex. Actually a (simulated) Linux environment on current PC would do for my case. The answer is a good reference for whom want to use an external server is to create a VPN between public Linux server and the internal corporate network. :)
    – Andrew
    Dec 20, 2011 at 7:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .