Find Local IP of VPN Client

135

From the tag, I'm guessing you're running OpenVPN. OpenVPN uses either tun or tap tunnels, so that'd be tun0. Then your local IP (on the VPN) is 10.8.0.1, which is oddly (as in it strikes me as a configuration error) also the peer IP.

BTW: On Linux, ifconfig (friends) is basically obsolete and replaced by the ip command. ip addr ls will give you all the addresses.

Share:
135

Related videos on Youtube

KHP
Author by

KHP

Updated on September 18, 2022

Comments

  • KHP
    KHP over 1 year

    I have a PHP code that I used to call verifyOrder for an Endurance Block storage and it works fine for it. I would have thought it would work for Performance Block storage as well by just changing the price IDs. But it doesn't seem to be that simple. I see from SoftLayer that it's using following price IDs: 40678, 40688, 40798 So I replaced the price ID list with above along with package ID to 222. But I end up getting an error like this:

    PHP Fatal error:  Uncaught exception 'Exception' with message 'There was an error querying the SoftLayer API: Invalid pr
    ice Block Storage (Performance) (40678) provided on the order container.'
    

    And I have no idea why. Are there any good working sample of verifying order for a Performance Block storage order in SoftLayer?

    Below is the basic flow of code that I have for Endurance storage.

    $priceIds = array (
            45064,
            45104,
            45074,
            45124,
            46156 
    );
    
    $orderPrices = array();
    foreach ($priceIds as $priceId){
        $price = new stdClass();
        $price->id = $priceId;
        $orderPrices[] = $price;
    }   
    
    $osFormatType = new stdClass();
    $osFormatType->id = 12;
    $osFormatType->keyName = 'LINUX';
    
    $orderTemplate = new stdClass();
    $orderTemplate->location     = $location;
    $orderTemplate->packageId    = $packageId;
    $orderTemplate->osFormatType = $osFormatType;
    $orderTemplate->complexType  = 'SoftLayer_Container_Product_Order_Network_Storage_Enterprise';
    $orderTemplate->prices       = $orderPrices;
    $orderTemplate->quantity     = 1;
    
    $productOrderClient = SoftLayer_SoapClient::getClient
    (
            'SoftLayer_Product_Order',
            null,
            $apiUsername,
            $apiKey
    );
    
    $my_template = new SoapVar($orderTemplate, SOAP_ENC_OBJECT, 'SoftLayer_Container_Product_Order_Network_Storage_Enterprise', 'http://api.service.softlayer.com/soap/v3/');
    
    $result = $productOrderClient->verifyOrder($my_template);
    
    • phk
      phk over 7 years
      Could you please give us your ifconfig -a or ip a/ip l outputs? We could probably then tell you which interface is the VPN one.
    • Charles S
      Charles S over 7 years
      @phk I have edited my question with the ouput from ifconfig -a
  • KHP
    KHP over 8 years
    Thanks! Specifying the right container "SoftLayer_Container_Product_Order_Network_PerformanceStorag‌​e_Iscsi" did the trick.
  • Charles S
    Charles S over 7 years
    "Then your local IP (on the VPN) is 10.8.0.1, which is oddly (as in it strikes me as a configuration error) also the peer IP." Can you explain that further?
  • derobert
    derobert over 7 years
    The address after "P-t-P" is the peer (other side of the tunnel) address. Normally that'd be different—IP addresses are supposed to be unique. So you can, for example, ping «remote-ip» to ping across the tuinnel. Both sides of the tunnel are running the same IP address currently (or at least this machine believes so).
  • Charles S
    Charles S over 7 years
    So I probably need to change something in my openvpn config so that they are unique IP's? I am basically trying to ssh into server A directly by forwarding ports and I need to use the localIP of server A behind server B's VPN but I assume this might cause problems if the IP is not unique.
  • derobert
    derobert over 7 years
    Yes, that'd fail if the IPs aren't unique as you'd wind up ssh'ing into localhost instead of the other end. You're looking for the ifconfig line in your OpenVPN config.
  • Sergey
    Sergey over 3 years
    So we basically should use "ip addr ls label tun0"