3 Replies Latest reply: Oct 20, 2009 7:16 PM by Andbrowny
risingdead Level 1 Level 1 (5 points)
I am relatively new to the unix command line tools and i am trying create a new network service through the command line. I am trying to create a Cisco IPSec service through the command line using the network setup command line tool but with no luck. Here is what I have so far consulting the manual pages.

sudo networksetup -createnetworkservice VPN IPSec

However, this results in the error "IPsec is not a valid hardware port name."
Can anyone guide me in the right direction,

Macbook Pro (Early 2008), Mac OS X (10.6.1)
  • 1. Re: NetworkSetup commandline
    Andbrowny Level 4 Level 4 (1,610 points)
    Hi mac_life, you need to have interface after VPN

    $sudo networksetup -createnetworkservice VPN en0 -where en0 is the network interface you want
    the VPN to be created on and you have no VPN setup called VPN.
    Then you can check it has been created with

    $networksetup -getinfo VPN
    which will give you

    DHCP Configuration
    Client ID:
    IPv6: Automatic
    IPv6 IP address: none
    IPv6 Router: none
    Ethernet Address: :*:*:

    I'd assume it defaults to VPN (L2TP over IPSec) I cannot find a way to list what type of VPN it is once setup but you could try
    $sudo networksetup -createnetworkservice VPN en0 'Cisco IPSec'

  • 2. Re: NetworkSetup commandline
    risingdead Level 1 Level 1 (5 points)

    Thanks for responding, but my problem is still standing. Here's whats happening, when i create a new Cisco IPSec VPN service through the system preferences, it adds it with a "Pad lock" icon on the side. Now if i go in terminal and use the command "networksetup -listnetworkserviceorder" here's what i get

    +(1) Bluetooth DUN+
    +(Hardware Port: Bluetooth DUN, Device: Bluetooth-Modem)+

    +(2) Ethernet+
    +(Hardware Port: Ethernet, Device: en0)+

    +(3) FireWire+
    +(Hardware Port: FireWire, Device: fw0)+

    +(4) AirPort 2+
    +(Hardware Port: AirPort, Device: en1)+

    +(5) VPN (Cisco IPSec)+
    (*Hardware Port*+: IPSec, Device: )+

    Now if you notice the hardware port is declared as IPSec and the device has no value assigned to it. Thats the origins of my previous attempts to create a VPN Service through the terminal (sudo networksetup -createnetworkservice VPN IPSec) which returns the value that "IPSec is not a valid *Hardware Port* name".
    I am sorry if i wasn't clear enough on my first port, but i am just trying to create a new VPN service using the Snow Leopard's Cisco IPSec Client.

    Thanks again,

    Message was edited by: mac_life
  • 3. Re: NetworkSetup commandline
    Andbrowny Level 4 Level 4 (1,610 points)
    Hmmm I seem to get the same results... and not sure why.