Connecting to both local lan and 3’s 3G Dongle on the Mac

A problem reported elsewhere on the net with 3’s 3G Broadband dongles is that while you are connected to the net it disconnects you from your local lan preventing you from accessing both. I presume its to prevent people from sharing the broadband without using their dedicated router which they sell to connect the dongle direct to the lan.

Anyhow the main problem for me is that when using a VPN with the dongle, the Mac could connect to the remote network fine, but Windows or Linux running inside VMWare could not as the dongle broke the network. This was causing me problems as I need to access MSSQL on the odd occasion.

Anyhow I’ve managed to figure out a way to allow the local lan to be connected at the same time with the dongle. In fact it’s so simple it’s stupid and I’m surprised no one has documented this anywhere else online – at least I never found it and various forums I’ve seen this question on don’t have this solution.

The trick is:

  1. Connect to the net
  2. Open System Preferences and click on Network
  3. You should see 3Connect in the Location dropdown – if not make sure it’s visible
  4. On the left you should see the list of interfaces (Ethernet, Bluetooth etc) all greyed out.
  5. Click on the + at the bottom left corner of that list and a popup appears.
  6. Select Ethernet in the Interface dropdown then press Create
  7. Now if you use DHCP like I do thats it – DHCP will kick in within a few seconds.
  8. If you don’t use DHCP then simply configure the new interface with a local static IP.

That’s it – nice and simple. Your milage may vary with this, but at least it worked for me.

Here’s the screenshot where you can see Ethernet 2 connected and the Dongle (disconnected when I took this screenshot):

Finding the process id of the process owning a port

Occasionally there’s time where you need to find out what process owns a port currently open.

On the Mac this can be done easily by using the following line – here we are looking for port 8080:

ps u –no-heading -p  `netstat -nlept | awk ‘/[:]8080 / {split ($9,t,”/”); print t[1]}’` 2>/dev/null

For windows you don’t have a decent shell (and cygwin would probably not work here), so you can use the following batch script to do the same:

@echo off

for /F “usebackq tokens=5″ %%f in (`netstat -b -n ^| find “:%1″`) do call :process %%f

goto :eof

:process

tasklist /FI “PID eq %1″ /NH

If the above code was called findport.bat then running findport 8080 would then find the process owning port 8080.

Finding the process id of the process owning a port

Occasionally there’s time where you need to find out what process owns a port currently open.

On the Mac this can be done easily by using the following line – here we are looking for port 8080:

ps u –no-heading -p `netstat -nlept | awk ‘/[:]8080 / {split ($9,t,”/”); print t[1]}’` 2>/dev/null

For windows you don’t have a decent shell (and cygwin would probably not work here), so you can use the following batch script to do the same:

@echo off

for /F “usebackq tokens=5″ %%f in (`netstat -b -n ^| find “:%1″`) do call :process %%f
goto :eof

:process
tasklist /FI “PID eq %1″ /NH

If the above code was called findport.bat then running findport 8080 would then find the process owning port 8080.