Sunday, 26 September 2021

Securely connect to Google CloudSQL MySQL instance from DBeaver

Setup a driver using Googles Socket Factory

Driver Manager → New

Name: Google Cloud SQL – MySQL
Type: MySQL
Class Name: com.mysql.cj.jdbc.Driver
URL Template: jdbc:mysql:///[{database}]?cloudSqlInstance={host}
Default Port: 0



Libraries → Add Artifact
GroupId: mysql
ArtifactId: mysql-connector-java
Version: RELEASE

→ Add Artifact
Group Id: com.google.cloud.sql
Artifact Id: mysql-socket-factory-connector-j-8
Version:RELEASE


Driver Properties → right click → add new
socketFactory: com.google.cloud.sql.mysql.SocketFactory
cloudSqlInstance: {host}

Create a connection

set the username and password as usual

Edit the cloudSqlInstance property



Done!

Tuesday, 15 December 2015

Access your modems web admin screen from behind a T-Link Archer C2600 router


These instructions will no doubt work for other Tp-Link routers out there.


Assume you have a Cable/DSL modem on 192.168.0.1/255.255.255.0 and the T-Link is on the
default 192.168.1.1/255.255.255.0

If your modem / router are both on the same ip network, i.e. they both use 192.168.1.1, then you'll need to reconfigure one of them to use a different network.

Plug your modem directly into you computer, or LAN switch.  You should be able to access it at http://192.168.0.1.  Now plug it into the WAN port on your router, you can no longer access it.

PC<192.168.1.2> -> Router LAN interfance<192.168.1.1> -> pppoe to the modem -> internet.

The problem is your PC can't access the modem on the local network, as the modem is on the WAN port of the router which is a separate physical network.  So it tries to route the request to the default gateway (the router).  The router only knows about your 192.168.1.1 network, so it routes to its default gateway over the PPPoE WAN interface onwards to the ISP who also knows nothing about your modem being on 192.168.0.1

  1. Login to the C2600s router admin page.
  2. Goto Advanced => Network => Internet => Advanced
  3. Specify a secondary connection.
    1. Connection Type: Static IP
    2. Ip Address: 192.168.0.3
    3. Subnet Mask: 255.255.255.0
  4. Leave all the other advanced settings alone.
Check the "Advanced Routing" page. you should see a new entry for 192.168.0.0 on the wan interface.

IDNetwork DestinationSubnet MaskGatewayInterface
10.0.0.00.0.0.0xxx.xxx.xxx.xxxinternet
2xxx.xxx.xxx.xxx255.255.255.2550.0.0.0internet
3192.168.0.0255.255.255.00.0.0.0wan
4192.168.1.0255.255.255.00.0.0.0lan

Now when your PC routes the request for 192.168.0.1 to the router, the router knows it can access that address via the WAN interface, instead of forwarding it to the default "internet" interface.


http://192.168.0.1 should bring up your modems admin page so you can check DSL stats etc.

This was tested on Firmware 1.1.2/20150924/66045

Enjoy.